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
64d41b3dec.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47468
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-07-06 19:08:49 +04:30 committed by Alexandre Julliard
parent 4a902de213
commit 40a83b2ff3
1 changed files with 10 additions and 3 deletions

View File

@ -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)
{ {
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)
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);