Henri Verbeet : wined3d: The current WGL DC should never be NULL in wined3d_adapter_init_gl_caps().

Alexandre Julliard julliard at winehq.org
Fri Mar 16 11:27:48 CDT 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Mar 15 21:49:54 2012 +0100

wined3d: The current WGL DC should never be NULL in wined3d_adapter_init_gl_caps().

---

 dlls/wined3d/directx.c |   73 +++++++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 5c46d07..92a2298 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2823,49 +2823,48 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
     gl_info->wrap_lookup[WINED3D_TADDRESS_MIRROR_ONCE - WINED3D_TADDRESS_WRAP] =
             gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] ? GL_MIRROR_CLAMP_TO_EDGE_ATI : GL_REPEAT;
 
-    /* Make sure there's an active HDC else the WGL extensions will fail */
     hdc = pwglGetCurrentDC();
-    if (hdc) {
-        /* Not all GL drivers might offer WGL extensions e.g. VirtualBox */
-        if(GL_EXTCALL(wglGetExtensionsStringARB))
-            WGL_Extensions = GL_EXTCALL(wglGetExtensionsStringARB(hdc));
-
-        if (!WGL_Extensions)
-        {
-            ERR("   WGL_Extensions returns NULL\n");
-        }
-        else
+    /* Not all GL drivers might offer WGL extensions e.g. VirtualBox. */
+    if (GL_EXTCALL(wglGetExtensionsStringARB))
+        WGL_Extensions = GL_EXTCALL(wglGetExtensionsStringARB(hdc));
+    if (!WGL_Extensions)
+        WARN_(d3d_caps)("WGL extensions not supported.\n");
+    else
+    {
+        TRACE_(d3d_caps)("WGL_Extensions reported:\n");
+        while (*WGL_Extensions)
         {
-            TRACE_(d3d_caps)("WGL_Extensions reported:\n");
-            while (*WGL_Extensions)
-            {
-                const char *Start;
-                char ThisExtn[256];
+            const char *start;
+            char current_ext[256];
 
-                while (isspace(*WGL_Extensions)) WGL_Extensions++;
-                Start = WGL_Extensions;
-                while (!isspace(*WGL_Extensions) && *WGL_Extensions) ++WGL_Extensions;
+            while (isspace(*WGL_Extensions))
+                ++WGL_Extensions;
+            start = WGL_Extensions;
+            while (!isspace(*WGL_Extensions) && *WGL_Extensions)
+                ++WGL_Extensions;
 
-                len = WGL_Extensions - Start;
-                if (!len || len >= sizeof(ThisExtn))
-                    continue;
+            len = WGL_Extensions - start;
+            if (!len || len >= sizeof(current_ext))
+                continue;
 
-                memcpy(ThisExtn, Start, len);
-                ThisExtn[len] = '\0';
-                TRACE_(d3d_caps)("- %s\n", debugstr_a(ThisExtn));
+            memcpy(current_ext, start, len);
+            current_ext[len] = '\0';
+            TRACE_(d3d_caps)("- %s\n", debugstr_a(current_ext));
 
-                if (!strcmp(ThisExtn, "WGL_ARB_pixel_format")) {
-                    gl_info->supported[WGL_ARB_PIXEL_FORMAT] = TRUE;
-                    TRACE_(d3d_caps)("FOUND: WGL_ARB_pixel_format support\n");
-                }
-                if (!strcmp(ThisExtn, "WGL_EXT_swap_control")) {
-                    gl_info->supported[WGL_EXT_SWAP_CONTROL] = TRUE;
-                    TRACE_(d3d_caps)("FOUND: WGL_EXT_swap_control support\n");
-                }
-                if (!strcmp(ThisExtn, "WGL_WINE_pixel_format_passthrough")) {
-                    gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH] = TRUE;
-                    TRACE_(d3d_caps)("FOUND: WGL_WINE_pixel_format_passthrough support\n");
-                }
+            if (!strcmp(current_ext, "WGL_ARB_pixel_format"))
+            {
+                gl_info->supported[WGL_ARB_PIXEL_FORMAT] = TRUE;
+                TRACE_(d3d_caps)("FOUND: WGL_ARB_pixel_format support\n");
+            }
+            if (!strcmp(current_ext, "WGL_EXT_swap_control"))
+            {
+                gl_info->supported[WGL_EXT_SWAP_CONTROL] = TRUE;
+                TRACE_(d3d_caps)("FOUND: WGL_EXT_swap_control support\n");
+            }
+            if (!strcmp(current_ext, "WGL_WINE_pixel_format_passthrough"))
+            {
+                gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH] = TRUE;
+                TRACE_(d3d_caps)("FOUND: WGL_WINE_pixel_format_passthrough support\n");
             }
         }
     }




More information about the wine-cvs mailing list