[iortcw] 10/95: All: GLimp_HaveExtension() -> SDL_GL_ExtensionSupported()

Simon McVittie smcv at debian.org
Fri Sep 8 10:41:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit 411bcb73f3d0d631bb65f6b1cb54f3ee4d42d8e9
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sat Dec 10 04:40:03 2016 -0500

    All: GLimp_HaveExtension() -> SDL_GL_ExtensionSupported()
---
 MP/code/rend2/tr_extensions.c | 33 ++++++++++++---------------------
 MP/code/sdl/sdl_glimp.c       | 23 +++++++----------------
 SP/code/rend2/tr_extensions.c | 33 ++++++++++++---------------------
 SP/code/sdl/sdl_glimp.c       | 23 +++++++----------------
 4 files changed, 38 insertions(+), 74 deletions(-)

diff --git a/MP/code/rend2/tr_extensions.c b/MP/code/rend2/tr_extensions.c
index 59eee43..f0b24b7 100644
--- a/MP/code/rend2/tr_extensions.c
+++ b/MP/code/rend2/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( (char *)qglGetString(GL_EXTENSIONS), 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/MP/code/sdl/sdl_glimp.c b/MP/code/sdl/sdl_glimp.c
index 3b54036..5c09988 100644
--- a/MP/code/sdl/sdl_glimp.c
+++ b/MP/code/sdl/sdl_glimp.c
@@ -617,15 +617,6 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool
 	return qtrue;
 }
 
-static qboolean GLimp_HaveExtension(const char *ext)
-{
-	const char *ptr = Q_stristr( (char *)qglGetString(GL_EXTENSIONS), ext );
-	if (ptr == NULL)
-		return qfalse;
-	ptr += strlen(ext);
-	return ((*ptr == ' ') || (*ptr == '\0'));  // verify it's complete string.
-}
-
 
 /*
 ===============
@@ -645,8 +636,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 )
 		{
@@ -666,7 +657,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 )
 			{
@@ -691,7 +682,7 @@ static void GLimp_InitExtensions( void )
 	ri.Printf( PRINT_ALL, "...using GL_EXT_texture_env_add\n" );
 #else
 	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 )
 		{
@@ -733,7 +724,7 @@ static void GLimp_InitExtensions( void )
 		ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" );
 	}
 #else
-	if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) )
+	if ( SDL_GL_ExtensionSupported( "GL_ARB_multitexture" ) )
 	{
 		if ( r_ext_multitexture->value )
 		{
@@ -771,7 +762,7 @@ static void GLimp_InitExtensions( void )
 #endif
 
 	// 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 )
 		{
@@ -794,7 +785,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 );
diff --git a/SP/code/rend2/tr_extensions.c b/SP/code/rend2/tr_extensions.c
index 59eee43..f0b24b7 100644
--- a/SP/code/rend2/tr_extensions.c
+++ b/SP/code/rend2/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( (char *)qglGetString(GL_EXTENSIONS), 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/SP/code/sdl/sdl_glimp.c b/SP/code/sdl/sdl_glimp.c
index 3b54036..5c09988 100644
--- a/SP/code/sdl/sdl_glimp.c
+++ b/SP/code/sdl/sdl_glimp.c
@@ -617,15 +617,6 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool
 	return qtrue;
 }
 
-static qboolean GLimp_HaveExtension(const char *ext)
-{
-	const char *ptr = Q_stristr( (char *)qglGetString(GL_EXTENSIONS), ext );
-	if (ptr == NULL)
-		return qfalse;
-	ptr += strlen(ext);
-	return ((*ptr == ' ') || (*ptr == '\0'));  // verify it's complete string.
-}
-
 
 /*
 ===============
@@ -645,8 +636,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 )
 		{
@@ -666,7 +657,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 )
 			{
@@ -691,7 +682,7 @@ static void GLimp_InitExtensions( void )
 	ri.Printf( PRINT_ALL, "...using GL_EXT_texture_env_add\n" );
 #else
 	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 )
 		{
@@ -733,7 +724,7 @@ static void GLimp_InitExtensions( void )
 		ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" );
 	}
 #else
-	if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) )
+	if ( SDL_GL_ExtensionSupported( "GL_ARB_multitexture" ) )
 	{
 		if ( r_ext_multitexture->value )
 		{
@@ -771,7 +762,7 @@ static void GLimp_InitExtensions( void )
 #endif
 
 	// 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 )
 		{
@@ -794,7 +785,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 );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list