radv: Use buffers_written mask when gathering XFB info.

We need to enable these buffers regardless of whether or not the
shader actually writes any outputs to them, otherwise we break
XFB queries.

Cc: mesa-stable
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34317>
(cherry picked from commit 15d0804670)
This commit is contained in:
Timur Kristóf 2025-04-01 12:35:30 +02:00 committed by Eric Engestrom
parent 085ae2607f
commit 6ebea60d73
2 changed files with 4 additions and 8 deletions

View file

@ -584,7 +584,7 @@
"description": "radv: Use buffers_written mask when gathering XFB info.",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -375,14 +375,10 @@ gather_xfb_info(const nir_shader *nir, struct radv_shader_info *info)
assert(xfb->output_count <= MAX_SO_OUTPUTS);
so->num_outputs = xfb->output_count;
for (unsigned i = 0; i < xfb->output_count; i++) {
unsigned output_buffer = xfb->outputs[i].buffer;
unsigned stream = xfb->buffer_to_stream[xfb->outputs[i].buffer];
u_foreach_bit(output_buffer, xfb->buffers_written) {
unsigned stream = xfb->buffer_to_stream[output_buffer];
so->enabled_stream_buffers_mask |= (1 << output_buffer) << (stream * 4);
}
for (unsigned i = 0; i < NIR_MAX_XFB_BUFFERS; i++) {
so->strides[i] = xfb->buffers[i].stride / 4;
so->strides[output_buffer] = xfb->buffers[output_buffer].stride / 4;
}
}