From 8e99a7f5e30370b7966dd3f470bcff534c3143ab Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 19 Jul 2022 19:20:38 -0500 Subject: [PATCH] vulkan: Call gather_xfb_info in vk_spirv_to_nir In particular, we now call it before running dead variables so we get the XFB info even for things which are never written. This fixes a 102 Vulkan CTS tests on ANV and probably turnip as well. Reviewed-By: Mike Blumenkrantz Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_pipeline.c | 5 ----- src/vulkan/runtime/vk_nir.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 453760a5f7e..9b73c3e00d2 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -789,11 +789,6 @@ anv_pipeline_lower_nir(struct anv_pipeline *pipeline, gl_shader_stage_is_mesh(nir->info.stage)) NIR_PASS(_, nir, brw_nir_lower_cs_intrinsics); - if (nir->info.stage == MESA_SHADER_VERTEX || - nir->info.stage == MESA_SHADER_TESS_EVAL || - nir->info.stage == MESA_SHADER_GEOMETRY) - NIR_PASS_V(nir, nir_shader_gather_xfb_info); - stage->nir = nir; } diff --git a/src/vulkan/runtime/vk_nir.c b/src/vulkan/runtime/vk_nir.c index 1474630e793..8000b94034e 100644 --- a/src/vulkan/runtime/vk_nir.c +++ b/src/vulkan/runtime/vk_nir.c @@ -24,6 +24,7 @@ #include "vk_nir.h" +#include "compiler/nir/nir_xfb_info.h" #include "compiler/spirv/nir_spirv.h" #include "vk_log.h" #include "vk_util.h" @@ -151,6 +152,11 @@ vk_spirv_to_nir(struct vk_device *device, */ NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays); + if (nir->info.stage == MESA_SHADER_VERTEX || + nir->info.stage == MESA_SHADER_TESS_EVAL || + nir->info.stage == MESA_SHADER_GEOMETRY) + NIR_PASS_V(nir, nir_shader_gather_xfb_info); + NIR_PASS_V(nir, nir_propagate_invariant, false); return nir;