Commit db201072 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use context_acquire() in wined3d_swapchain_cs_init().

Instead of calling context_create() directly. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0fdce942
...@@ -4264,7 +4264,8 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, ...@@ -4264,7 +4264,8 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
{ {
TRACE("Rendering onscreen.\n"); TRACE("Rendering onscreen.\n");
context = swapchain_get_context(texture->swapchain); if (!(context = swapchain_get_context(texture->swapchain)))
return NULL;
} }
else else
{ {
...@@ -4274,8 +4275,8 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, ...@@ -4274,8 +4275,8 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
* context for the primary swapchain. */ * context for the primary swapchain. */
if (current_context && current_context->device == device) if (current_context && current_context->device == device)
context = current_context; context = current_context;
else else if (!(context = swapchain_get_context(device->swapchains[0])))
context = swapchain_get_context(device->swapchains[0]); return NULL;
} }
context_activate(context, texture, sub_resource_idx); context_activate(context, texture, sub_resource_idx);
......
...@@ -720,20 +720,20 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s ...@@ -720,20 +720,20 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s
static void wined3d_swapchain_cs_init(void *object) static void wined3d_swapchain_cs_init(void *object)
{ {
struct wined3d_swapchain *swapchain = object; struct wined3d_swapchain *swapchain = object;
struct wined3d_context *context;
if (!(swapchain->context[0] = context_create(swapchain))) if (!(context = context_acquire(swapchain->device, swapchain->front_buffer, 0)))
{ {
WARN("Failed to create context.\n"); WARN("Failed to acquire context.\n");
return; return;
} }
swapchain->num_contexts = 1;
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& (!swapchain->desc.enable_auto_depth_stencil && (!swapchain->desc.enable_auto_depth_stencil
|| swapchain->desc.auto_depth_stencil_format != swapchain->ds_format->id)) || swapchain->desc.auto_depth_stencil_format != swapchain->ds_format->id))
FIXME("Add OpenGL context recreation support.\n"); FIXME("Add OpenGL context recreation support.\n");
context_release(swapchain->context[0]); context_release(context);
} }
void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain, const struct wined3d_device *device) void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain, const struct wined3d_device *device)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment