Matteo Bruni : wined3d: Default to using a non-forward-compatible core profile context.

Alexandre Julliard julliard at winehq.org
Mon May 14 17:20:09 CDT 2018


Module: wine
Branch: master
Commit: f942df461b82792b3908e38ad79c22b440b00711
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f942df461b82792b3908e38ad79c22b440b00711

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Thu May  3 00:04:04 2018 +0200

wined3d: Default to using a non-forward-compatible core profile context.

It should make it easier for the GL driver to upgrade the context to a
GL version higher than strictly requested.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index b96733f..300b79b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1849,8 +1849,6 @@ HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc,
     ctx_attribs[ctx_attrib_idx++] = gl_info->selected_gl_version >> 16;
     ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_MINOR_VERSION_ARB;
     ctx_attribs[ctx_attrib_idx++] = gl_info->selected_gl_version & 0xffff;
-    if (gl_info->selected_gl_version >= MAKEDWORD_VERSION(3, 2))
-        ctx_flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
     if (ctx_flags)
     {
         ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_FLAGS_ARB;
@@ -1860,9 +1858,20 @@ HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc,
 
     if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs)))
     {
-        if (ctx_flags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
+        if (gl_info->selected_gl_version >= MAKEDWORD_VERSION(3, 2))
         {
-            ctx_attribs[ctx_attrib_idx - 1] &= ~WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+            if (ctx_flags)
+            {
+                ctx_flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+                ctx_attribs[ctx_attrib_idx - 1] = ctx_flags;
+            }
+            else
+            {
+                ctx_flags = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+                ctx_attribs[ctx_attrib_idx++] = WGL_CONTEXT_FLAGS_ARB;
+                ctx_attribs[ctx_attrib_idx++] = ctx_flags;
+                ctx_attribs[ctx_attrib_idx] = 0;
+            }
             if (!(ctx = gl_info->p_wglCreateContextAttribsARB(hdc, share_ctx, ctx_attribs)))
                 WARN("Failed to create a WGL context with wglCreateContextAttribsARB, last error %#x.\n",
                         GetLastError());




More information about the wine-cvs mailing list