Skip to content

Commit

Permalink
Cvar migration: r_textureMode
Browse files Browse the repository at this point in the history
  • Loading branch information
slipher committed Dec 26, 2024
1 parent 36798dc commit 9411361
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/engine/renderer/tr_cmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,11 +834,10 @@ void RE_BeginFrame()
}

// texturemode stuff
if ( r_textureMode->modified )
if ( Util::optional<std::string> textureMode = r_textureMode.GetModifiedValue() )
{
R_SyncRenderThread();
GL_TextureMode( r_textureMode->string );
r_textureMode->modified = false;
GL_TextureMode( textureMode->c_str() );
}

// check for errors
Expand Down
10 changes: 5 additions & 5 deletions src/engine/renderer/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *r_replaceMaterialMinDimensionIfPresentWithMaxDimension;
Cvar::Range<Cvar::Cvar<int>> 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<Cvar::Cvar<std::string>> r_textureMode(
"r_textureMode", "default texture filter mode", Cvar::NONE, "GL_LINEAR_MIPMAP_LINEAR");
cvar_t *r_offsetFactor;
cvar_t *r_offsetUnits;

Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,7 @@ enum class shaderProfilerRenderSubGroupsMode {
extern Cvar::Range<Cvar::Cvar<int>> r_imageFitScreen;
extern cvar_t *r_finish;
extern cvar_t *r_drawBuffer;
extern cvar_t *r_textureMode;
extern Cvar::Modified<Cvar::Cvar<std::string>> r_textureMode;
extern cvar_t *r_offsetFactor;
extern cvar_t *r_offsetUnits;

Expand Down

0 comments on commit 9411361

Please sign in to comment.