File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -4128,30 +4128,30 @@ class u_UnprojectionParams :
41284128};
41294129
41304130class u_numLights :
4131- GLUniform1i
4131+ GLUniform1ui
41324132{
41334133public:
41344134 u_numLights ( GLShader *shader ) :
4135- GLUniform1i ( shader, " u_numLights" , true )
4135+ GLUniform1ui ( shader, " u_numLights" , true )
41364136 {
41374137 }
41384138
4139- void SetUniform_numLights ( int value )
4139+ void SetUniform_numLights ( uint32_t value )
41404140 {
41414141 this ->SetValue ( value );
41424142 }
41434143};
41444144
41454145class u_lightLayer :
4146- GLUniform1i
4146+ GLUniform1ui
41474147{
41484148public:
41494149 u_lightLayer ( GLShader *shader ) :
4150- GLUniform1i ( shader, " u_lightLayer" )
4150+ GLUniform1ui ( shader, " u_lightLayer" )
41514151 {
41524152 }
41534153
4154- void SetUniform_lightLayer ( int value )
4154+ void SetUniform_lightLayer ( uint32_t value )
41554155 {
41564156 this ->SetValue ( value );
41574157 }
Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ Light GetLight( in uint idx ) {
5353 return lights[idx];
5454}
5555
56- uniform int u_numLights;
56+ uniform uint u_numLights;
5757uniform mat4 u_ModelMatrix;
5858uniform sampler2D u_DepthMap;
59- uniform int u_lightLayer;
59+ uniform uint u_lightLayer;
6060uniform vec3 u_zFar;
6161
6262const uint lightsPerLayer = 16u;
@@ -120,7 +120,7 @@ void main() {
120120 only process 1 / 4 of different lights for each layer, extra lights going into the last layer. This can fail to add some lights
121121 if 1 / 4 of all lights is more than the amount of lights that each layer can hold (16). To fix this, we'd need to either do this on CPU
122122 or use compute shaders with atomics so we can have a variable amount of lights for each tile. */
123- for ( uint i = uint ( u_lightLayer ) ; i < uint ( u_numLights ) ; i += NUM_LIGHT_LAYERS ) {
123+ for ( uint i = u_lightLayer; i < u_numLights; i += NUM_LIGHT_LAYERS ) {
124124 Light l = GetLight( i );
125125 vec3 center = ( u_ModelMatrix * vec4 ( l.center, 1.0 ) ).xyz;
126126 float radius = max ( 2.0 * l.radius, 2.0 * 32.0 ); // Avoid artifacts with weak light sources
You can’t perform that action at this time.
0 commit comments