diff --git a/src/engine/renderer/tr_cmds.cpp b/src/engine/renderer/tr_cmds.cpp index 4b529080b0..441da7184a 100644 --- a/src/engine/renderer/tr_cmds.cpp +++ b/src/engine/renderer/tr_cmds.cpp @@ -834,11 +834,10 @@ void RE_BeginFrame() } // texturemode stuff - if ( r_textureMode->modified ) + if ( Util::optional textureMode = r_textureMode.GetModifiedValue() ) { R_SyncRenderThread(); - GL_TextureMode( r_textureMode->string ); - r_textureMode->modified = false; + GL_TextureMode( textureMode->c_str() ); } // check for errors diff --git a/src/engine/renderer/tr_init.cpp b/src/engine/renderer/tr_init.cpp index 259bd5d03b..73b1f619b6 100644 --- a/src/engine/renderer/tr_init.cpp +++ b/src/engine/renderer/tr_init.cpp @@ -158,7 +158,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA cvar_t *r_replaceMaterialMinDimensionIfPresentWithMaxDimension; Cvar::Range> r_imageFitScreen("r_imageFitScreen", "downscale “fitscreen” images to fit the screen size: 0: disable, 1: downscale as much as possible without being smaller than screen size (default), 2: downscale to never be larger then screen size", Cvar::NONE, 1, 0, 2); cvar_t *r_finish; - cvar_t *r_textureMode; + Cvar::Modified> r_textureMode( + "r_textureMode", "default texture filter mode", Cvar::NONE, "GL_LINEAR_MIPMAP_LINEAR"); cvar_t *r_offsetFactor; cvar_t *r_offsetUnits; @@ -830,8 +831,8 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p tr.currenttextures.resize( glConfig2.maxTextureUnits ); - GL_TextureMode( r_textureMode->string ); - r_textureMode->modified = false; + GL_TextureMode( r_textureMode.Get().c_str() ); + r_textureMode.GetModifiedValue(); GL_DepthFunc( GL_LEQUAL ); @@ -1067,7 +1068,7 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p Log::Notice("Forcing glFinish." ); } - Log::Debug("texturemode: %s", r_textureMode->string ); + Log::Debug("texturemode: %s", r_textureMode.Get() ); Log::Debug("picmip: %d", r_picMip->integer ); Log::Debug("imageMaxDimension: %d", r_imageMaxDimension->integer ); Log::Debug("ignoreMaterialMinDimension: %d", r_ignoreMaterialMinDimension->integer ); @@ -1169,7 +1170,6 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p r_zfar = Cvar_Get( "r_zfar", "0", CVAR_CHEAT ); r_checkGLErrors = Cvar_Get( "r_checkGLErrors", "-1", 0 ); r_finish = Cvar_Get( "r_finish", "0", CVAR_CHEAT ); - r_textureMode = Cvar_Get( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE ); r_gamma = Cvar_Get( "r_gamma", "1.0", CVAR_ARCHIVE ); r_facePlaneCull = Cvar_Get( "r_facePlaneCull", "1", 0 ); diff --git a/src/engine/renderer/tr_local.h b/src/engine/renderer/tr_local.h index 52d810007c..6570e1fc89 100644 --- a/src/engine/renderer/tr_local.h +++ b/src/engine/renderer/tr_local.h @@ -2944,7 +2944,7 @@ enum class shaderProfilerRenderSubGroupsMode { extern Cvar::Range> r_imageFitScreen; extern cvar_t *r_finish; extern cvar_t *r_drawBuffer; - extern cvar_t *r_textureMode; + extern Cvar::Modified> r_textureMode; extern cvar_t *r_offsetFactor; extern cvar_t *r_offsetUnits;