From 845e7d29117fcfbac98901a49269608be899a612 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 14 Nov 2023 11:38:37 -0600 Subject: [PATCH] nvk: Only lower outputs to temporaries Also, move it up to right after we parse the SPIR-V and remove some now unnecessary clean-up passes. Part-of: --- src/nouveau/vulkan/nvk_shader.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index b4a86ef23f9..35eb77785b8 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -481,6 +481,9 @@ nvk_shader_stage_to_nir(struct nvk_device *dev, if (result != VK_SUCCESS) return result; + NIR_PASS_V(nir, nir_lower_io_to_temporaries, + nir_shader_get_entrypoint(nir), true, false); + if (use_nak(dev->pdev, nir->info.stage)) nak_preprocess_nir(nir, NULL); @@ -542,19 +545,6 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, /* Vulkan uses the separate-shader linking model */ nir->info.separate_shader = true; - if (nir->info.stage == MESA_SHADER_VERTEX || - nir->info.stage == MESA_SHADER_GEOMETRY || - nir->info.stage == MESA_SHADER_FRAGMENT) { - NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, true); - } else if (nir->info.stage == MESA_SHADER_TESS_EVAL) { - NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, false); - } - NIR_PASS(_, nir, nir_split_var_copies); - - NIR_PASS(_, nir, nir_lower_global_vars_to_local); - NIR_PASS(_, nir, nir_remove_dead_variables, nir_var_function_temp, NULL); - - nvk_optimize_nir(nir); NIR_PASS(_, nir, nir_lower_var_copies);