Skip to content

nir: Copy propagate direct access of vector elements

First teach copy_prop_vars not to do the wrong thing when it sees an array deref of a vector; then teach it how to read direct array derefs -- effectively treating them as a masked access to the full vector. Those cases don't happen now with the modes of the derefs that get to copy_prop_vars. But they will be possible once we move the lowering of UBO/SSBO derefs to later -- so they can take advantage of optimizations including this pass. CTS has some tests that trigger those cases.

I've added some "debug" helpers, but I'm not sure if this is something people want to have around. Given the complexity of the pass, I think is a net win to have them.

I'm working on indirect access but there's enough material here. I'll revisit whether is practical to add some support to copy_deref of direct access after that.

Edited by Caio Oliveira

Merge request reports