diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 2b0f8af42cc..4d222910162 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -181,9 +181,9 @@ nir_remove_unused_io_vars(nir_shader *shader, else used = used_by_other_stage; - if (var->data.location < VARYING_SLOT_VAR0 && var->data.location >= 0) - if (shader->info.stage != MESA_SHADER_MESH || var->data.location != VARYING_SLOT_PRIMITIVE_ID) - continue; + if (var->data.location < VARYING_SLOT_VAR0 && var->data.location >= 0 && + !(shader->info.stage == MESA_SHADER_MESH && var->data.location == VARYING_SLOT_PRIMITIVE_ID)) + continue; if (var->data.always_active_io) continue;