]> git.sesse.net Git - narabu/commitdiff
Stop hardcoding blocks per row in the shader.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 24 Sep 2017 16:42:10 +0000 (18:42 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 24 Sep 2017 16:42:10 +0000 (18:42 +0200)
decoder.shader

index 7136e03e5ff0de76095f1fd5974f68fe0bc5a3ba..724a2f5f38362538adab6750d83297f96c440d24 100644 (file)
@@ -203,6 +203,8 @@ void main()
        local_timing[0] = start;
 #endif
 
+       const uint blocks_per_row = (imageSize(out_tex).x + 7) / 8;
+
        const uint local_x = gl_LocalInvocationID.x % 8;
        const uint local_y = (gl_LocalInvocationID.x / 8) % 8;
        const uint local_z = gl_LocalInvocationID.x / 64;
@@ -306,8 +308,8 @@ void main()
                pick_timer(start, local_timing[6]);
 
                uint global_block_idx = (block_row * 40 + block_idx) * 8 + local_y;
-               uint block_x = global_block_idx % 160;
-               uint block_y = global_block_idx / 160;
+               uint block_x = global_block_idx % blocks_per_row;
+               uint block_y = global_block_idx / blocks_per_row;
 
                uint y = block_y * 8;
                uint x = block_x * 8 + local_x;