私の計算シェーダーでは、画像の四角形内の gl_GlobalInvocation 変数に基づいて、各ローカル呼び出しのテクセル座標を計算しようとしています。262144 までの gl_GlobalInvocation.x の値が大きい場合、奇妙な結果が得られます。(gl_WorkGroupSize=1024 (1024,1,1), gl_NumWorkGroups=256 (256,1,1), width <= 512, height <= 512) おそらく、glsl modulo が OpenGL ES 3.1 で uint データ型を処理できないためです。
uint範囲の座標を計算する別の方法はありますか?
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)
...