anv, nir: Move PrimRep optimization to core NIR, misc. fixes for turnip multi-position output

Adreno hardware has an optimization called "multi-position output" which is very similar to Primitive Replication with Intel. (As an aside, it seems nvidia has something similar too based on their multiview extension). As a refresher, the idea is that in most cases, the only thing that depends on gl_ViewIndex will be gl_Position, in which case we transform the shader to a form which is run only once for all views, and writes only one copy of "normal" varyings but a copy of gl_Position for each view, and then the hardware will generate multiple primitives using the same varying data.

This series contains the anv-specific as well as core NIR patches for turnip multi-position output which might need a different set of eyeballs. The first three commits move the guts of the PrimRep optimization into core NIR, leaving out some Intel-specific things that we won't want in turnip and adding one turnip-specific option, and the rest are core NIR bugfixes that should only be hit with turnip + multi-pos output.

Merge request reports