tu: Force gl_Layer to 0 when necessary
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 3 Jul 2020 10:03:00 +0000 (12:03 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 08:10:47 +0000 (08:10 +0000)
In particular this will help us implement input attachments correctly
with layered rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5732>

src/freedreno/vulkan/tu_pipeline.c

index 965aa34209f03b6b3e1d5d6f295a41e15dde8f7b..4a21a1514eed63234c32a9997d9e6daeb12352b1 100644 (file)
@@ -1977,6 +1977,10 @@ tu_pipeline_builder_compile_shaders(struct tu_pipeline_builder *builder,
       builder->shaders[stage] = shader;
    }
 
+   struct tu_shader *gs = builder->shaders[MESA_SHADER_GEOMETRY];
+   key.layer_zero =
+      !gs || !(gs->ir3_shader->nir->info.outputs_written & VARYING_SLOT_LAYER);
+
    pipeline->tess.patch_type = key.tessellation;
 
    for (gl_shader_stage stage = MESA_SHADER_VERTEX;