From eb72b6baeed4b927df0114e6105c3b81e978601b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 28 Oct 2024 02:10:24 +0300 Subject: [PATCH] ref: gl: fix r_shadows and gl_vbo registration order. It must be registered before reading renderer config --- ref/gl/gl_alias.c | 2 -- ref/gl/gl_local.h | 1 + ref/gl/gl_opengl.c | 27 +++++++++++++++------------ ref/gl/gl_studio.c | 2 -- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ref/gl/gl_alias.c b/ref/gl/gl_alias.c index 5fa1e66f..88a44500 100644 --- a/ref/gl/gl_alias.c +++ b/ref/gl/gl_alias.c @@ -21,8 +21,6 @@ GNU General Public License for more details. #include "pm_local.h" #include "pmtrace.h" -extern cvar_t r_shadows; - typedef struct { double time; diff --git a/ref/gl/gl_local.h b/ref/gl/gl_local.h index 390061f6..c776d45b 100644 --- a/ref/gl/gl_local.h +++ b/ref/gl/gl_local.h @@ -767,6 +767,7 @@ extern convar_t r_vbo_detail; extern convar_t r_vbo_overbrightmode; extern convar_t r_studio_sort_textures; extern convar_t r_studio_drawelements; +extern convar_t r_shadows; extern convar_t r_ripple; extern convar_t r_ripple_updatetime; extern convar_t r_ripple_spawntime; diff --git a/ref/gl/gl_opengl.c b/ref/gl/gl_opengl.c index 50367697..237f557f 100644 --- a/ref/gl/gl_opengl.c +++ b/ref/gl/gl_opengl.c @@ -1146,10 +1146,6 @@ void GL_InitExtensions( void ) gEngfuncs.Cvar_SetValue( "gl_finish", 1 ); #endif - // we do not want to write vbo code that does not use multitexture - if( !GL_Support( GL_ARB_VERTEX_BUFFER_OBJECT_EXT ) || !GL_Support( GL_ARB_MULTITEXTURE ) || glConfig.max_texture_units < 2 ) - gEngfuncs.Cvar_FullSet( "gl_vbo", "0", FCVAR_READ_ONLY ); - R_RenderInfo_f(); tr.framecount = tr.visframecount = 1; @@ -1191,6 +1187,11 @@ static void GL_InitCommands( void ) gEngfuncs.Cvar_RegisterVariable( &r_ripple ); gEngfuncs.Cvar_RegisterVariable( &r_ripple_updatetime ); gEngfuncs.Cvar_RegisterVariable( &r_ripple_spawntime ); + gEngfuncs.Cvar_RegisterVariable( &r_shadows ); + gEngfuncs.Cvar_RegisterVariable( &r_vbo ); + gEngfuncs.Cvar_RegisterVariable( &r_vbo_dlightmode ); + gEngfuncs.Cvar_RegisterVariable( &r_vbo_overbrightmode ); + gEngfuncs.Cvar_RegisterVariable( &r_vbo_detail ); gEngfuncs.Cvar_RegisterVariable( &gl_extensions ); gEngfuncs.Cvar_RegisterVariable( &gl_texture_nearest ); @@ -1228,6 +1229,7 @@ register VBO cvars and get default value static void R_CheckVBO( void ) { qboolean disable = false; + int flags = 0; // some bad GLES1 implementations breaks dlights completely if( glConfig.max_texture_units < 3 ) @@ -1240,17 +1242,18 @@ static void R_CheckVBO( void ) disable = true; #endif - if( disable ) + // we do not want to write vbo code that does not use multitexture + if( !GL_Support( GL_ARB_VERTEX_BUFFER_OBJECT_EXT ) || !GL_Support( GL_ARB_MULTITEXTURE ) || glConfig.max_texture_units < 2 ) { - r_vbo.flags = r_vbo_dlightmode.flags = 0; - r_vbo.string = "0"; - r_vbo_dlightmode.string = "0"; + flags = FCVAR_READ_ONLY; + disable = true; } - gEngfuncs.Cvar_RegisterVariable( &r_vbo ); - gEngfuncs.Cvar_RegisterVariable( &r_vbo_dlightmode ); - gEngfuncs.Cvar_RegisterVariable( &r_vbo_overbrightmode ); - gEngfuncs.Cvar_RegisterVariable( &r_vbo_detail ); + if( disable ) + { + gEngfuncs.Cvar_FullSet( r_vbo.name, "0", flags ); + gEngfuncs.Cvar_FullSet( r_vbo_dlightmode.name, "0", flags ); + } } /* diff --git a/ref/gl/gl_studio.c b/ref/gl/gl_studio.c index dac5fdc1..b3e92376 100644 --- a/ref/gl/gl_studio.c +++ b/ref/gl/gl_studio.c @@ -154,8 +154,6 @@ void R_StudioInit( void ) Matrix3x4_LoadIdentity( g_studio.rotationmatrix ); - gEngfuncs.Cvar_RegisterVariable( &r_shadows ); - g_studio.interpolate = true; g_studio.framecount = 0; m_fDoRemap = false;