Instead of calling context_create() directly.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/context.c | 7 ++++--- dlls/wined3d/swapchain.c | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 38a4462b051..7cd16d5b7ea 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -4264,7 +4264,8 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, { TRACE("Rendering onscreen.\n");
- context = swapchain_get_context(texture->swapchain); + if (!(context = swapchain_get_context(texture->swapchain))) + return NULL; } else { @@ -4274,8 +4275,8 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, * context for the primary swapchain. */ if (current_context && current_context->device == device) context = current_context; - else - context = swapchain_get_context(device->swapchains[0]); + else if (!(context = swapchain_get_context(device->swapchains[0]))) + return NULL; }
context_activate(context, texture, sub_resource_idx); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index f47c1a44297..fbedd7470df 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -720,20 +720,20 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s static void wined3d_swapchain_cs_init(void *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; } - swapchain->num_contexts = 1;
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && (!swapchain->desc.enable_auto_depth_stencil || swapchain->desc.auto_depth_stencil_format != swapchain->ds_format->id)) 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)