From 06b47ad2a96742e089a16d0bd1e3b25a0bd354af Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Sat, 10 Dec 2016 00:35:17 -0800 Subject: [PATCH] GLimp_HaveExtension() -> SDL_GL_ExtensionSupported() --- code/renderergl2/tr_extensions.c | 33 ++++++++++++-------------------- code/sdl/sdl_glimp.c | 23 +++++++--------------- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/code/renderergl2/tr_extensions.c b/code/renderergl2/tr_extensions.c index 10ae3b85..f0b24b78 100644 --- a/code/renderergl2/tr_extensions.c +++ b/code/renderergl2/tr_extensions.c @@ -43,15 +43,6 @@ QGL_ARB_vertex_array_object_PROCS; QGL_EXT_direct_state_access_PROCS; #undef GLE -static qboolean GLimp_HaveExtension(const char *ext) -{ - const char *ptr = Q_stristr( glConfig.extensions_string, ext ); - if (ptr == NULL) - return qfalse; - ptr += strlen(ext); - return ((*ptr == ' ') || (*ptr == '\0')); // verify it's complete string. -} - void GLimp_InitExtraExtensions() { char *extension; @@ -112,7 +103,7 @@ void GLimp_InitExtraExtensions() // GL_NVX_gpu_memory_info extension = "GL_NVX_gpu_memory_info"; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { glRefConfig.memInfo = MI_NVX; @@ -125,7 +116,7 @@ void GLimp_InitExtraExtensions() // GL_ATI_meminfo extension = "GL_ATI_meminfo"; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { if (glRefConfig.memInfo == MI_NONE) { @@ -146,7 +137,7 @@ void GLimp_InitExtraExtensions() // GL_ARB_texture_float extension = "GL_ARB_texture_float"; glRefConfig.textureFloat = qfalse; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { glRefConfig.textureFloat = !!r_ext_texture_float->integer; @@ -160,7 +151,7 @@ void GLimp_InitExtraExtensions() // GL_EXT_framebuffer_object extension = "GL_EXT_framebuffer_object"; glRefConfig.framebufferObject = qfalse; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { glRefConfig.framebufferObject = !!r_ext_framebuffer_object->integer; @@ -179,7 +170,7 @@ void GLimp_InitExtraExtensions() // GL_EXT_framebuffer_blit extension = "GL_EXT_framebuffer_blit"; glRefConfig.framebufferBlit = qfalse; - if (GLimp_HaveExtension(extension)) + if (SDL_GL_ExtensionSupported(extension)) { glRefConfig.framebufferBlit = qtrue; @@ -195,7 +186,7 @@ void GLimp_InitExtraExtensions() // GL_EXT_framebuffer_multisample extension = "GL_EXT_framebuffer_multisample"; glRefConfig.framebufferMultisample = qfalse; - if (GLimp_HaveExtension(extension)) + if (SDL_GL_ExtensionSupported(extension)) { glRefConfig.framebufferMultisample = qtrue; @@ -212,7 +203,7 @@ void GLimp_InitExtraExtensions() // GL_ARB_texture_compression_rgtc extension = "GL_ARB_texture_compression_rgtc"; - if (GLimp_HaveExtension(extension)) + if (SDL_GL_ExtensionSupported(extension)) { qboolean useRgtc = r_ext_compressed_textures->integer >= 1; @@ -230,7 +221,7 @@ void GLimp_InitExtraExtensions() // GL_ARB_texture_compression_bptc extension = "GL_ARB_texture_compression_bptc"; - if (GLimp_HaveExtension(extension)) + if (SDL_GL_ExtensionSupported(extension)) { qboolean useBptc = r_ext_compressed_textures->integer >= 2; @@ -247,7 +238,7 @@ void GLimp_InitExtraExtensions() // GL_ARB_depth_clamp extension = "GL_ARB_depth_clamp"; glRefConfig.depthClamp = qfalse; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { glRefConfig.depthClamp = qtrue; @@ -261,7 +252,7 @@ void GLimp_InitExtraExtensions() // GL_ARB_seamless_cube_map extension = "GL_ARB_seamless_cube_map"; glRefConfig.seamlessCubeMap = qfalse; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { glRefConfig.seamlessCubeMap = !!r_arb_seamless_cube_map->integer; @@ -275,7 +266,7 @@ void GLimp_InitExtraExtensions() // GL_ARB_vertex_array_object extension = "GL_ARB_vertex_array_object"; glRefConfig.vertexArrayObject = qfalse; - if( GLimp_HaveExtension( extension ) ) + if( SDL_GL_ExtensionSupported( extension ) ) { glRefConfig.vertexArrayObject = !!r_arb_vertex_array_object->integer; @@ -291,7 +282,7 @@ void GLimp_InitExtraExtensions() // GL_EXT_direct_state_access extension = "GL_EXT_direct_state_access"; glRefConfig.directStateAccess = qfalse; - if (GLimp_HaveExtension(extension)) + if (SDL_GL_ExtensionSupported(extension)) { glRefConfig.directStateAccess = !!r_ext_direct_state_access->integer; diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index e7052a0f..7160d6f0 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -566,15 +566,6 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool return qtrue; } -static qboolean GLimp_HaveExtension(const char *ext) -{ - const char *ptr = Q_stristr( glConfig.extensions_string, ext ); - if (ptr == NULL) - return qfalse; - ptr += strlen(ext); - return ((*ptr == ' ') || (*ptr == '\0')); // verify it's complete string. -} - /* =============== @@ -594,8 +585,8 @@ static void GLimp_InitExtensions( void ) glConfig.textureCompression = TC_NONE; // GL_EXT_texture_compression_s3tc - if ( GLimp_HaveExtension( "GL_ARB_texture_compression" ) && - GLimp_HaveExtension( "GL_EXT_texture_compression_s3tc" ) ) + if ( SDL_GL_ExtensionSupported( "GL_ARB_texture_compression" ) && + SDL_GL_ExtensionSupported( "GL_EXT_texture_compression_s3tc" ) ) { if ( r_ext_compressed_textures->value ) { @@ -615,7 +606,7 @@ static void GLimp_InitExtensions( void ) // GL_S3_s3tc ... legacy extension before GL_EXT_texture_compression_s3tc. if (glConfig.textureCompression == TC_NONE) { - if ( GLimp_HaveExtension( "GL_S3_s3tc" ) ) + if ( SDL_GL_ExtensionSupported( "GL_S3_s3tc" ) ) { if ( r_ext_compressed_textures->value ) { @@ -636,7 +627,7 @@ static void GLimp_InitExtensions( void ) // GL_EXT_texture_env_add glConfig.textureEnvAddAvailable = qfalse; - if ( GLimp_HaveExtension( "EXT_texture_env_add" ) ) + if ( SDL_GL_ExtensionSupported( "EXT_texture_env_add" ) ) { if ( r_ext_texture_env_add->integer ) { @@ -658,7 +649,7 @@ static void GLimp_InitExtensions( void ) qglMultiTexCoord2fARB = NULL; qglActiveTextureARB = NULL; qglClientActiveTextureARB = NULL; - if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) ) + if ( SDL_GL_ExtensionSupported( "GL_ARB_multitexture" ) ) { if ( r_ext_multitexture->value ) { @@ -695,7 +686,7 @@ static void GLimp_InitExtensions( void ) } // GL_EXT_compiled_vertex_array - if ( GLimp_HaveExtension( "GL_EXT_compiled_vertex_array" ) ) + if ( SDL_GL_ExtensionSupported( "GL_EXT_compiled_vertex_array" ) ) { if ( r_ext_compiled_vertex_array->value ) { @@ -718,7 +709,7 @@ static void GLimp_InitExtensions( void ) } textureFilterAnisotropic = qfalse; - if ( GLimp_HaveExtension( "GL_EXT_texture_filter_anisotropic" ) ) + if ( SDL_GL_ExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) ) { if ( r_ext_texture_filter_anisotropic->integer ) { qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy );