From 8d7603a1f10f16a70ab0484dcb0fe17addbe17df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Thu, 10 Mar 2022 12:05:52 +0100 Subject: [PATCH] shader: Make sure that we are not mixing generic and patch variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is possible for two variable to have the same sid and array_id as long as they have a different name. Make sure that we are not considering them as two components. Also fix the already_found_one variable define in the loop when we need it to persist between iterations. Signed-off-by: Corentin Noël Part-of: --- src/vrend_shader.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 8bc265b..a39c093 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -4874,13 +4874,14 @@ static bool apply_prev_layout(const struct vrend_shader_key *key, if (io->name == TGSI_SEMANTIC_GENERIC || io->name == TGSI_SEMANTIC_PATCH) { + bool already_found_one = false; const struct vrend_layout_info *layout = key->prev_stage_generic_and_patch_outputs_layout; for (unsigned generic_index = 0; generic_index < key->input.num_generic_and_patch; ++generic_index, ++layout) { - bool already_found_one = false; - /* Identify by sid and arrays_id */ - if (io->sid == layout->sid && (io->array_id == layout->array_id)) { + if (io->sid == layout->sid && + (io->array_id == layout->array_id) && + (io->name == layout->name)) { /* We have already one IO with the same SID and arrays ID, so we need to duplicate it */ if (already_found_one) {