In my compute shader i try to calculate the texel coordinate of each local invocation based on the gl_GlobalInvocation variable inside a rectangle of my image. For large values of gl_GlobalInvocation.x up to 262144 i get strange results. (gl_WorkGroupSize=1024 (1024,1,1), gl_NumWorkGroups=256 (256,1,1), width <= 512, height <= 512) Maybe its because glsl modulo cannot handle uint datatypes in OpenGL ES 3.1.
Is there alternative way to calc coordinates for uint range?
ivec2 coords;
uint width = uint(rectPos.z-rectPos.x);
uint height = uint(rectPos.w-rectPos.y);
coords.x = int(gl_GlobalInvocationID.x % width) + rectPos.x;
coords.y = int(gl_GlobalInvocationID.x / height) + rectPos.y;
...
vec4 color = imageLoad(texture, coords)
...