mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
Added GL_EXT_texture_compression_s3tc support.
GL_S3_s3tc, which Quake 3 previously supported, is legacy. This new codepath is the common, vendor-neutral extension to get the same results.
This commit is contained in:
parent
a98fed9ee2
commit
c923872ca2
3 changed files with 54 additions and 14 deletions
|
@ -182,6 +182,7 @@ void R_ImageList_f( void ) {
|
|||
ri.Printf( PRINT_ALL, "RGB8" );
|
||||
break;
|
||||
case GL_RGB4_S3TC:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
ri.Printf( PRINT_ALL, "S3TC " );
|
||||
break;
|
||||
case GL_RGBA4:
|
||||
|
@ -602,7 +603,11 @@ static void Upload32( unsigned *data,
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( glConfig.textureCompression == TC_S3TC )
|
||||
if ( glConfig.textureCompression == TC_S3TC_ARB )
|
||||
{
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
}
|
||||
else if ( glConfig.textureCompression == TC_S3TC )
|
||||
{
|
||||
internalFormat = GL_RGB4_S3TC;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,8 @@ typedef enum {
|
|||
*/
|
||||
typedef enum {
|
||||
TC_NONE,
|
||||
TC_S3TC
|
||||
TC_S3TC, // this is for the GL_S3_s3tc extension.
|
||||
TC_S3TC_ARB // this is for the GL_EXT_texture_compression_s3tc extension.
|
||||
} textureCompression_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -445,6 +445,17 @@ static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen )
|
|||
|
||||
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.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
GLimp_InitExtensions
|
||||
|
@ -460,8 +471,31 @@ static void GLimp_InitExtensions( void )
|
|||
|
||||
ri.Printf( PRINT_ALL, "Initializing OpenGL extensions\n" );
|
||||
|
||||
// GL_S3_s3tc
|
||||
if ( Q_stristr( glConfig.extensions_string, "GL_S3_s3tc" ) )
|
||||
glConfig.textureCompression = TC_NONE;
|
||||
|
||||
// GL_EXT_texture_compression_s3tc
|
||||
if ( GLimp_HaveExtension( "GL_ARB_texture_compression" ) &&
|
||||
GLimp_HaveExtension( "GL_EXT_texture_compression_s3tc" ) )
|
||||
{
|
||||
if ( r_ext_compressed_textures->value )
|
||||
{
|
||||
glConfig.textureCompression = TC_S3TC_ARB;
|
||||
ri.Printf( PRINT_ALL, "...using GL_EXT_texture_compression_s3tc\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_compression_s3tc\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.Printf( PRINT_ALL, "...GL_EXT_texture_compression_s3tc not found\n" );
|
||||
}
|
||||
|
||||
// GL_S3_s3tc ... legacy extension before GL_EXT_texture_compression_s3tc.
|
||||
if (glConfig.textureCompression == TC_NONE)
|
||||
{
|
||||
if ( GLimp_HaveExtension( "GL_S3_s3tc" ) )
|
||||
{
|
||||
if ( r_ext_compressed_textures->value )
|
||||
{
|
||||
|
@ -470,19 +504,19 @@ static void GLimp_InitExtensions( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
glConfig.textureCompression = TC_NONE;
|
||||
ri.Printf( PRINT_ALL, "...ignoring GL_S3_s3tc\n" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glConfig.textureCompression = TC_NONE;
|
||||
ri.Printf( PRINT_ALL, "...GL_S3_s3tc not found\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GL_EXT_texture_env_add
|
||||
glConfig.textureEnvAddAvailable = qfalse;
|
||||
if ( Q_stristr( glConfig.extensions_string, "EXT_texture_env_add" ) )
|
||||
if ( GLimp_HaveExtension( "EXT_texture_env_add" ) )
|
||||
{
|
||||
if ( r_ext_texture_env_add->integer )
|
||||
{
|
||||
|
@ -504,7 +538,7 @@ static void GLimp_InitExtensions( void )
|
|||
qglMultiTexCoord2fARB = NULL;
|
||||
qglActiveTextureARB = NULL;
|
||||
qglClientActiveTextureARB = NULL;
|
||||
if ( Q_stristr( glConfig.extensions_string, "GL_ARB_multitexture" ) )
|
||||
if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) )
|
||||
{
|
||||
if ( r_ext_multitexture->value )
|
||||
{
|
||||
|
@ -541,7 +575,7 @@ static void GLimp_InitExtensions( void )
|
|||
}
|
||||
|
||||
// GL_EXT_compiled_vertex_array
|
||||
if ( Q_stristr( glConfig.extensions_string, "GL_EXT_compiled_vertex_array" ) )
|
||||
if ( GLimp_HaveExtension( "GL_EXT_compiled_vertex_array" ) )
|
||||
{
|
||||
if ( r_ext_compiled_vertex_array->value )
|
||||
{
|
||||
|
@ -564,7 +598,7 @@ static void GLimp_InitExtensions( void )
|
|||
}
|
||||
|
||||
textureFilterAnisotropic = qfalse;
|
||||
if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
|
||||
if ( GLimp_HaveExtension( "GL_EXT_texture_filter_anisotropic" ) )
|
||||
{
|
||||
if ( r_ext_texture_filter_anisotropic->integer ) {
|
||||
qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy );
|
||||
|
|
Loading…
Reference in a new issue