Skip to content

Loop unrolling fixes for swizzles

Timothy Arceri requested to merge tarceri/mesa:loop_fixes into master

Fixes swizzle use on the loop iteration limit and invariant. For example:

ivec4 temp = ivec4(4, 3, 1, 4);
 vec4 colour = vec4(0.0, 1.0, 1.0, 1.0);

 int i = 0;
 while (i < temp.w) {
   if (i == 3)
     colour = vec4(0.0, 1.0, 0.0, 1.0);

   i = i + temp.z;
 }

Note we only seem to hit these on Vulkan drivers because in OpenGL the GLSL IR always constant propagates the values before we get to the NIR unrolling pass.

Edited by Timothy Arceri

Merge request reports