Module: Mesa Branch: main Commit: 845e7d29117fcfbac98901a49269608be899a612 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=845e7d29117fcfbac98901a49269608be899a612
Author: Faith Ekstrand <[email protected]> Date: Tue Nov 14 11:38:37 2023 -0600 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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197> --- 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);
