Skip to content

nir: ViewID/LayerID & input attachment cleanups, improvements for turnip

Connor Abbott requested to merge cwabbott0/mesa:review/nir-turnip-view-id into master

On qualcomm hardware, gl_Layer and 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 (gl_VertexID, gl_PrimitiveID, etc.)

In order to avoid driver-specific workarounds, I've made a few changes to core NIR:

  • Add an option to make gl_ViewIndex an 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_Layer as an input or gl_ViewIndex as an input. radv also wants gl_Layer as 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.

Merge request reports