From 1929bb0d8d88a63f2cdaedef41c7bc44c4b8e008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 16 Apr 2024 15:11:54 -0400 Subject: [PATCH] radeonsi: validate IO semantics in scan_io_usage Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shader_info.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c index e446ac081df..2e12be9ed62 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/si_shader_info.c @@ -320,6 +320,20 @@ static void scan_io_usage(const nir_shader *nir, struct si_shader_info *info, for (unsigned i = 0; i < num_slots; i++) { unsigned loc = driver_location + i; + /* Call the translation functions to validate the semantic (call assertions in them). */ + if (nir->info.stage != MESA_SHADER_FRAGMENT && + semantic != VARYING_SLOT_EDGE) { + if (semantic == VARYING_SLOT_TESS_LEVEL_INNER || + semantic == VARYING_SLOT_TESS_LEVEL_OUTER || + (semantic >= VARYING_SLOT_PATCH0 && semantic <= VARYING_SLOT_PATCH31)) { + ac_shader_io_get_unique_index_patch(semantic); + ac_shader_io_get_unique_index_patch(semantic + i); + } else { + si_shader_io_get_unique_index(semantic); + si_shader_io_get_unique_index(semantic + i); + } + } + info->output_semantic[loc] = semantic + i; if (is_output_load) {