From: havoc Date: Sat, 1 Mar 2008 08:03:23 +0000 (+0000) Subject: fixed GL_CheckExtension to not even bother checking for an extension if X-Git-Tag: xonotic-v0.1.0preview~2353 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=34e90c208b9cc8aab4a7599e42baa38b28dae423;p=xonotic%2Fdarkplaces.git fixed GL_CheckExtension to not even bother checking for an extension if 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 --- diff --git a/vid_shared.c b/vid_shared.c index aaea23c0..0e907dd7 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -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[] = diff --git a/vid_wgl.c b/vid_wgl.c index d876ad6c..3884cb07 100644 --- 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();