GLimp_HaveExtension() -> SDL_GL_ExtensionSupported()

This commit is contained in:
SmileTheory 2016-12-10 00:35:17 -08:00
parent 0672905ef1
commit 06b47ad2a9
2 changed files with 19 additions and 37 deletions

View file

@ -43,15 +43,6 @@ QGL_ARB_vertex_array_object_PROCS;
QGL_EXT_direct_state_access_PROCS; QGL_EXT_direct_state_access_PROCS;
#undef GLE #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() void GLimp_InitExtraExtensions()
{ {
char *extension; char *extension;
@ -112,7 +103,7 @@ void GLimp_InitExtraExtensions()
// GL_NVX_gpu_memory_info // GL_NVX_gpu_memory_info
extension = "GL_NVX_gpu_memory_info"; extension = "GL_NVX_gpu_memory_info";
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
glRefConfig.memInfo = MI_NVX; glRefConfig.memInfo = MI_NVX;
@ -125,7 +116,7 @@ void GLimp_InitExtraExtensions()
// GL_ATI_meminfo // GL_ATI_meminfo
extension = "GL_ATI_meminfo"; extension = "GL_ATI_meminfo";
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
if (glRefConfig.memInfo == MI_NONE) if (glRefConfig.memInfo == MI_NONE)
{ {
@ -146,7 +137,7 @@ void GLimp_InitExtraExtensions()
// GL_ARB_texture_float // GL_ARB_texture_float
extension = "GL_ARB_texture_float"; extension = "GL_ARB_texture_float";
glRefConfig.textureFloat = qfalse; glRefConfig.textureFloat = qfalse;
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
glRefConfig.textureFloat = !!r_ext_texture_float->integer; glRefConfig.textureFloat = !!r_ext_texture_float->integer;
@ -160,7 +151,7 @@ void GLimp_InitExtraExtensions()
// GL_EXT_framebuffer_object // GL_EXT_framebuffer_object
extension = "GL_EXT_framebuffer_object"; extension = "GL_EXT_framebuffer_object";
glRefConfig.framebufferObject = qfalse; glRefConfig.framebufferObject = qfalse;
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
glRefConfig.framebufferObject = !!r_ext_framebuffer_object->integer; glRefConfig.framebufferObject = !!r_ext_framebuffer_object->integer;
@ -179,7 +170,7 @@ void GLimp_InitExtraExtensions()
// GL_EXT_framebuffer_blit // GL_EXT_framebuffer_blit
extension = "GL_EXT_framebuffer_blit"; extension = "GL_EXT_framebuffer_blit";
glRefConfig.framebufferBlit = qfalse; glRefConfig.framebufferBlit = qfalse;
if (GLimp_HaveExtension(extension)) if (SDL_GL_ExtensionSupported(extension))
{ {
glRefConfig.framebufferBlit = qtrue; glRefConfig.framebufferBlit = qtrue;
@ -195,7 +186,7 @@ void GLimp_InitExtraExtensions()
// GL_EXT_framebuffer_multisample // GL_EXT_framebuffer_multisample
extension = "GL_EXT_framebuffer_multisample"; extension = "GL_EXT_framebuffer_multisample";
glRefConfig.framebufferMultisample = qfalse; glRefConfig.framebufferMultisample = qfalse;
if (GLimp_HaveExtension(extension)) if (SDL_GL_ExtensionSupported(extension))
{ {
glRefConfig.framebufferMultisample = qtrue; glRefConfig.framebufferMultisample = qtrue;
@ -212,7 +203,7 @@ void GLimp_InitExtraExtensions()
// GL_ARB_texture_compression_rgtc // GL_ARB_texture_compression_rgtc
extension = "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; qboolean useRgtc = r_ext_compressed_textures->integer >= 1;
@ -230,7 +221,7 @@ void GLimp_InitExtraExtensions()
// GL_ARB_texture_compression_bptc // GL_ARB_texture_compression_bptc
extension = "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; qboolean useBptc = r_ext_compressed_textures->integer >= 2;
@ -247,7 +238,7 @@ void GLimp_InitExtraExtensions()
// GL_ARB_depth_clamp // GL_ARB_depth_clamp
extension = "GL_ARB_depth_clamp"; extension = "GL_ARB_depth_clamp";
glRefConfig.depthClamp = qfalse; glRefConfig.depthClamp = qfalse;
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
glRefConfig.depthClamp = qtrue; glRefConfig.depthClamp = qtrue;
@ -261,7 +252,7 @@ void GLimp_InitExtraExtensions()
// GL_ARB_seamless_cube_map // GL_ARB_seamless_cube_map
extension = "GL_ARB_seamless_cube_map"; extension = "GL_ARB_seamless_cube_map";
glRefConfig.seamlessCubeMap = qfalse; glRefConfig.seamlessCubeMap = qfalse;
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
glRefConfig.seamlessCubeMap = !!r_arb_seamless_cube_map->integer; glRefConfig.seamlessCubeMap = !!r_arb_seamless_cube_map->integer;
@ -275,7 +266,7 @@ void GLimp_InitExtraExtensions()
// GL_ARB_vertex_array_object // GL_ARB_vertex_array_object
extension = "GL_ARB_vertex_array_object"; extension = "GL_ARB_vertex_array_object";
glRefConfig.vertexArrayObject = qfalse; glRefConfig.vertexArrayObject = qfalse;
if( GLimp_HaveExtension( extension ) ) if( SDL_GL_ExtensionSupported( extension ) )
{ {
glRefConfig.vertexArrayObject = !!r_arb_vertex_array_object->integer; glRefConfig.vertexArrayObject = !!r_arb_vertex_array_object->integer;
@ -291,7 +282,7 @@ void GLimp_InitExtraExtensions()
// GL_EXT_direct_state_access // GL_EXT_direct_state_access
extension = "GL_EXT_direct_state_access"; extension = "GL_EXT_direct_state_access";
glRefConfig.directStateAccess = qfalse; glRefConfig.directStateAccess = qfalse;
if (GLimp_HaveExtension(extension)) if (SDL_GL_ExtensionSupported(extension))
{ {
glRefConfig.directStateAccess = !!r_ext_direct_state_access->integer; glRefConfig.directStateAccess = !!r_ext_direct_state_access->integer;

View file

@ -566,15 +566,6 @@ static qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qbool
return qtrue; 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; glConfig.textureCompression = TC_NONE;
// GL_EXT_texture_compression_s3tc // GL_EXT_texture_compression_s3tc
if ( GLimp_HaveExtension( "GL_ARB_texture_compression" ) && if ( SDL_GL_ExtensionSupported( "GL_ARB_texture_compression" ) &&
GLimp_HaveExtension( "GL_EXT_texture_compression_s3tc" ) ) SDL_GL_ExtensionSupported( "GL_EXT_texture_compression_s3tc" ) )
{ {
if ( r_ext_compressed_textures->value ) 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. // GL_S3_s3tc ... legacy extension before GL_EXT_texture_compression_s3tc.
if (glConfig.textureCompression == TC_NONE) if (glConfig.textureCompression == TC_NONE)
{ {
if ( GLimp_HaveExtension( "GL_S3_s3tc" ) ) if ( SDL_GL_ExtensionSupported( "GL_S3_s3tc" ) )
{ {
if ( r_ext_compressed_textures->value ) if ( r_ext_compressed_textures->value )
{ {
@ -636,7 +627,7 @@ static void GLimp_InitExtensions( void )
// GL_EXT_texture_env_add // GL_EXT_texture_env_add
glConfig.textureEnvAddAvailable = qfalse; 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 ) if ( r_ext_texture_env_add->integer )
{ {
@ -658,7 +649,7 @@ static void GLimp_InitExtensions( void )
qglMultiTexCoord2fARB = NULL; qglMultiTexCoord2fARB = NULL;
qglActiveTextureARB = NULL; qglActiveTextureARB = NULL;
qglClientActiveTextureARB = NULL; qglClientActiveTextureARB = NULL;
if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) ) if ( SDL_GL_ExtensionSupported( "GL_ARB_multitexture" ) )
{ {
if ( r_ext_multitexture->value ) if ( r_ext_multitexture->value )
{ {
@ -695,7 +686,7 @@ static void GLimp_InitExtensions( void )
} }
// GL_EXT_compiled_vertex_array // 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 ) if ( r_ext_compiled_vertex_array->value )
{ {
@ -718,7 +709,7 @@ static void GLimp_InitExtensions( void )
} }
textureFilterAnisotropic = qfalse; 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 ) { if ( r_ext_texture_filter_anisotropic->integer ) {
qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy ); qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy );