engine: client: move reseting gamma changed flag to the end of the frame for custom renderers

This commit is contained in:
Alibek Omarov 2024-02-05 03:41:12 +03:00
parent 618ec83c9d
commit 33da68b013
3 changed files with 13 additions and 6 deletions

View File

@ -553,4 +553,6 @@ void V_PostRender( void )
ref.dllFuncs.R_AllowFog( true );
Platform_SetTimer( 0.0f );
ref.dllFuncs.R_EndFrame();
V_CheckGammaEnd();
}

View File

@ -106,7 +106,6 @@ static void V_ValidateGammaCvars( void )
void V_CheckGamma( void )
{
static qboolean dirty = false;
qboolean notify_refdll = false;
// because these cvars were defined as archive
// but wasn't doing anything useful
@ -132,20 +131,25 @@ void V_CheckGamma( void )
V_ValidateGammaCvars();
dirty = false;
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
// force refdll to recalculate lightmaps
notify_refdll = true;
if( ref.initialized )
ref.dllFuncs.R_GammaChanged( false );
}
}
// unfortunately, recalculating textures isn't possible yet
void V_CheckGammaEnd( void )
{
// keep the flags until the end of frame so client.dll will catch these changes
if( FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
{
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
ClearBits( v_brightness.flags, FCVAR_CHANGED );
ClearBits( v_gamma.flags, FCVAR_CHANGED );
}
if( notify_refdll && ref.initialized )
ref.dllFuncs.R_GammaChanged( false );
}
void V_Init( void )

View File

@ -795,6 +795,7 @@ uint ScreenGammaTable( uint );
uint LinearGammaTable( uint );
void V_Init( void );
void V_CheckGamma( void );
void V_CheckGammaEnd( void );
//
// identification.c