Skip to content

freedreno, turnip: Force gl_Layer to 0 in the FS when necessary

Connor Abbott requested to merge cwabbott0/mesa:review/ir3-layer-zero into master

I ran into this when trying to switch nir_lower_input_attachments to use gl_Layer as an input. We had a hack in turnip to force load_layer_id to 0, but once switching to load_input we starting trying to actually load the layer, except that we didn't force it to 0 when layered rendering was disabled, so it broke input attachments with non-layered (normal) rendering.

I went the approach of using a shader variant, but we could also force it to 0 afterwards with VPC_VARYING_PS_REPL. I thought the better code generated in the common case (input attachments with non-layered rendering) beats the unlikely possibility of extra variants on gallium, but I could be persuaded otherwise.

Edited by Connor Abbott

Merge request reports