Skip to content

ac/nir/nggc: Don't reuse uniform values from divergent control flow.

Timur Kristóf requested to merge Venemo/mesa:radv-nggc-fix-uniform-reuse into main

With NGG culling, the shaders are split into two parts: the top part that computes just the position output, and the bottom part which produces the other outputs. To reduce redundancy between the two, I added some code to reuse uniform variables between them.

However, there is an edge case I didn't think about: because of vertex repacking, it is possible for the bottom part to process a different vertex. Therefore it can take a different divergent code path (though it must still take the same uniform code path). Due to this, when a uniform value comes from divergent control flow, this may be undefined in the bottom part.

This commit stops reusing uniform variables from divergent control flow, to fix issues that arise from this.

Merge request reports