Skip to content

Commit

Permalink
- eliminate an unexpected slow path in the fragment shader.
Browse files Browse the repository at this point in the history
Apparently with checking uLightLevel the shader cannot discard the slow software lighting path entirely adding a significant amount of processing time.
Changed to check the actual lightmode value, which re-enables the fast path again.
  • Loading branch information
coelckers committed Aug 9, 2021
1 parent 747c291 commit cd5aa65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wadsrc/static/shaders/glsl/main.fp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ vec4 getLightColor(Material material, float fogdist, float fogfactor)
{
vec4 color = vColor;

if (uLightLevel >= 0.0)
if ((uPalLightLevels >> 16) >= 5) // gl_lightmode >= 5 are software lighting modes.
{
float newlightlevel = 1.0 - R_DoomLightingEquation(uLightLevel);
color.rgb *= newlightlevel;
Expand Down

0 comments on commit cd5aa65

Please sign in to comment.