Matteo Bruni : opengl32: Store the OpenGL context version in the handle value.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 16 14:12:31 CST 2015


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Fri Jan 16 19:38:54 2015 +0100

opengl32: Store the OpenGL context version in the handle value.

---

 dlls/opengl32/wgl.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 3a5e148..32d241c 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -51,8 +51,9 @@ extern struct opengl_funcs null_opengl_funcs;
 
 enum wgl_handle_type
 {
-    HANDLE_CONTEXT = 0 << 12,
-    HANDLE_PBUFFER = 1 << 12,
+    HANDLE_PBUFFER = 0 << 12,
+    HANDLE_CONTEXT = 1 << 12,
+    HANDLE_CONTEXT_V3 = 3 << 12,
     HANDLE_TYPE_MASK = 15 << 12
 };
 
@@ -270,8 +271,24 @@ HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attrib
     {
         if ((context = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context) )))
         {
+            enum wgl_handle_type type = HANDLE_CONTEXT;
+
+            if (attribs)
+            {
+                while (*attribs)
+                {
+                    if (attribs[0] == WGL_CONTEXT_MAJOR_VERSION_ARB)
+                    {
+                        if (attribs[1] >= 3)
+                            type = HANDLE_CONTEXT_V3;
+                        break;
+                    }
+                    attribs += 2;
+                }
+            }
+
             context->drv_ctx = drv_ctx;
-            if (!(ret = alloc_handle( HANDLE_CONTEXT, funcs, context )))
+            if (!(ret = alloc_handle( type, funcs, context )))
                 HeapFree( GetProcessHeap(), 0, context );
         }
         if (!ret) funcs->wgl.p_wglDeleteContext( drv_ctx );




More information about the wine-cvs mailing list