Commit 40a83b2f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Handle context acquisition failure in wined3d_device_create_primary_opengl_context_cs().

Now that we no longer always call context_acquire() from swapchain_init(), context acquisition can fail here instead. This fixes a regression introduced by commit 64d41b3d. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47468Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 4a902de2
...@@ -1108,10 +1108,19 @@ void wined3d_device_create_primary_opengl_context_cs(void *object) ...@@ -1108,10 +1108,19 @@ void wined3d_device_create_primary_opengl_context_cs(void *object)
struct wined3d_texture *target; struct wined3d_texture *target;
HRESULT hr; HRESULT hr;
swapchain = device->swapchains[0];
target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
if (!(context = context_acquire(device, target, 0)))
{
WARN("Failed to acquire context.\n");
return;
}
if (FAILED(hr = device->shader_backend->shader_alloc_private(device, if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
device->adapter->vertex_pipe, device->adapter->fragment_pipe))) device->adapter->vertex_pipe, device->adapter->fragment_pipe)))
{ {
ERR("Failed to allocate shader private data, hr %#x.\n", hr); ERR("Failed to allocate shader private data, hr %#x.\n", hr);
context_release(context);
return; return;
} }
...@@ -1119,6 +1128,7 @@ void wined3d_device_create_primary_opengl_context_cs(void *object) ...@@ -1119,6 +1128,7 @@ void wined3d_device_create_primary_opengl_context_cs(void *object)
{ {
ERR("Failed to create CPU blitter.\n"); ERR("Failed to create CPU blitter.\n");
device->shader_backend->shader_free_private(device, NULL); device->shader_backend->shader_free_private(device, NULL);
context_release(context);
return; return;
} }
wined3d_ffp_blitter_create(&device->blitter, &device->adapter->gl_info); wined3d_ffp_blitter_create(&device->blitter, &device->adapter->gl_info);
...@@ -1127,9 +1137,6 @@ void wined3d_device_create_primary_opengl_context_cs(void *object) ...@@ -1127,9 +1137,6 @@ void wined3d_device_create_primary_opengl_context_cs(void *object)
wined3d_fbo_blitter_create(&device->blitter, &device->adapter->gl_info); wined3d_fbo_blitter_create(&device->blitter, &device->adapter->gl_info);
wined3d_raw_blitter_create(&device->blitter, &device->adapter->gl_info); wined3d_raw_blitter_create(&device->blitter, &device->adapter->gl_info);
swapchain = device->swapchains[0];
target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
context = context_acquire(device, target, 0);
context_gl = wined3d_context_gl(context); context_gl = wined3d_context_gl(context);
wined3d_device_gl_create_dummy_textures(wined3d_device_gl(device), context_gl); wined3d_device_gl_create_dummy_textures(wined3d_device_gl(device), context_gl);
create_default_samplers(device, context); create_default_samplers(device, context);
......
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