diff --git a/doomsday/client/include/gl/sys_opengl.h b/doomsday/client/include/gl/sys_opengl.h index bcecac3f75..250bfaab58 100644 --- a/doomsday/client/include/gl/sys_opengl.h +++ b/doomsday/client/include/gl/sys_opengl.h @@ -87,10 +87,6 @@ */ typedef struct gl_state_s { /// Global config: - boolean forceFinishBeforeSwap; - int maxTexFilterAniso; - int maxTexSize; // Pixels. - int maxTexUnits; int multisampleFormat; /// Current state: @@ -110,25 +106,6 @@ typedef struct gl_state_s { uint texNonPowTwo : 1; uint vsync : 1; } features; - - /// Extension availability bits: - struct { - uint blendSub : 1; - uint genMipmapSGIS : 1; - uint lockArray : 1; -#ifdef USE_TEXTURE_COMPRESSION_S3 - uint texCompressionS3 : 1; -#endif - uint texEnvComb : 1; - uint texEnvCombNV : 1; - uint texEnvCombATI : 1; - uint texFilterAniso : 1; - uint texNonPowTwo : 1; -#if WIN32 - uint wglMultisampleARB : 1; - uint wglSwapIntervalEXT : 1; -#endif - } extensions; } gl_state_t; typedef enum arraytype_e { @@ -195,11 +172,6 @@ void Sys_GLConfigureDefaultState(void); */ void Sys_GLPrintExtensions(void); -/** - * @return Non-zero iff the extension is found. - */ -boolean Sys_GLQueryExtension(const char* name, const GLubyte* extensions); - boolean Sys_GLCheckError(void); #endif // __CLIENT__ diff --git a/doomsday/client/src/gl/dgl_common.cpp b/doomsday/client/src/gl/dgl_common.cpp index 04e1495c23..2f31eaaa80 100644 --- a/doomsday/client/src/gl/dgl_common.cpp +++ b/doomsday/client/src/gl/dgl_common.cpp @@ -35,6 +35,7 @@ #include "api_gl.h" #include +#include using namespace de; @@ -51,11 +52,11 @@ static void envAddColoredAlpha(int activate, GLenum addFactor) if(activate) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, - GL_state.extensions.texEnvCombNV ? GL_COMBINE4_NV : GL_COMBINE); + GLInfo::extensions().NV_texture_env_combine4? GL_COMBINE4_NV : GL_COMBINE); glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1); // Combine: texAlpha * constRGB + 1 * prevRGB. - if(GL_state.extensions.texEnvCombNV) + if(GLInfo::extensions().NV_texture_env_combine4) { glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); @@ -67,7 +68,7 @@ static void envAddColoredAlpha(int activate, GLenum addFactor) glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE3_RGB_NV, GL_PREVIOUS); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND3_RGB_NV, GL_SRC_COLOR); } - else if(GL_state.extensions.texEnvCombATI) + else if(GLInfo::extensions().ATI_texture_env_combine3) { // MODULATE_ADD_ATI: Arg0 * Arg2 + Arg1. glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); @@ -205,7 +206,7 @@ void GL_ModulateTexture(int mode) envAddColoredAlpha(true, mode == 5 ? GL_SRC_ALPHA : GL_SRC_COLOR); // Alpha remains unchanged. - if(GL_state.extensions.texEnvCombNV) + if(GLInfo::extensions().NV_texture_env_combine4) { glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_ZERO); @@ -398,11 +399,10 @@ boolean DGL_GetIntegerv(int name, int *v) switch(name) { case DGL_MODULATE_ADD_COMBINE: - *v = GL_state.extensions.texEnvCombNV || GL_state.extensions.texEnvCombATI; + *v = GLInfo::extensions().NV_texture_env_combine4 || GLInfo::extensions().ATI_texture_env_combine3; break; case DGL_SCISSOR_TEST: - //glGetIntegerv(GL_SCISSOR_TEST, (GLint*) v); *(GLint *) v = GLState::current().scissor(); break; diff --git a/doomsday/client/src/gl/gl_main.cpp b/doomsday/client/src/gl/gl_main.cpp index b94159d62c..bd8eaef08a 100644 --- a/doomsday/client/src/gl/gl_main.cpp +++ b/doomsday/client/src/gl/gl_main.cpp @@ -48,6 +48,7 @@ #include "render/vr.h" #include +#include #include D_CMD(Fog); @@ -299,10 +300,6 @@ static void printConfiguration() LOG_VERBOSE(" Texture Anisotropy: %s") << (GL_state.features.texFilterAniso? "variable" : "fixed"); LOG_VERBOSE(" Texture Compression: %b") << GL_state.features.texCompression; LOG_VERBOSE(" Texture NPOT: %b") << GL_state.features.texNonPowTwo; - if(GL_state.forceFinishBeforeSwap) - { - LOG_VERBOSE(" glFinish() forced before swapping buffers."); - } } boolean GL_EarlyInit() @@ -315,8 +312,9 @@ boolean GL_EarlyInit() gamma_support = !CommandLine_Check("-noramp"); // We are simple people; two texture units is enough. - numTexUnits = MIN_OF(GL_state.maxTexUnits, MAX_TEX_UNITS); - envModAdd = (GL_state.extensions.texEnvCombNV || GL_state.extensions.texEnvCombATI); + numTexUnits = MIN_OF(GLInfo::limits().maxTexUnits, MAX_TEX_UNITS); + envModAdd = (GLInfo::extensions().NV_texture_env_combine4 || + GLInfo::extensions().ATI_texture_env_combine3); GL_InitDeferredTask(); @@ -325,21 +323,11 @@ boolean GL_EarlyInit() Rend_ModelInit(); // Check the maximum texture size. - if(GL_state.maxTexSize == 256) + if(GLInfo::limits().maxTexSize == 256) { LOG_WARNING("Using restricted texture w/h ratio (1:8)"); ratioLimit = 8; } - // Set a custom maximum size? - if(CommandLine_CheckWith("-maxtex", 1)) - { - int customSize = M_CeilPow2(strtol(CommandLine_Next(), 0, 0)); - - if(GL_state.maxTexSize < customSize) - customSize = GL_state.maxTexSize; - GL_state.maxTexSize = customSize; - LOG_INFO("Using maximum texture size of %i x %i") << GL_state.maxTexSize << GL_state.maxTexSize; - } if(CommandLine_Check("-outlines")) { fillOutlines = false; @@ -822,7 +810,7 @@ int GL_GetTexAnisoMul(int level) { if(level < 0) { // Go with the maximum! - mul = GL_state.maxTexFilterAniso; + mul = GLInfo::limits().maxTexFilterAniso; } else { // Convert from a DGL aniso level to a multiplier. @@ -841,8 +829,7 @@ int GL_GetTexAnisoMul(int level) } // Clamp. - if(mul > GL_state.maxTexFilterAniso) - mul = GL_state.maxTexFilterAniso; + mul = MIN_OF(mul, GLInfo::limits().maxTexFilterAniso); } } diff --git a/doomsday/client/src/gl/gl_texmanager.cpp b/doomsday/client/src/gl/gl_texmanager.cpp index 1bca31c5b7..710b7e46ac 100644 --- a/doomsday/client/src/gl/gl_texmanager.cpp +++ b/doomsday/client/src/gl/gl_texmanager.cpp @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -1280,7 +1281,7 @@ static GLint ChooseTextureFormat(dgltexformat_t format, boolean allowCompression if(!compress) return GL_RGB8; #if USE_TEXTURE_COMPRESSION_S3 - if(GL_state.extensions.texCompressionS3) + if(GLInfo::extensions().EXT_texture_compression_s3tc) return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; #endif return GL_COMPRESSED_RGB; @@ -1290,7 +1291,7 @@ static GLint ChooseTextureFormat(dgltexformat_t format, boolean allowCompression if(!compress) return GL_RGBA8; #if USE_TEXTURE_COMPRESSION_S3 - if(GL_state.extensions.texCompressionS3) + if(GLInfo::extensions().EXT_texture_compression_s3tc) return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; #endif return GL_COMPRESSED_RGBA; @@ -1330,7 +1331,7 @@ boolean GL_UploadTextureGrayMipmap(int glFormat, int loadFormat, const uint8_t* (width != M_CeilPow2(width) || height != M_CeilPow2(height))) return false; - if(width > GL_state.maxTexSize || height > GL_state.maxTexSize) + if(width > GLInfo::limits().maxTexSize || height > GLInfo::limits().maxTexSize) return false; numLevels = GL_NumMipmapLevels(width, height); @@ -1396,7 +1397,7 @@ boolean GL_UploadTexture(int glFormat, int loadFormat, const uint8_t* pixels, return false; // Check that the texture dimensions are valid. - if(width > GL_state.maxTexSize || height > GL_state.maxTexSize) + if(width > GLInfo::limits().maxTexSize || height > GLInfo::limits().maxTexSize) return false; if(!GL_state.features.texNonPowTwo && @@ -1414,7 +1415,7 @@ boolean GL_UploadTexture(int glFormat, int loadFormat, const uint8_t* pixels, DENG_ASSERT_GL_CONTEXT_ACTIVE(); // Automatic mipmap generation? - if(GL_state.extensions.genMipmapSGIS && genMipmaps) + if(GLInfo::extensions().SGIS_generate_mipmap && genMipmaps) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); @@ -1427,7 +1428,7 @@ boolean GL_UploadTexture(int glFormat, int loadFormat, const uint8_t* pixels, glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint)unpackSkipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint)unpackSkipPixels); - if(genMipmaps && !GL_state.extensions.genMipmapSGIS) + if(genMipmaps && !GLInfo::extensions().SGIS_generate_mipmap) { // Build all mipmap levels. int neww, newh, bpp, w, h; void* image, *newimage; @@ -2320,14 +2321,14 @@ boolean GL_OptimalTextureSize(int width, int height, boolean noStretch, boolean } // Hardware limitations may force us to modify the preferred size. - if(*optWidth > GL_state.maxTexSize) + if(*optWidth > GLInfo::limits().maxTexSize) { - *optWidth = GL_state.maxTexSize; + *optWidth = GLInfo::limits().maxTexSize; noStretch = false; } - if(*optHeight > GL_state.maxTexSize) + if(*optHeight > GLInfo::limits().maxTexSize) { - *optHeight = GL_state.maxTexSize; + *optHeight = GLInfo::limits().maxTexSize; noStretch = false; } diff --git a/doomsday/client/src/gl/sys_opengl.cpp b/doomsday/client/src/gl/sys_opengl.cpp index b20ff0dfb6..e021e2b446 100644 --- a/doomsday/client/src/gl/sys_opengl.cpp +++ b/doomsday/client/src/gl/sys_opengl.cpp @@ -27,6 +27,7 @@ #include "gl/sys_opengl.h" #include +#include #include #include #include @@ -55,39 +56,11 @@ static boolean doneEarlyInit = false; static boolean inited = false; static boolean firstTimeInit = true; -#if WIN32 -static PROC wglGetExtString; -#endif - -static int query(const char* ext) -{ - int result = 0; - assert(ext); - -#if WIN32 - // Prefer the wgl-specific extensions. - if(wglGetExtString) - { - const GLubyte* extensions = - ((const GLubyte*(__stdcall*)(HDC))wglGetExtString)(wglGetCurrentDC()); - result = (Sys_GLQueryExtension(ext, extensions)? 1 : 0); - } -#endif - - if(!result) - result = (Sys_GLQueryExtension(ext, glGetString(GL_EXTENSIONS))? 1 : 0); - return result; -} - static void initialize(void) { - glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*) &GL_state.maxTexSize); + de::GLInfo::Extensions const &ext = de::GLInfo::extensions(); -#ifdef WIN32 - wglGetExtString = wglGetProcAddress("wglGetExtensionsStringARB"); -#endif - - if(0 != (GL_state.extensions.lockArray = query("GL_EXT_compiled_vertex_array"))) + if(ext.EXT_compiled_vertex_array) { #ifdef LIBGUI_USE_GLENTRYPOINTS GETPROC(PFNGLLOCKARRAYSEXTPROC, glLockArraysEXT); @@ -96,25 +69,29 @@ static void initialize(void) GL_state.features.elementArrays = false; #endif } - if(CommandLine_Exists("-vtxar") && !CommandLine_Exists("-novtxar")) - GL_state.features.elementArrays = true; - if(0 != (GL_state.extensions.texFilterAniso = query("GL_EXT_texture_filter_anisotropic"))) + if(CommandLine_Exists("-vtxar") && !CommandLine_Exists("-novtxar")) { - glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint*) &GL_state.maxTexFilterAniso); + GL_state.features.elementArrays = true; } + if(CommandLine_Exists("-noanifilter")) + { GL_state.features.texFilterAniso = false; + } - GL_state.extensions.texNonPowTwo = query("GL_ARB_texture_non_power_of_two"); - if(!GL_state.extensions.texNonPowTwo || CommandLine_Exists("-notexnonpow2") || CommandLine_Exists("-notexnonpowtwo")) + if(!ext.ARB_texture_non_power_of_two || + CommandLine_Exists("-notexnonpow2") || + CommandLine_Exists("-notexnonpowtwo")) + { GL_state.features.texNonPowTwo = false; + } - if(0 != (GL_state.extensions.blendSub = query("GL_EXT_blend_subtract"))) + if(ext.EXT_blend_subtract) { #ifdef LIBGUI_USE_GLENTRYPOINTS GETPROC(PFNGLBLENDEQUATIONEXTPROC, glBlendEquationEXT); - if(NULL == glBlendEquationEXT) + if(!glBlendEquationEXT) GL_state.features.blendSubtract = false; #endif } @@ -123,19 +100,9 @@ static void initialize(void) GL_state.features.blendSubtract = false; } - // ARB_texture_env_combine - if(0 == (GL_state.extensions.texEnvComb = query("GL_ARB_texture_env_combine"))) - { - // Try the older EXT_texture_env_combine (identical to ARB). - GL_state.extensions.texEnvComb = query("GL_EXT_texture_env_combine"); - } - - GL_state.extensions.texEnvCombNV = query("GL_NV_texture_env_combine4"); - GL_state.extensions.texEnvCombATI = query("GL_ATI_texture_env_combine3"); - #ifdef USE_TEXTURE_COMPRESSION_S3 // Enabled by default if available. - if(0 != (GL_state.extensions.texCompressionS3 = query("GL_EXT_texture_compression_s3tc"))) + if(ext.EXT_texture_compression_s3tc) { GLint iVal; glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &iVal); @@ -146,21 +113,22 @@ static void initialize(void) GL_state.features.texCompression = false; #endif if(CommandLine_Exists("-notexcomp")) + { GL_state.features.texCompression = false; - - glGetIntegerv(GL_MAX_TEXTURE_UNITS, (GLint*) &GL_state.maxTexUnits); + } // Automatic mipmap generation. - GL_state.extensions.genMipmapSGIS = query("GL_SGIS_generate_mipmap"); - if(0 == GL_state.extensions.genMipmapSGIS || CommandLine_Exists("-nosgm")) + if(!ext.SGIS_generate_mipmap || CommandLine_Exists("-nosgm")) + { GL_state.features.genMipmap = false; + } #ifdef WIN32 - if(0 != (GL_state.extensions.wglSwapIntervalEXT = query("WGL_EXT_swap_control"))) + if(ext.WGL_EXT_swap_control) { GETPROC(PFNWGLSWAPINTERVALEXTPROC, wglSwapIntervalEXT); } - if(0 == GL_state.extensions.wglSwapIntervalEXT || NULL == wglSwapIntervalEXT) + if(!ext.WGL_EXT_swap_control || !wglSwapIntervalEXT) GL_state.features.vsync = false; #else GL_state.features.vsync = true; @@ -188,7 +156,7 @@ de::String Sys_GLDescription() GLint iVal; #ifdef USE_TEXTURE_COMPRESSION_S3 - if(GL_state.extensions.texCompressionS3) + if(de::GLInfo::extensions().EXT_texture_compression_s3tc) { glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &iVal); os << TABBED("Compressed texture formats:", iVal); @@ -198,7 +166,7 @@ de::String Sys_GLDescription() glGetIntegerv(GL_MAX_TEXTURE_UNITS, &iVal); os << TABBED("Available texture units:", iVal); - if(GL_state.extensions.texFilterAniso) + if(de::GLInfo::extensions().EXT_texture_filter_anisotropic) { glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &iVal); os << TABBED("Maximum texture anisotropy:", iVal); @@ -230,196 +198,12 @@ static void printGLUInfo(void) Sys_GLPrintExtensions(); } -#if 0 -#ifdef WIN32 -static void testMultisampling(HDC hDC) -{ - int pixelFormat, valid; - uint numFormats; - float fAttributes[] = {0,0}; - int iAttributes[] = { - WGL_DRAW_TO_WINDOW_ARB,GL_TRUE, - WGL_SUPPORT_OPENGL_ARB,GL_TRUE, - WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB, - WGL_COLOR_BITS_ARB,24, - WGL_ALPHA_BITS_ARB,8, - WGL_DEPTH_BITS_ARB,16, - WGL_STENCIL_BITS_ARB,8, - WGL_DOUBLE_BUFFER_ARB,GL_TRUE, - WGL_SAMPLE_BUFFERS_ARB,GL_TRUE, - WGL_SAMPLES_ARB,4, - 0,0 - }; - - // First, see if we can get a pixel format using four samples. - valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats); - - if(valid && numFormats >= 1) - { // This will do nicely. - GL_state.multisampleFormat = pixelFormat; - GL_state.features.multisample = true; - } - else - { // Failed. Try a pixel format using two samples. - iAttributes[19] = 2; - valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats); - if(valid && numFormats >= 1) - { - GL_state.multisampleFormat = pixelFormat; - GL_state.features.multisample = true; - } - } -} - -static void createDummyWindow(application_t* app) -{ - HWND hWnd = NULL; - HGLRC hGLRC = NULL; - boolean ok = true; - - // Create the window. - hWnd = CreateWindowEx(WS_EX_APPWINDOW, TEXT(MAINWCLASS), TEXT("dummy"), - (WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS), - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, - app->hInstance, NULL); - if(hWnd) - { // Initialize. - PIXELFORMATDESCRIPTOR pfd; - int pixForm = 0; - HDC hDC = NULL; - - // Setup the pixel format descriptor. - ZeroMemory(&pfd, sizeof(pfd)); - pfd.nSize = sizeof(pfd); - pfd.nVersion = 1; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.iLayerType = PFD_MAIN_PLANE; -#ifndef DRMESA - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - pfd.cColorBits = 32; - pfd.cDepthBits = 16; - pfd.cStencilBits = 8; -#else /* Double Buffer, no alpha */ - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | - PFD_GENERIC_FORMAT | PFD_DOUBLEBUFFER | PFD_SWAP_COPY; - pfd.cColorBits = 24; - pfd.cRedBits = 8; - pfd.cGreenBits = 8; - pfd.cGreenShift = 8; - pfd.cBlueBits = 8; - pfd.cBlueShift = 16; - pfd.cDepthBits = 16; - pfd.cStencilBits = 2; -#endif - - if(ok) - { - // Acquire a device context handle. - hDC = GetDC(hWnd); - if(!hDC) - { - Sys_CriticalMessage("DD_CreateWindow: Failed acquiring device context handle."); - hDC = NULL; - ok = false; - } - } - - if(ok) - { // Request a matching (or similar) pixel format. - pixForm = ChoosePixelFormat(hDC, &pfd); - if(!pixForm) - { - Sys_CriticalMessage("DD_CreateWindow: Choosing of pixel format failed."); - pixForm = -1; - ok = false; - } - } - - if(ok) - { // Make sure that the driver is hardware-accelerated. - DescribePixelFormat(hDC, pixForm, sizeof(pfd), &pfd); - if((pfd.dwFlags & PFD_GENERIC_FORMAT) && !ArgCheck("-allowsoftware")) - { - Sys_CriticalMessage("DD_CreateWindow: GL driver not accelerated!\n" - "Use the -allowsoftware option to bypass this."); - ok = false; - } - } - - if(ok) - { // Set the pixel format for the device context. Can only be done once - // (unless we release the context and acquire another). - if(!SetPixelFormat(hDC, pixForm, &pfd)) - { - Sys_CriticalMessage("DD_CreateWindow: Failed setting pixel format."); - } - } - - // Create the OpenGL rendering context. - if(ok) - { - if(!(hGLRC = wglCreateContext(hDC))) - { - Sys_CriticalMessage("DD_CreateWindow: Failed creating render context."); - ok = false; - } - // Make the context current. - else if(!wglMakeCurrent(hDC, hGLRC)) - { - Sys_CriticalMessage("DD_CreateWindow: Failed making render context current."); - ok = false; - } - } - - if(ok) - { - PROC wglGetExtensionsStringARB; - const GLubyte* exts; - - GETPROC(wglGetExtensionsStringARB); - exts = ((const GLubyte*(__stdcall*)(HDC))wglGetExtensionsStringARB)(hDC); - - GL_state.extensions.wglMultisampleARB = Sys_GLQueryExtension("WGL_ARB_multisample", exts); - if(GL_state.extensions.wglMultisampleARB) - { - GETPROC(wglChoosePixelFormatARB); - if(wglChoosePixelFormatARB) - testMultisampling(hDC); - } - } - - // We've now finished with the device context. - if(hDC) - ReleaseDC(hWnd, hDC); - } - - // Delete the window's rendering context if one has been acquired. - if(hGLRC) - { - wglMakeCurrent(NULL, NULL); - wglDeleteContext(hGLRC); - } - - // Destroy the window and release the handle. - if(hWnd) - DestroyWindow(hWnd); -} -#endif -#endif // 0 - boolean Sys_GLPreInit(void) { if(novideo) return true; if(doneEarlyInit) return true; // Already been here?? - memset(&GL_state.extensions, 0, sizeof(GL_state.extensions)); // Init assuming ideal configuration. - GL_state.forceFinishBeforeSwap = CommandLine_Exists("-glfinish"); - GL_state.maxTexFilterAniso = 4; - GL_state.maxTexSize = 4096; - GL_state.maxTexUnits = 1; GL_state.multisampleFormat = 0; // No valid default can be assumed at this time. GL_state.features.blendSubtract = true; @@ -435,16 +219,6 @@ boolean Sys_GLPreInit(void) GL_state.currentPointSize = 1.5f; GL_state.currentUseFog = false; -#if 0 // WIN32 - // We prefer to use multisampling if available so create a dummy window - // and see what pixel formats are present. - createDummyWindow(&app); - - // User disabled? - if(ArgCheck("-noaa")) - GL_state.features.multisample = false; -#endif - doneEarlyInit = true; return true; } @@ -501,7 +275,7 @@ boolean Sys_GLInitialize(void) */ // Use nice quality for mipmaps please. - if(GL_state.features.genMipmap && GL_state.extensions.genMipmapSGIS) + if(GL_state.features.genMipmap && de::GLInfo::extensions().SGIS_generate_mipmap) glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); assert(!Sys_GLCheckError()); @@ -600,44 +374,6 @@ void Sys_GLConfigureDefaultState(void) de::GLState::current().setBlendFunc(de::gl::SrcAlpha, de::gl::OneMinusSrcAlpha); } -/** - * This routine is based on the method used by David Blythe and Tom McReynolds - * in the book "Advanced Graphics Programming Using OpenGL" ISBN: 1-55860-659-9. - */ -boolean Sys_GLQueryExtension(const char* name, const GLubyte* extensions) -{ - const GLubyte* start; - GLubyte* c, *terminator; - - // Extension names should not have spaces. - c = (GLubyte *) strchr(name, ' '); - if(c || *name == '\0') - return false; - - if(!extensions) - return false; - - // It takes a bit of care to be fool-proof about parsing the - // OpenGL extensions string. Don't be fooled by sub-strings, etc. - start = extensions; - for(;;) - { - c = (GLubyte*) strstr((const char*) start, name); - if(!c) - break; - - terminator = c + strlen(name); - if(c == start || *(c - 1) == ' ') - if(*terminator == ' ' || *terminator == '\0') - { - return true; - } - start = terminator; - } - - return false; -} - static de::String omitGLPrefix(de::String str) { if(str.startsWith("GL_")) return str.substr(3); diff --git a/doomsday/client/src/world/blockmap.cpp b/doomsday/client/src/world/blockmap.cpp index 92fa1f2367..06e04d7121 100644 --- a/doomsday/client/src/world/blockmap.cpp +++ b/doomsday/client/src/world/blockmap.cpp @@ -132,14 +132,6 @@ struct CellData } }; -template -Type ceilPow2(Type unit) -{ - Type cumul; - for(cumul = 1; unit > cumul; cumul <<= 1) {} - return cumul; -} - DENG2_PIMPL(Blockmap) { /**