|
|
@ -5,40 +5,31 @@ |
|
|
|
#include "gl4es/include/gl4eshint.h" |
|
|
|
#include "gl4es/include/gl4eshint.h" |
|
|
|
#endif // XASH_GL4ES
|
|
|
|
#endif // XASH_GL4ES
|
|
|
|
|
|
|
|
|
|
|
|
cvar_t *gl_extensions; |
|
|
|
CVAR_DEFINE( gl_extensions, "gl_allow_extensions", "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "allow gl_extensions" ); |
|
|
|
cvar_t *gl_texture_anisotropy; |
|
|
|
CVAR_DEFINE( gl_texture_anisotropy, "gl_anisotropy", "8", FCVAR_GLCONFIG, "textures anisotropic filter" ); |
|
|
|
cvar_t *gl_texture_lodbias; |
|
|
|
CVAR_DEFINE_AUTO( gl_texture_lodbias, "0.0", FCVAR_GLCONFIG, "LOD bias for mipmapped textures (perfomance|quality)" ); |
|
|
|
cvar_t *gl_texture_nearest; |
|
|
|
CVAR_DEFINE_AUTO( gl_texture_nearest, "0", FCVAR_GLCONFIG, "disable texture filter" ); |
|
|
|
cvar_t *gl_lightmap_nearest; |
|
|
|
CVAR_DEFINE_AUTO( gl_lightmap_nearest, "0", FCVAR_GLCONFIG, "disable lightmap filter" ); |
|
|
|
cvar_t *gl_keeptjunctions; |
|
|
|
CVAR_DEFINE_AUTO( gl_keeptjunctions, "1", FCVAR_GLCONFIG, "removing tjuncs causes blinking pixels" ); |
|
|
|
cvar_t *gl_check_errors; |
|
|
|
CVAR_DEFINE_AUTO( gl_check_errors, "1", FCVAR_GLCONFIG, "ignore video engine errors" ); |
|
|
|
cvar_t *gl_polyoffset; |
|
|
|
CVAR_DEFINE_AUTO( gl_polyoffset, "2.0", FCVAR_GLCONFIG, "polygon offset for decals" ); |
|
|
|
cvar_t *gl_wireframe; |
|
|
|
CVAR_DEFINE_AUTO( gl_wireframe, "0", FCVAR_GLCONFIG|FCVAR_SPONLY, "show wireframe overlay" ); |
|
|
|
cvar_t *gl_finish; |
|
|
|
CVAR_DEFINE_AUTO( gl_finish, "0", FCVAR_GLCONFIG, "use glFinish instead of glFlush" ); |
|
|
|
cvar_t *gl_nosort; |
|
|
|
CVAR_DEFINE_AUTO( gl_nosort, "0", FCVAR_GLCONFIG, "disable sorting of translucent surfaces" ); |
|
|
|
cvar_t *gl_vsync; |
|
|
|
CVAR_DEFINE_AUTO( gl_test, "0", 0, "engine developer cvar for quick testing new features" ); |
|
|
|
cvar_t *gl_clear; |
|
|
|
CVAR_DEFINE_AUTO( gl_msaa, "1", FCVAR_GLCONFIG, "enable or disable multisample anti-aliasing" ); |
|
|
|
cvar_t *gl_test; |
|
|
|
CVAR_DEFINE_AUTO( gl_stencilbits, "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" ); |
|
|
|
cvar_t *gl_msaa; |
|
|
|
CVAR_DEFINE_AUTO( r_lighting_extended, "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" ); |
|
|
|
cvar_t *gl_stencilbits; |
|
|
|
CVAR_DEFINE_AUTO( r_lighting_ambient, "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" ); |
|
|
|
cvar_t *r_lighting_extended; |
|
|
|
CVAR_DEFINE_AUTO( r_detailtextures, "1", FCVAR_ARCHIVE, "enable detail textures support" ); |
|
|
|
cvar_t *r_lighting_modulate; |
|
|
|
CVAR_DEFINE_AUTO( r_novis, "0", 0, "ignore vis information (perfomance test)" ); |
|
|
|
cvar_t *r_lighting_ambient; |
|
|
|
CVAR_DEFINE_AUTO( r_nocull, "0", 0, "ignore frustrum culling (perfomance test)" ); |
|
|
|
cvar_t *r_detailtextures; |
|
|
|
CVAR_DEFINE_AUTO( r_lockpvs, "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" ); |
|
|
|
cvar_t *r_novis; |
|
|
|
CVAR_DEFINE_AUTO( r_lockfrustum, "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" ); |
|
|
|
cvar_t *r_nocull; |
|
|
|
CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models" ); |
|
|
|
cvar_t *r_lockpvs; |
|
|
|
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" ); |
|
|
|
cvar_t *r_lockfrustum; |
|
|
|
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" ); |
|
|
|
cvar_t *r_traceglow; |
|
|
|
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" ); |
|
|
|
cvar_t *r_dynamic; |
|
|
|
|
|
|
|
cvar_t *gl_round_down; |
|
|
|
|
|
|
|
cvar_t *r_vbo; |
|
|
|
|
|
|
|
cvar_t *r_vbo_dlightmode; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cvar_t *tracerred; |
|
|
|
|
|
|
|
cvar_t *tracergreen; |
|
|
|
|
|
|
|
cvar_t *tracerblue; |
|
|
|
|
|
|
|
cvar_t *traceralpha; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFINE_ENGINE_SHARED_CVAR_LIST() |
|
|
|
DEFINE_ENGINE_SHARED_CVAR_LIST() |
|
|
|
|
|
|
|
|
|
|
@ -345,7 +336,7 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char |
|
|
|
parm = gEngfuncs.Cvar_Get( cvarname, "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, desc ); |
|
|
|
parm = gEngfuncs.Cvar_Get( cvarname, "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, desc ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(( parm && !CVAR_TO_BOOL( parm )) || ( !CVAR_TO_BOOL( gl_extensions ) && r_ext != GL_OPENGL_110 )) |
|
|
|
if(( parm && !parm->value ) || ( !gl_extensions.value && r_ext != GL_OPENGL_110 )) |
|
|
|
{ |
|
|
|
{ |
|
|
|
gEngfuncs.Con_Reportf( "- disabled\n" ); |
|
|
|
gEngfuncs.Con_Reportf( "- disabled\n" ); |
|
|
|
GL_SetExtension( r_ext, false ); |
|
|
|
GL_SetExtension( r_ext, false ); |
|
|
@ -807,7 +798,7 @@ void GL_InitExtensions( void ) |
|
|
|
|
|
|
|
|
|
|
|
Q_snprintf( value, sizeof( value ), "%i", glConfig.max_2d_texture_size ); |
|
|
|
Q_snprintf( value, sizeof( value ), "%i", glConfig.max_2d_texture_size ); |
|
|
|
gEngfuncs.Cvar_Get( "gl_max_size", value, 0, "opengl texture max dims" ); |
|
|
|
gEngfuncs.Cvar_Get( "gl_max_size", value, 0, "opengl texture max dims" ); |
|
|
|
gEngfuncs.Cvar_SetValue( "gl_anisotropy", bound( 0, gl_texture_anisotropy->value, glConfig.max_texture_anisotropy )); |
|
|
|
gEngfuncs.Cvar_SetValue( "gl_anisotropy", bound( 0, gl_texture_anisotropy.value, glConfig.max_texture_anisotropy )); |
|
|
|
|
|
|
|
|
|
|
|
if( GL_Support( GL_TEXTURE_COMPRESSION_EXT )) |
|
|
|
if( GL_Support( GL_TEXTURE_COMPRESSION_EXT )) |
|
|
|
gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE ); |
|
|
|
gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE ); |
|
|
@ -846,33 +837,32 @@ void GL_InitCommands( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
RETRIEVE_ENGINE_SHARED_CVAR_LIST(); |
|
|
|
RETRIEVE_ENGINE_SHARED_CVAR_LIST(); |
|
|
|
|
|
|
|
|
|
|
|
r_lighting_extended = gEngfuncs.Cvar_Get( "r_lighting_extended", "1", FCVAR_GLCONFIG, "allow to get lighting from world and bmodels" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_lighting_extended ); |
|
|
|
r_lighting_modulate = gEngfuncs.Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_GLCONFIG, "lightstyles modulate scale" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_lighting_ambient ); |
|
|
|
r_lighting_ambient = gEngfuncs.Cvar_Get( "r_lighting_ambient", "0.3", FCVAR_GLCONFIG, "map ambient lighting scale" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_novis ); |
|
|
|
r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_nocull ); |
|
|
|
r_nocull = gEngfuncs.Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_detailtextures ); |
|
|
|
r_detailtextures = gEngfuncs.Cvar_Get( "r_detailtextures", "1", FCVAR_ARCHIVE, "enable detail textures support" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_lockpvs ); |
|
|
|
r_lockpvs = gEngfuncs.Cvar_Get( "r_lockpvs", "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_lockfrustum ); |
|
|
|
r_lockfrustum = gEngfuncs.Cvar_Get( "r_lockfrustum", "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_traceglow ); |
|
|
|
r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_GLCONFIG, "cull flares behind models" ); |
|
|
|
|
|
|
|
|
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_extensions ); |
|
|
|
gl_extensions = gEngfuncs.Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "allow gl_extensions" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_texture_nearest ); |
|
|
|
gl_texture_nearest = gEngfuncs.Cvar_Get( "gl_texture_nearest", "0", FCVAR_GLCONFIG, "disable texture filter" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_lightmap_nearest ); |
|
|
|
gl_lightmap_nearest = gEngfuncs.Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_GLCONFIG, "disable lightmap filter" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_check_errors ); |
|
|
|
gl_check_errors = gEngfuncs.Cvar_Get( "gl_check_errors", "1", FCVAR_GLCONFIG, "ignore video engine errors" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_texture_anisotropy ); |
|
|
|
gl_texture_anisotropy = gEngfuncs.Cvar_Get( "gl_anisotropy", "8", FCVAR_GLCONFIG, "textures anisotropic filter" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_texture_lodbias ); |
|
|
|
gl_texture_lodbias = gEngfuncs.Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_GLCONFIG, "LOD bias for mipmapped textures (perfomance|quality)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_keeptjunctions ); |
|
|
|
gl_keeptjunctions = gEngfuncs.Cvar_Get( "gl_keeptjunctions", "1", FCVAR_GLCONFIG, "removing tjuncs causes blinking pixels" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_finish ); |
|
|
|
gl_finish = gEngfuncs.Cvar_Get( "gl_finish", "0", FCVAR_GLCONFIG, "use glFinish instead of glFlush" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_nosort ); |
|
|
|
gl_nosort = gEngfuncs.Cvar_Get( "gl_nosort", "0", FCVAR_GLCONFIG, "disable sorting of translucent surfaces" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_test ); |
|
|
|
gl_test = gEngfuncs.Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_wireframe ); |
|
|
|
gl_wireframe = gEngfuncs.Cvar_Get( "gl_wireframe", "0", FCVAR_GLCONFIG|FCVAR_SPONLY, "show wireframe overlay" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_msaa ); |
|
|
|
gl_msaa = gEngfuncs.Cvar_Get( "gl_msaa", "1", FCVAR_GLCONFIG, "enable or disable multisample anti-aliasing" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_stencilbits ); |
|
|
|
gl_stencilbits = gEngfuncs.Cvar_Get( "gl_stencilbits", "8", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "pixelformat stencil bits (0 - auto)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_round_down ); |
|
|
|
gl_round_down = gEngfuncs.Cvar_Get( "gl_round_down", "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// these cvar not used by engine but some mods requires this
|
|
|
|
// these cvar not used by engine but some mods requires this
|
|
|
|
gl_polyoffset = gEngfuncs.Cvar_Get( "gl_polyoffset", "2.0", FCVAR_GLCONFIG, "polygon offset for decals" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &gl_polyoffset ); |
|
|
|
|
|
|
|
|
|
|
|
// make sure gl_vsync is checked after vid_restart
|
|
|
|
// make sure gl_vsync is checked after vid_restart
|
|
|
|
SetBits( gl_vsync->flags, FCVAR_CHANGED ); |
|
|
|
SetBits( gl_vsync->flags, FCVAR_CHANGED ); |
|
|
@ -890,9 +880,6 @@ register VBO cvars and get default value |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static void R_CheckVBO( void ) |
|
|
|
static void R_CheckVBO( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char *def = "0"; |
|
|
|
|
|
|
|
const char *dlightmode = "1"; |
|
|
|
|
|
|
|
int flags = FCVAR_ARCHIVE; |
|
|
|
|
|
|
|
qboolean disable = false; |
|
|
|
qboolean disable = false; |
|
|
|
|
|
|
|
|
|
|
|
// some bad GLES1 implementations breaks dlights completely
|
|
|
|
// some bad GLES1 implementations breaks dlights completely
|
|
|
@ -904,21 +891,17 @@ static void R_CheckVBO( void ) |
|
|
|
// Disable it, as there is no suitable workaround here
|
|
|
|
// Disable it, as there is no suitable workaround here
|
|
|
|
if( Q_stristr( glConfig.renderer_string, "VideoCore IV" ) || Q_stristr( glConfig.renderer_string, "vc4" ) ) |
|
|
|
if( Q_stristr( glConfig.renderer_string, "VideoCore IV" ) || Q_stristr( glConfig.renderer_string, "vc4" ) ) |
|
|
|
disable = true; |
|
|
|
disable = true; |
|
|
|
|
|
|
|
|
|
|
|
// dlightmode 1 is not too much tested on android
|
|
|
|
|
|
|
|
// so better to left it off
|
|
|
|
|
|
|
|
dlightmode = "0"; |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if( disable ) |
|
|
|
if( disable ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// do not keep in config unless dev > 3 and enabled
|
|
|
|
r_vbo.flags = r_vbo_dlightmode.flags = 0; |
|
|
|
flags = 0; |
|
|
|
r_vbo.string = "0"; |
|
|
|
def = "0"; |
|
|
|
r_vbo_dlightmode.string = "0"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
r_vbo = gEngfuncs.Cvar_Get( "gl_vbo", def, flags, "draw world using VBO (known to be glitchy)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_vbo ); |
|
|
|
r_vbo_dlightmode = gEngfuncs.Cvar_Get( "gl_vbo_dlightmode", dlightmode, FCVAR_ARCHIVE, "vbo dlight rendering mode(0-1)" ); |
|
|
|
gEngfuncs.Cvar_RegisterVariable( &r_vbo_dlightmode ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -1030,7 +1013,7 @@ void GL_CheckForErrors_( const char *filename, const int fileline ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int err; |
|
|
|
int err; |
|
|
|
|
|
|
|
|
|
|
|
if( !CVAR_TO_BOOL( gl_check_errors )) |
|
|
|
if( !gl_check_errors.value ) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if(( err = pglGetError( )) == GL_NO_ERROR ) |
|
|
|
if(( err = pglGetError( )) == GL_NO_ERROR ) |
|
|
@ -1099,7 +1082,7 @@ void GL_SetupAttributes( int safegl ) |
|
|
|
gEngfuncs.Con_Printf( "bpp %d\n", gpGlobals->desktopBitsPixel ); |
|
|
|
gEngfuncs.Con_Printf( "bpp %d\n", gpGlobals->desktopBitsPixel ); |
|
|
|
|
|
|
|
|
|
|
|
if( safegl < SAFE_NOSTENCIL ) |
|
|
|
if( safegl < SAFE_NOSTENCIL ) |
|
|
|
gEngfuncs.GL_SetAttribute( REF_GL_STENCIL_SIZE, gl_stencilbits->value ); |
|
|
|
gEngfuncs.GL_SetAttribute( REF_GL_STENCIL_SIZE, gl_stencilbits.value ); |
|
|
|
|
|
|
|
|
|
|
|
if( safegl < SAFE_NOALPHA ) |
|
|
|
if( safegl < SAFE_NOALPHA ) |
|
|
|
gEngfuncs.GL_SetAttribute( REF_GL_ALPHA_SIZE, 8 ); |
|
|
|
gEngfuncs.GL_SetAttribute( REF_GL_ALPHA_SIZE, 8 ); |
|
|
|