Skip to content

Commit 70f9345

Browse files
committed
wip: more uint typing fixes
1 parent dfa697a commit 70f9345

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/engine/renderer/glsl_source/lighttile_fp.glsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ DECLARE_OUTPUT(uvec4)
6767

6868
// 8 bits per light ID
6969
void pushIdxs( in uint idx, in uint count, inout uvec4 idxs ) {
70-
idxs[count / 4] <<= 8;
71-
idxs[count / 4] |= idx & 0xFFu;
70+
idxs[count / 4u] <<= 8u;
71+
idxs[count / 4u] |= idx & 0xFFu;
7272
}
7373

7474
#define exportIdxs( x ) outputColor = ( x )
@@ -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 = u_lightLayer; i < u_numLights; i += NUM_LIGHT_LAYERS ) {
123+
for( uint i = u_lightLayer; i < u_numLights; i += uint( 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
@@ -136,7 +136,7 @@ void main() {
136136
if( radius > 0.0 ) {
137137
/* Light IDs are stored relative to the layer
138138
Add 1 because 0 means there's no light */
139-
pushIdxs( ( i / NUM_LIGHT_LAYERS ) + 1, lightCount, idxs );
139+
pushIdxs( ( i / uint( NUM_LIGHT_LAYERS ) ) + 1u, lightCount, idxs );
140140
lightCount++;
141141

142142
if( lightCount == lightsPerLayer ) {

0 commit comments

Comments
 (0)