zink: fix variable locations in manual xfb emission

the last output isn't always only consuming 1 slot, so ensure that the
xfb outputs begin at the appropriate place

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16669>
(cherry picked from commit e9d28cbe3f)
This commit is contained in:
Mike Blumenkrantz 2022-05-21 18:53:59 -04:00 committed by Dylan Baker
parent 274fcc2783
commit 692375bf9d
2 changed files with 5 additions and 4 deletions

View file

@ -895,7 +895,7 @@
"description": "zink: fix variable locations in manual xfb emission",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -4068,18 +4068,19 @@ nir_to_spirv(struct nir_shader *s, const struct zink_shader_info *sinfo, uint32_
nir_foreach_shader_in_variable(var, s)
emit_input(&ctx, var);
int max_output = -1;
int max_output = 0;
nir_foreach_shader_out_variable(var, s) {
/* ignore SPIR-V built-ins, tagged with a sentinel value */
if (var->data.driver_location != UINT_MAX) {
assert(var->data.driver_location < INT_MAX);
max_output = MAX2(max_output, (int)var->data.driver_location);
unsigned extent = glsl_count_attribute_slots(var->type, false);
max_output = MAX2(max_output, (int)var->data.driver_location + extent);
}
emit_output(&ctx, var);
}
if (sinfo->last_vertex)
emit_so_info(&ctx, sinfo, max_output + 1);
emit_so_info(&ctx, sinfo, max_output);
uint32_t tcs_vertices_out_word = 0;
/* we have to reverse iterate to match what's done in zink_compiler.c */