[openjk] 12/32: Shared: Use SDL_GL_ExtensionSupported Function
Simon McVittie
smcv at debian.org
Sun Mar 12 18:03:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit a8b7a75b19ec51b1b845585afef06366d85d2d2c
Author: Ensiform <ensiform at gmail.com>
Date: Thu Mar 9 10:53:28 2017 -0600
Shared: Use SDL_GL_ExtensionSupported Function
This change makes uses the provided SDL function for checking if a GL extension is supported. Added to the renderer API. Bumps SP and MP ref api versions up 1.
---
code/rd-common/tr_public.h | 3 ++-
code/rd-vanilla/tr_init.cpp | 30 ++++++++++--------------------
codemp/rd-common/tr_public.h | 3 ++-
codemp/rd-vanilla/tr_init.cpp | 29 ++++++++++-------------------
shared/sdl/sdl_window.cpp | 5 +++++
shared/sys/sys_public.h | 1 +
6 files changed, 30 insertions(+), 41 deletions(-)
diff --git a/code/rd-common/tr_public.h b/code/rd-common/tr_public.h
index 1ea046d..40a3186 100644
--- a/code/rd-common/tr_public.h
+++ b/code/rd-common/tr_public.h
@@ -30,7 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../ghoul2/G2.h"
#include "../ghoul2/ghoul2_gore.h"
-#define REF_API_VERSION 17
+#define REF_API_VERSION 18
typedef struct {
void (QDECL *Printf) ( int printLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
@@ -100,6 +100,7 @@ typedef struct {
// OpenGL-specific
void * (*GL_GetProcAddress) ( const char *name );
+ qboolean (*GL_ExtensionSupported) ( const char *extension );
CMiniHeap * (*GetG2VertSpaceServer) ( void );
diff --git a/code/rd-vanilla/tr_init.cpp b/code/rd-vanilla/tr_init.cpp
index 896e74a..a9a23de 100644
--- a/code/rd-vanilla/tr_init.cpp
+++ b/code/rd-vanilla/tr_init.cpp
@@ -277,23 +277,13 @@ void R_Splash()
Cannot use strstr directly to differentiate between (for eg) reg_combiners and reg_combiners2
*/
-bool GL_CheckForExtension(const char *ext)
-{
- const char *ptr = Q_stristr( glConfig.extensions_string, ext );
- if (ptr == NULL)
- return false;
- ptr += strlen(ext);
- return ((*ptr == ' ') || (*ptr == '\0')); // verify it's complete string.
-}
-
static void GLW_InitTextureCompression( void )
{
bool newer_tc, old_tc;
-
// Check for available tc methods.
- newer_tc = GL_CheckForExtension("ARB_texture_compression") && GL_CheckForExtension("EXT_texture_compression_s3tc");
- old_tc = GL_CheckForExtension("GL_S3_s3tc");
+ newer_tc = ri.GL_ExtensionSupported("GL_ARB_texture_compression") && ri.GL_ExtensionSupported("GL_EXT_texture_compression_s3tc");
+ old_tc = ri.GL_ExtensionSupported("GL_S3_s3tc");
if ( old_tc )
{
@@ -417,7 +407,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_texture_env_add
glConfig.textureEnvAddAvailable = qfalse;
- if ( GL_CheckForExtension( "EXT_texture_env_add" ) )
+ if ( ri.GL_ExtensionSupported( "GL_EXT_texture_env_add" ) )
{
if ( r_ext_texture_env_add->integer )
{
@@ -437,7 +427,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_texture_filter_anisotropic
glConfig.maxTextureFilterAnisotropy = 0;
- if ( GL_CheckForExtension( "EXT_texture_filter_anisotropic" ) )
+ if ( ri.GL_ExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) )
{
qglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxTextureFilterAnisotropy );
Com_Printf ("...GL_EXT_texture_filter_anisotropic available\n" );
@@ -470,7 +460,7 @@ static void GLimp_InitExtensions( void )
qglMultiTexCoord2fARB = NULL;
qglActiveTextureARB = NULL;
qglClientActiveTextureARB = NULL;
- if ( GL_CheckForExtension( "GL_ARB_multitexture" ) )
+ if ( ri.GL_ExtensionSupported( "GL_ARB_multitexture" ) )
{
if ( r_ext_multitexture->integer )
{
@@ -508,7 +498,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_compiled_vertex_array
qglLockArraysEXT = NULL;
qglUnlockArraysEXT = NULL;
- if ( GL_CheckForExtension( "GL_EXT_compiled_vertex_array" ) )
+ if ( ri.GL_ExtensionSupported( "GL_EXT_compiled_vertex_array" ) )
{
if ( r_ext_compiled_vertex_array->integer )
{
@@ -531,7 +521,7 @@ static void GLimp_InitExtensions( void )
bool bNVRegisterCombiners = false;
// Register Combiners.
- if ( GL_CheckForExtension( "GL_NV_register_combiners" ) )
+ if ( ri.GL_ExtensionSupported( "GL_NV_register_combiners" ) )
{
// NOTE: This extension requires multitexture support (over 2 units).
if ( glConfig.maxActiveTextures >= 2 )
@@ -584,7 +574,7 @@ static void GLimp_InitExtensions( void )
// Vertex Programs.
bool bARBVertexProgram = false;
- if ( GL_CheckForExtension( "GL_ARB_vertex_program" ) )
+ if ( ri.GL_ExtensionSupported( "GL_ARB_vertex_program" ) )
{
bARBVertexProgram = true;
}
@@ -596,7 +586,7 @@ static void GLimp_InitExtensions( void )
// Fragment Programs.
bool bARBFragmentProgram = false;
- if ( GL_CheckForExtension( "GL_ARB_fragment_program" ) )
+ if ( ri.GL_ExtensionSupported( "GL_ARB_fragment_program" ) )
{
bARBFragmentProgram = true;
}
@@ -655,7 +645,7 @@ static void GLimp_InitExtensions( void )
g_bTextureRectangleHack = true;
}
- if ( GL_CheckForExtension( "GL_NV_texture_rectangle" ) || GL_CheckForExtension( "GL_EXT_texture_rectangle" ) )
+ if ( ri.GL_ExtensionSupported( "GL_NV_texture_rectangle" ) || ri.GL_ExtensionSupported( "GL_EXT_texture_rectangle" ) )
{
bTexRectSupported = true;
}
diff --git a/codemp/rd-common/tr_public.h b/codemp/rd-common/tr_public.h
index b2bfe34..1042942 100644
--- a/codemp/rd-common/tr_public.h
+++ b/codemp/rd-common/tr_public.h
@@ -30,7 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../qcommon/qcommon.h"
#include "../ghoul2/ghoul2_shared.h"
-#define REF_API_VERSION 8
+#define REF_API_VERSION 9
//
// these are the functions exported by the refresh module
@@ -331,6 +331,7 @@ typedef struct refimport_s {
// OpenGL-specific
void * (*GL_GetProcAddress) ( const char *name );
+ qboolean (*GL_ExtensionSupported) ( const char *extension );
// gpvCachedMapDiskImage
void * (*CM_GetCachedMapDiskImage) ( void );
diff --git a/codemp/rd-vanilla/tr_init.cpp b/codemp/rd-vanilla/tr_init.cpp
index d2f8c43..51e3b91 100644
--- a/codemp/rd-vanilla/tr_init.cpp
+++ b/codemp/rd-vanilla/tr_init.cpp
@@ -316,23 +316,14 @@ void R_Splash()
Cannot use strstr directly to differentiate between (for eg) reg_combiners and reg_combiners2
*/
-bool GL_CheckForExtension(const char *ext)
-{
- const char *ptr = Q_stristr( glConfigExt.originalExtensionString, ext );
- if (ptr == NULL)
- return false;
- ptr += strlen(ext);
- return ((*ptr == ' ') || (*ptr == '\0')); // verify it's complete string.
-}
-
static void GLW_InitTextureCompression( void )
{
bool newer_tc, old_tc;
// Check for available tc methods.
- newer_tc = GL_CheckForExtension("ARB_texture_compression") && GL_CheckForExtension("EXT_texture_compression_s3tc");
- old_tc = GL_CheckForExtension("GL_S3_s3tc");
+ newer_tc = ri->GL_ExtensionSupported("GL_ARB_texture_compression") && ri->GL_ExtensionSupported("GL_EXT_texture_compression_s3tc");
+ old_tc = ri->GL_ExtensionSupported("GL_S3_s3tc");
if ( old_tc )
{
@@ -457,7 +448,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_texture_env_add
glConfig.textureEnvAddAvailable = qfalse;
- if ( GL_CheckForExtension( "EXT_texture_env_add" ) )
+ if ( ri->GL_ExtensionSupported( "GL_EXT_texture_env_add" ) )
{
if ( r_ext_texture_env_add->integer )
{
@@ -477,7 +468,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_texture_filter_anisotropic
glConfig.maxTextureFilterAnisotropy = 0;
- if ( GL_CheckForExtension( "EXT_texture_filter_anisotropic" ) )
+ if ( ri->GL_ExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) )
{
qglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.maxTextureFilterAnisotropy );
Com_Printf ("...GL_EXT_texture_filter_anisotropic available\n" );
@@ -510,7 +501,7 @@ static void GLimp_InitExtensions( void )
qglMultiTexCoord2fARB = NULL;
qglActiveTextureARB = NULL;
qglClientActiveTextureARB = NULL;
- if ( GL_CheckForExtension( "GL_ARB_multitexture" ) )
+ if ( ri->GL_ExtensionSupported( "GL_ARB_multitexture" ) )
{
if ( r_ext_multitexture->integer )
{
@@ -548,7 +539,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_compiled_vertex_array
qglLockArraysEXT = NULL;
qglUnlockArraysEXT = NULL;
- if ( GL_CheckForExtension( "GL_EXT_compiled_vertex_array" ) )
+ if ( ri->GL_ExtensionSupported( "GL_EXT_compiled_vertex_array" ) )
{
if ( r_ext_compiled_vertex_array->integer )
{
@@ -571,7 +562,7 @@ static void GLimp_InitExtensions( void )
bool bNVRegisterCombiners = false;
// Register Combiners.
- if ( GL_CheckForExtension( "GL_NV_register_combiners" ) )
+ if ( ri->GL_ExtensionSupported( "GL_NV_register_combiners" ) )
{
// NOTE: This extension requires multitexture support (over 2 units).
if ( glConfig.maxActiveTextures >= 2 )
@@ -624,7 +615,7 @@ static void GLimp_InitExtensions( void )
// Vertex Programs.
bool bARBVertexProgram = false;
- if ( GL_CheckForExtension( "GL_ARB_vertex_program" ) )
+ if ( ri->GL_ExtensionSupported( "GL_ARB_vertex_program" ) )
{
bARBVertexProgram = true;
}
@@ -636,7 +627,7 @@ static void GLimp_InitExtensions( void )
// Fragment Programs.
bool bARBFragmentProgram = false;
- if ( GL_CheckForExtension( "GL_ARB_fragment_program" ) )
+ if ( ri->GL_ExtensionSupported( "GL_ARB_fragment_program" ) )
{
bARBFragmentProgram = true;
}
@@ -695,7 +686,7 @@ static void GLimp_InitExtensions( void )
g_bTextureRectangleHack = true;
}
- if ( GL_CheckForExtension( "GL_NV_texture_rectangle" ) || GL_CheckForExtension( "GL_EXT_texture_rectangle" ) )
+ if ( ri->GL_ExtensionSupported( "GL_NV_texture_rectangle" ) || ri->GL_ExtensionSupported( "GL_EXT_texture_rectangle" ) )
{
bTexRectSupported = true;
}
diff --git a/shared/sdl/sdl_window.cpp b/shared/sdl/sdl_window.cpp
index f784c33..b0fc123 100644
--- a/shared/sdl/sdl_window.cpp
+++ b/shared/sdl/sdl_window.cpp
@@ -880,3 +880,8 @@ void *WIN_GL_GetProcAddress( const char *proc )
{
return SDL_GL_GetProcAddress( proc );
}
+
+qboolean WIN_GL_ExtensionSupported( const char *extension )
+{
+ return SDL_GL_ExtensionSupported( extension ) == SDL_TRUE ? qtrue : qfalse;
+}
diff --git a/shared/sys/sys_public.h b/shared/sys/sys_public.h
index d2a7325..f9ba3e6 100644
--- a/shared/sys/sys_public.h
+++ b/shared/sys/sys_public.h
@@ -200,5 +200,6 @@ void WIN_Present( window_t *window );
void WIN_SetGamma( glconfig_t *glConfig, byte red[256], byte green[256], byte blue[256] );
void WIN_Shutdown( void );
void * WIN_GL_GetProcAddress( const char *proc );
+qboolean WIN_GL_ExtensionSupported( const char *extension );
uint8_t ConvertUTF32ToExpectedCharset( uint32_t utf32 );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list