shader: Make sure that we are not mixing generic and patch variables

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 <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/736>
macos/master
Corentin Noël 3 years ago committed by Marge Bot
parent 06774da36f
commit 8d7603a1f1
  1. 7
      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) { 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; 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) { 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 */ /* 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 */ /* We have already one IO with the same SID and arrays ID, so we need to duplicate it */
if (already_found_one) { if (already_found_one) {

Loading…
Cancel
Save