From 4bdbc4c93f1a010ef2bea376994ee2c64ca1fb29 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 18 Jul 2022 10:45:53 -0500 Subject: [PATCH] anv: Decouple primitive replication check from the fragment shader Now that we're using nir_intrinsic_load_layer_id for ViewIndex, we can use primitive replication even when the FS uses ViewIndex. Also, only check that active_stages doesn't contain anything other than VS and FS, not that it's exactly VS | FS. This both decouples things more and allows primitive rplication in the depth-only case where we have no fragment shader at all. Reviewed-by: Lionel Landwerlin Reviewed-by: Caio Oliveira Part-of: --- src/intel/vulkan/anv_nir_lower_multiview.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/intel/vulkan/anv_nir_lower_multiview.c b/src/intel/vulkan/anv_nir_lower_multiview.c index fbadb80..3272b2f 100644 --- a/src/intel/vulkan/anv_nir_lower_multiview.c +++ b/src/intel/vulkan/anv_nir_lower_multiview.c @@ -312,19 +312,14 @@ anv_check_for_primitive_replication(nir_shader **shaders, * later than Vertex. In that case only the last stage can refer to * gl_ViewIndex. */ - if (pipeline->active_stages != (VK_SHADER_STAGE_VERTEX_BIT | - VK_SHADER_STAGE_FRAGMENT_BIT)) { + if (pipeline->active_stages & ~(VK_SHADER_STAGE_VERTEX_BIT | + VK_SHADER_STAGE_FRAGMENT_BIT)) return false; - } uint32_t view_mask = pipeline->view_mask; int view_count = util_bitcount(view_mask); if (view_count == 1 || view_count > primitive_replication_max_views) return false; - /* We can't access the view index in the fragment shader. */ - if (nir_shader_uses_view_index(shaders[MESA_SHADER_FRAGMENT])) - return false; - return nir_can_lower_multiview(shaders[MESA_SHADER_VERTEX]); } -- 2.7.4