From 5bbbf5cf9ba1764277115db8453a8ace41d3fa87 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 20 Nov 2025 17:30:58 -0500 Subject: [PATCH] tu: Set use_layer_id_sysval for nir_lower_input_attachments We can just use nir_lower_sysvals_to_varyings instead. Reviewed-by: Alyssa Rosenzweig Reviewed-by: Emma Anholt Part-of: --- src/freedreno/vulkan/tu_shader.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/freedreno/vulkan/tu_shader.cc b/src/freedreno/vulkan/tu_shader.cc index 4d179f8a06d..437a4e20aa5 100644 --- a/src/freedreno/vulkan/tu_shader.cc +++ b/src/freedreno/vulkan/tu_shader.cc @@ -2782,7 +2782,7 @@ tu_shader_create(struct tu_device *dev, if (nir->info.stage == MESA_SHADER_FRAGMENT) { const nir_input_attachment_options att_options = { .use_fragcoord_sysval = true, - .use_layer_id_sysval = false, + .use_layer_id_sysval = true, /* When using multiview rendering, we must use * gl_ViewIndex as the layer id to pass to the texture * sampling function. gl_Layer doesn't work when @@ -2797,6 +2797,12 @@ tu_shader_create(struct tu_device *dev, key->unscaled_input_fragcoord, }; NIR_PASS(_, nir, nir_lower_input_attachments, &att_options); + + const nir_lower_sysvals_to_varyings_options sysval_options = { + .layer_id = true, + .view_index = true, + }; + NIR_PASS(_, nir, nir_lower_sysvals_to_varyings, &sysval_options); } /* This has to happen before lower_input_attachments, because we have to