wined3d: Create a backup context if setting the pixel format failed in wined3d_context_gl_create_wgl_ctx().

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-11-18 17:48:12 +03:30 committed by Alexandre Julliard
parent ecad635124
commit 645eb62f70
1 changed files with 20 additions and 2 deletions

View File

@ -2033,11 +2033,29 @@ static BOOL wined3d_context_gl_create_wgl_ctx(struct wined3d_context_gl *context
if (!wined3d_context_gl_set_pixel_format(context_gl))
{
ERR("Failed to set pixel format %d on device context %p.\n", context_gl->pixel_format, context_gl->dc);
context_release(context);
if (context_gl->dc_is_private)
{
ERR("Failed to set pixel format %d on device context %p.\n", context_gl->pixel_format, context_gl->dc);
return FALSE;
}
WARN("Failed to set pixel format %d on device context %p, trying backup DC.\n",
context_gl->pixel_format, context_gl->dc);
wined3d_release_dc(context_gl->window, context_gl->dc);
if (!(context_gl->dc = wined3d_swapchain_gl_get_backup_dc(swapchain_gl)))
{
ERR("Failed to retrieve the backup device context.\n");
return E_FAIL;
}
context_gl->dc_is_private = TRUE;
return wined3d_context_gl_create_wgl_ctx(context_gl, swapchain_gl);
}
share_ctx = device->context_count ? wined3d_context_gl(device->contexts[0])->gl_ctx : NULL;
if (gl_info->p_wglCreateContextAttribsARB)
{