From e70a2148e52b2c4dda9522750766e720f8ba4efb Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Mon, 10 Oct 2022 16:18:13 +0200 Subject: [PATCH] tu: Do not DCE unused output vars used for transform feedback Fixes CTS tests: dEQP-VK.transform_feedback.simple.multiquery_omit_write_1 dEQP-VK.transform_feedback.simple.multiquery_omit_write_3 Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/vulkan/tu_pipeline.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 0dcb1811e56..2581ed8a4cc 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -2694,6 +2694,12 @@ tu_append_executable(struct tu_pipeline *pipeline, struct ir3_shader_variant *va util_dynarray_append(&pipeline->executables, struct tu_pipeline_executable, exe); } +static bool +can_remove_out_var(nir_variable *var, void *data) +{ + return !var->data.explicit_xfb_buffer && !var->data.explicit_xfb_stride; +} + static void tu_link_shaders(struct tu_pipeline_builder *builder, nir_shader **shaders, unsigned shaders_count) @@ -2716,7 +2722,11 @@ tu_link_shaders(struct tu_pipeline_builder *builder, NIR_PASS_V(consumer, nir_opt_dce); } - NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out, NULL); + const nir_remove_dead_variables_options out_var_opts = { + .can_remove_var = can_remove_out_var, + }; + NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out, &out_var_opts); + NIR_PASS_V(consumer, nir_remove_dead_variables, nir_var_shader_in, NULL); bool progress = nir_remove_unused_varyings(producer, consumer);