Module: Mesa Branch: main Commit: e507d703339eeaa0966e77b827f82ac09bb60a79 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e507d703339eeaa0966e77b827f82ac09bb60a79
Author: Faith Ekstrand <faith.ekstr...@collabora.com> Date: Tue Nov 14 10:49:29 2023 -0600 nvk: Handle load_first_vertex in nvk_nir_lower_descriptors() Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197> --- src/nouveau/vulkan/nvk_nir_lower_descriptors.c | 1 + src/nouveau/vulkan/nvk_shader.c | 27 -------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/nouveau/vulkan/nvk_nir_lower_descriptors.c b/src/nouveau/vulkan/nvk_nir_lower_descriptors.c index cb313673d56..e2a29f77e0b 100644 --- a/src/nouveau/vulkan/nvk_nir_lower_descriptors.c +++ b/src/nouveau/vulkan/nvk_nir_lower_descriptors.c @@ -336,6 +336,7 @@ try_lower_intrin(nir_builder *b, nir_intrinsic_instr *intrin, return lower_load_push_constant(b, intrin, ctx); case nir_intrinsic_load_base_vertex: + case nir_intrinsic_load_first_vertex: return lower_sysval_to_root_table(b, intrin, draw.base_vertex, ctx); case nir_intrinsic_load_base_instance: diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index e1d8ea7ea7c..b4a86ef23f9 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -323,26 +323,6 @@ lower_fragcoord_instr(nir_builder *b, nir_instr *instr, UNUSED void *_data) return true; } -static bool -lower_system_value_first_vertex(nir_builder *b, nir_instr *instr, UNUSED void *_data) -{ - assert(b->shader->info.stage == MESA_SHADER_VERTEX); - - if (instr->type != nir_instr_type_intrinsic) - return false; - - nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); - - if (intrin->intrinsic != nir_intrinsic_load_first_vertex) - return false; - - b->cursor = nir_before_instr(&intrin->instr); - nir_def *base_vertex = nir_load_base_vertex(b); - nir_def_rewrite_uses(&intrin->def, base_vertex); - - return true; -} - static int count_location_slots(const struct glsl_type *type, bool bindless) { @@ -538,13 +518,6 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, NIR_PASS(_, nir, nir_remove_dead_variables, nir_var_function_temp, NULL); NIR_PASS(_, nir, nir_lower_system_values); - if (nir->info.stage == MESA_SHADER_VERTEX) { - // codegen does not support SYSTEM_VALUE_FIRST_VERTEX - NIR_PASS(_, nir, nir_shader_instructions_pass, - lower_system_value_first_vertex, - nir_metadata_block_index | nir_metadata_dominance, NULL); - } - if (nir->info.stage == MESA_SHADER_FRAGMENT) { if (!use_nak(pdev, nir->info.stage)) { NIR_PASS(_, nir, nir_shader_instructions_pass, lower_fragcoord_instr,