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