[PATCH 2/2] wined3d: Create a backup context if setting the pixel format failed in wined3d_context_gl_create_wgl_ctx().
Henri Verbeet
hverbeet at codeweavers.com
Mon Nov 18 08:18:12 CST 2019
From: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
This supersedes patch 173738.
dlls/wined3d/context.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 5b8402bfe4f..c5d2eeaa477 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2033,9 +2033,27 @@ 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);
- return FALSE;
+
+ 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;
--
2.11.0
More information about the wine-devel
mailing list