]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fixed GL_CheckExtension to not even bother checking for an extension if
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 1 Mar 2008 08:03:23 +0000 (08:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 1 Mar 2008 08:03:23 +0000 (08:03 +0000)
the name does not begin with GL_ or WGL_ or similar things

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8171 d7cf8633-e32d-0410-b094-e92efae38249

vid_shared.c
vid_wgl.c

index aaea23c0a45c746fb9bf15e1b9e3a3e8edcbb7b5..0e907dd7d595e04b3decfdcbd9772f0dec4ed49b 100644 (file)
@@ -397,29 +397,27 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *
                return false;
        }
 
-       if (strstr(gl_extensions, name) || strstr(gl_platformextensions, name) || (strncmp(name, "GL_", 3) && strncmp(name, "WGL_", 4) && strncmp(name, "GLX_", 4) && strncmp(name, "AGL_", 4)))
+       if ((name[2] == '_' || name[3] == '_') && !strstr(gl_extensions ? gl_extensions : "", name) && !strstr(gl_platformextensions ? gl_platformextensions : "", name))
        {
-               for (func = funcs;func && func->name != NULL;func++)
+               Con_DPrint("not detected\n");
+               return false;
+       }
+
+       for (func = funcs;func && func->name != NULL;func++)
+       {
+               // functions are cleared before all the extensions are evaluated
+               if (!(*func->funcvariable = (void *) GL_GetProcAddress(func->name)))
                {
-                       // functions are cleared before all the extensions are evaluated
-                       if (!(*func->funcvariable = (void *) GL_GetProcAddress(func->name)))
-                       {
-                               if (!silent)
-                                       Con_DPrintf("OpenGL extension \"%s\" is missing function \"%s\" - broken driver!\n", name, func->name);
-                               failed = true;
-                       }
+                       if (!silent)
+                               Con_DPrintf("OpenGL extension \"%s\" is missing function \"%s\" - broken driver!\n", name, func->name);
+                       failed = true;
                }
-               // delay the return so it prints all missing functions
-               if (failed)
-                       return false;
-               Con_DPrint("enabled\n");
-               return true;
        }
-       else
-       {
-               Con_DPrint("not detected\n");
+       // delay the return so it prints all missing functions
+       if (failed)
                return false;
-       }
+       Con_DPrint("enabled\n");
+       return true;
 }
 
 static dllfunction_t opengl110funcs[] =
index d876ad6cf4601d30b1ac659c3381e67e0aef34ae..3884cb07a21359c02ef556cc8ba3e679b4d4aa7c 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -1098,6 +1098,9 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int refreshrat
        // start out at the final windowpass if samples is 1 as it's the only feature we need extended pixel formats for
        for (windowpass = samples == 1;windowpass < 2;windowpass++)
        {
+               gl_extensions = "";
+               gl_platformextensions = "";
+
                mainwindow = CreateWindowEx (ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL);
                if (!mainwindow)
                {
@@ -1125,8 +1128,6 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int refreshrat
                        return false;
                }
 
-               gl_extensions = "";
-               gl_platformextensions = "";
                if (!GL_CheckExtension("wgl", wglfuncs, NULL, false))
                {
                        VID_Shutdown();