radeonsi: fix initialization of occlusion query buffers for disabled RBs

GFX9+ should assume the enabled RB results are packed (no holes).
Same as PAL.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28725>
This commit is contained in:
Marek Olšák
2024-04-01 23:59:44 -04:00
committed by Marge Bot
parent aad2302cf5
commit dab4295cd5

View File

@@ -589,20 +589,32 @@ static bool si_query_hw_prepare_buffer(struct si_context *sctx, struct si_query_
query->b.type == PIPE_QUERY_OCCLUSION_PREDICATE ||
query->b.type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE) {
unsigned max_rbs = screen->info.max_render_backends;
uint64_t enabled_rb_mask = screen->info.enabled_rb_mask;
unsigned num_results;
unsigned i, j;
unsigned num_results = qbuf->buf->b.b.width0 / query->result_size;
/* Set top bits for unused backends. */
num_results = qbuf->buf->b.b.width0 / query->result_size;
for (j = 0; j < num_results; j++) {
for (i = 0; i < max_rbs; i++) {
if (!(enabled_rb_mask & (1ull << i))) {
if (screen->info.gfx_level >= GFX9) {
unsigned num_rbs = screen->info.num_rb;
for (unsigned j = 0; j < num_results; j++) {
/* Results of enabled RBs are packed, so the disabled ones are always at the end. */
for (unsigned i = num_rbs; i < max_rbs; i++) {
results[(i * 4) + 1] = 0x80000000;
results[(i * 4) + 3] = 0x80000000;
}
results += 4 * max_rbs;
}
} else {
uint64_t enabled_rb_mask = screen->info.enabled_rb_mask;
/* Set top bits for unused backends. */
for (unsigned j = 0; j < num_results; j++) {
for (unsigned i = 0; i < max_rbs; i++) {
if (!(enabled_rb_mask & (1ull << i))) {
results[(i * 4) + 1] = 0x80000000;
results[(i * 4) + 3] = 0x80000000;
}
}
results += 4 * max_rbs;
}
results += 4 * max_rbs;
}
}