File tree 2 files changed +9
-9
lines changed
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -4128,30 +4128,30 @@ class u_UnprojectionParams :
4128
4128
};
4129
4129
4130
4130
class u_numLights :
4131
- GLUniform1i
4131
+ GLUniform1ui
4132
4132
{
4133
4133
public:
4134
4134
u_numLights ( GLShader *shader ) :
4135
- GLUniform1i ( shader, " u_numLights" , true )
4135
+ GLUniform1ui ( shader, " u_numLights" , true )
4136
4136
{
4137
4137
}
4138
4138
4139
- void SetUniform_numLights ( int value )
4139
+ void SetUniform_numLights ( uint32_t value )
4140
4140
{
4141
4141
this ->SetValue ( value );
4142
4142
}
4143
4143
};
4144
4144
4145
4145
class u_lightLayer :
4146
- GLUniform1i
4146
+ GLUniform1ui
4147
4147
{
4148
4148
public:
4149
4149
u_lightLayer ( GLShader *shader ) :
4150
- GLUniform1i ( shader, " u_lightLayer" )
4150
+ GLUniform1ui ( shader, " u_lightLayer" )
4151
4151
{
4152
4152
}
4153
4153
4154
- void SetUniform_lightLayer ( int value )
4154
+ void SetUniform_lightLayer ( uint32_t value )
4155
4155
{
4156
4156
this ->SetValue ( value );
4157
4157
}
Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ Light GetLight( in uint idx ) {
53
53
return lights[idx];
54
54
}
55
55
56
- uniform int u_numLights;
56
+ uniform uint u_numLights;
57
57
uniform mat4 u_ModelMatrix;
58
58
uniform sampler2D u_DepthMap;
59
- uniform int u_lightLayer;
59
+ uniform uint u_lightLayer;
60
60
uniform vec3 u_zFar;
61
61
62
62
const uint lightsPerLayer = 16u;
@@ -120,7 +120,7 @@ void main() {
120
120
only process 1 / 4 of different lights for each layer, extra lights going into the last layer. This can fail to add some lights
121
121
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
122
122
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 ) {
124
124
Light l = GetLight( i );
125
125
vec3 center = ( u_ModelMatrix * vec4 ( l.center, 1.0 ) ).xyz;
126
126
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