[PATCH v3 1/2] wined3d: Only use default SetPixelFormat on private windows.

Connor McAdams cmcadams at codeweavers.com
Fri Apr 16 16:11:25 CDT 2021


Only use the default SetPixelFormat function if the format is unset and
the window is private. If the window isn't private, use
wglSetPixelFormatWINE, which allows for another application to change
the pixel format.

Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
---
 dlls/wined3d/context_gl.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index 123214afd5d..5f0bab5b78b 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -1198,12 +1198,24 @@ static BOOL wined3d_context_gl_set_pixel_format(struct wined3d_context_gl *conte
 
     if (!current)
     {
-        if (!SetPixelFormat(dc, format, NULL))
+        if (private)
         {
-            /* This may also happen if the dc belongs to a destroyed window. */
-            WARN("Failed to set pixel format %d on device context %p, last error %#x.\n",
-                    format, dc, GetLastError());
-            return FALSE;
+            if (!SetPixelFormat(dc, format, NULL))
+            {
+                /* This may also happen if the dc belongs to a destroyed window. */
+                WARN("Failed to set pixel format %d on device context %p, last error %#x.\n",
+                        format, dc, GetLastError());
+                return FALSE;
+            }
+        }
+        else
+        {
+            if (!GL_EXTCALL(wglSetPixelFormatWINE(dc, format)))
+            {
+                ERR("wglSetPixelFormatWINE failed to set pixel format %d on device context %p.\n",
+                        format, dc);
+                return FALSE;
+            }
         }
 
         context_gl->restore_pf = 0;
-- 
2.25.1




More information about the wine-devel mailing list