ref: gl: make GL_Support and GL_MaxTextureUnits functions inlined

This commit is contained in:
Alibek Omarov 2025-01-30 19:02:53 +03:00
parent f9d4ac2771
commit 77abf621d7
2 changed files with 16 additions and 28 deletions

View file

@ -555,8 +555,6 @@ void CL_AddCustomBeam( cl_entity_t *pEnvBeam );
#define GL_CheckForErrors() GL_CheckForErrors_( __FILE__, __LINE__ ) #define GL_CheckForErrors() GL_CheckForErrors_( __FILE__, __LINE__ )
void GL_CheckForErrors_( const char *filename, const int fileline ); void GL_CheckForErrors_( const char *filename, const int fileline );
const char *GL_ErrorString( int err ); const char *GL_ErrorString( int err );
qboolean GL_Support( int r_ext );
int GL_MaxTextureUnits( void );
// //
// gl_triapi.c // gl_triapi.c
@ -756,6 +754,22 @@ static inline uint LinearGammaTable( uint b )
return !FBitSet( gp_host->features, ENGINE_LINEAR_GAMMA_SPACE ) ? tr.lineargammatable[b] : b; return !FBitSet( gp_host->features, ENGINE_LINEAR_GAMMA_SPACE ) ? tr.lineargammatable[b] : b;
} }
static inline qboolean GL_Support( int r_ext )
{
if( r_ext >= 0 && r_ext < GL_EXTCOUNT )
return glConfig.extension[r_ext] ? true : false;
gEngfuncs.Con_Printf( S_ERROR "%s: invalid extension %d\n", __func__, r_ext );
return false;
}
static inline int GL_MaxTextureUnits( void )
{
if( GL_Support( GL_SHADER_GLSL100_EXT ))
return Q_min( Q_max( glConfig.max_texture_coords, glConfig.max_teximage_units ), MAX_TEXTURE_UNITS );
return glConfig.max_texture_units;
}
#define WORLDMODEL (gp_cl->models[1]) #define WORLDMODEL (gp_cl->models[1])
// //

View file

@ -464,32 +464,6 @@ static void GL_SetExtension( int r_ext, int enable )
else gEngfuncs.Con_Printf( S_ERROR "%s: invalid extension %d\n", __func__, r_ext ); else gEngfuncs.Con_Printf( S_ERROR "%s: invalid extension %d\n", __func__, r_ext );
} }
/*
=================
GL_Support
=================
*/
qboolean GL_Support( int r_ext )
{
if( r_ext >= 0 && r_ext < GL_EXTCOUNT )
return glConfig.extension[r_ext] ? true : false;
gEngfuncs.Con_Printf( S_ERROR "%s: invalid extension %d\n", __func__, r_ext );
return false;
}
/*
=================
GL_MaxTextureUnits
=================
*/
int GL_MaxTextureUnits( void )
{
if( GL_Support( GL_SHADER_GLSL100_EXT ))
return Q_min( Q_max( glConfig.max_texture_coords, glConfig.max_teximage_units ), MAX_TEXTURE_UNITS );
return glConfig.max_texture_units;
}
/* /*
================= =================
GL_CheckExtension GL_CheckExtension