Skip to content

Commit

Permalink
[rend2] Limit light loop in lightall shader
Browse files Browse the repository at this point in the history
  • Loading branch information
SomaZ committed Mar 21, 2024
1 parent 5f0a58a commit e996441
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shared/rd-rend2/glsl/lightall.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ vec3 CalcDynamicLightContribution(
vec3 outColor = vec3(0.0);
vec3 position = viewOrigin - viewDir;

for ( int i = 0; i < u_NumLights; i++ )
for ( int i = 0; i < min(u_NumLights, MAX_DLIGHTS); i++ )
{
if ( ( u_LightMask & ( 1 << i ) ) == 0 ) {
continue;
Expand Down
4 changes: 4 additions & 0 deletions shared/rd-rend2/tr_glsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ static size_t GLSL_GetShaderHeader(
va("#define MAX_GPU_FOGS %i\n",
MAX_GPU_FOGS));

Q_strcat(dest, size,
va("#define MAX_DLIGHTS %i\n",
MAX_DLIGHTS));

fbufWidthScale = (float)glConfig.vidWidth;
fbufHeightScale = (float)glConfig.vidHeight;
Q_strcat(dest, size,
Expand Down

0 comments on commit e996441

Please sign in to comment.