Skip to content

Commit

Permalink
Allow disabling depth prepass with r_depthShaders
Browse files Browse the repository at this point in the history
  • Loading branch information
slipher committed Nov 10, 2024
1 parent de6c5d7 commit 15e3b39
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/engine/renderer/tr_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ Cvar::Cvar<bool> r_dpBlend("r_dpBlend", "Enable DarkPlaces blend compatibility,
static Cvar::Cvar<float> r_portalDefaultRange(
"r_portalDefaultRange", "Default portal range", Cvar::NONE, 1024);

// This can be turned off to debug problems with depth shaders.
// Almost everything can be rendered correctly without them, except real-time lights
// (since light tiles are populated using the depth buffer).
static Cvar::Cvar<bool> r_depthShaders(
"r_depthShaders", "use depth pre-pass shaders", Cvar::CHEAT, true);

/*
================
return a hash value for the filename
Expand Down Expand Up @@ -6000,7 +6006,8 @@ static shader_t *FinishShader()
}

// generate depth-only shader if necessary
if( !shader.isSky &&
if( r_depthShaders.Get() &&
!shader.isSky &&
numStages > 0 &&
(stages[0].stateBits & GLS_DEPTHMASK_TRUE) &&
!(stages[0].stateBits & GLS_DEPTHFUNC_EQUAL) &&
Expand Down Expand Up @@ -7221,6 +7228,7 @@ R_InitShaders
void R_InitShaders()
{
Cvar::Latch(r_dpMaterial);
Cvar::Latch(r_depthShaders);
Cvar::Latch(r_portalDefaultRange);

memset( shaderTableHashTable, 0, sizeof( shaderTableHashTable ) );
Expand Down

0 comments on commit 15e3b39

Please sign in to comment.