Skip to content

Commit de2fb50

Browse files
committed
Mark user-registered shaders for building
When the user registers a shader directly, assume it will be used for explicitly specified polygons (as opposed to a model) and mark the corresponding GLSL shaders for building. This gets creep and heat haze that we were missing before.
1 parent 9161f78 commit de2fb50

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/engine/renderer/tr_shader.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6294,6 +6294,7 @@ qhandle_t RE_RegisterShader( const char *name, int flags )
62946294
return 0;
62956295
}
62966296

6297+
int oldNumShaders = tr.numShaders;
62976298
sh = R_FindShader( name, flags );
62986299

62996300
// we want to return 0 if the shader failed to
@@ -6306,6 +6307,15 @@ qhandle_t RE_RegisterShader( const char *name, int flags )
63066307
return 0;
63076308
}
63086309

6310+
if ( tr.numShaders > oldNumShaders && r_lazyShaders.Get() == 1 ) // the shader is actually newly registered
6311+
{
6312+
// RE_RegisterShader is used for directly user-registered shaders. So assume it will be
6313+
// used for drawing explicitly specified polygons - not BSP, not models. This is usually right
6314+
// but one exception is shaders used as `customShader` for models.
6315+
// This is a no-op if EndRegistration has already been called (unless glsl_restart?).
6316+
MarkShaderBuild( sh, -1, false, false, false );
6317+
}
6318+
63096319
return sh->index;
63106320
}
63116321

0 commit comments

Comments
 (0)