diff options
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_compiler.c | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/.pick_status.json b/.pick_status.json index e1ce9afa029..1bd41da685d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -12196,7 +12196,7 @@ "description": "zink: fix xfb analysis variable finding for arrays", "nominated": true, "nomination_type": 0, - "resolution": 5, + "resolution": 1, "because_sha": null }, { diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 099434a698d..89b319a6ab6 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -558,13 +558,15 @@ check_psiz(struct nir_shader *s) } static nir_variable * -find_var_with_location_frac(nir_shader *nir, unsigned location, unsigned location_frac) +find_var_with_location_frac(nir_shader *nir, unsigned location, unsigned location_frac, bool have_psiz) { nir_foreach_shader_out_variable(var, nir) { if (var->data.location == location && (var->data.location_frac == location_frac || - glsl_get_vector_elements(var->type) >= location_frac + 1)) - return var; + (glsl_type_is_array(var->type) ? glsl_array_size(var->type) : glsl_get_vector_elements(var->type)) >= location_frac + 1)) { + if (location != VARYING_SLOT_PSIZ || !have_psiz || var->data.explicit_location) + return var; + } } return NULL; } @@ -610,7 +612,7 @@ update_so_info(struct zink_shader *zs, const struct pipe_stream_output_info *so_ if (zs->nir->info.stage != MESA_SHADER_GEOMETRY || util_bitcount(zs->nir->info.gs.active_stream_mask) == 1) { nir_variable *var = NULL; while (!var) - var = find_var_with_location_frac(zs->nir, slot--, output->start_component); + var = find_var_with_location_frac(zs->nir, slot--, output->start_component, have_psiz); slot++; if (is_inlined(inlined[slot], output)) continue; @@ -644,7 +646,7 @@ update_so_info(struct zink_shader *zs, const struct pipe_stream_output_info *so_ if (zs->nir->info.stage != MESA_SHADER_GEOMETRY || util_bitcount(zs->nir->info.gs.active_stream_mask) == 1) { nir_variable *var = NULL; while (!var) - var = find_var_with_location_frac(zs->nir, slot--, output->start_component); + var = find_var_with_location_frac(zs->nir, slot--, output->start_component, have_psiz); slot++; /* if this was flagged as a packed output before, and if all the components are * being output with the same stream on the same buffer, this entire variable |