nir: ViewID/LayerID & input attachment cleanups, improvements for turnip
On qualcomm hardware,
gl_ViewIndex are both inputs in the FS stage, and both are completely independent of each other. There is a special multiview mode, and when enabled, there's a separate field where we tell the hardware which input to overwrite with
gl_ViewIndex and the normal
gl_Layer field doesn't work. However
gl_ViewIndex in the VS works like other VS sysvals (
In order to avoid driver-specific workarounds, I've made a few changes to core NIR:
- Add an option to make
gl_ViewIndexan input, for fragment shaders on turnip.
- When lowering input attachments, and we need the layer id to pass as the array index to
txf, add the option to use
gl_Layeras an input or
gl_ViewIndexas an input. radv also wants
gl_Layeras an input, so I've switched it over.
As a bonus, this cleans up radv a bit and fixes input attachments with layered rendering on turnip.