asahi: add missing tib alignment check

+ unit test replicating issue.

Fixes arb_sample_shading-builtin-gl-sample-mask-mrt-alpha-to-coverage

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26963>
This commit is contained in:
Alyssa Rosenzweig
2024-01-07 12:08:43 -04:00
parent dd42bf84a3
commit 344ec42587
2 changed files with 27 additions and 4 deletions

View File

@@ -91,9 +91,9 @@ agx_build_tilebuffer_layout(enum pipe_format *formats, uint8_t nr_cbufs,
* TODO: Suboptimal, we might be able to reorder render targets to
* avoid fragmentation causing spilling.
*/
bool fits =
(new_offset_B <= MAX_BYTES_PER_SAMPLE) &&
(new_offset_B * MIN_TILE_SIZE_PX * nr_samples) <= MAX_BYTES_PER_TILE;
bool fits = (new_offset_B <= MAX_BYTES_PER_SAMPLE) &&
(ALIGN_POT(new_offset_B, 8) * MIN_TILE_SIZE_PX *
nr_samples) <= MAX_BYTES_PER_TILE;
if (fits) {
tib._offset_B[rt] = offset_B;

View File

@@ -128,7 +128,30 @@ struct test tests[] = {
.tile_size = { 32, 32 },
},
8192
}
},
{
"MRT test that requires spilling to consider alignment requirements",
4,
{
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
PIPE_FORMAT_R32_FLOAT,
},
{
.spilled = { false, false, false, false, false, false, true, true },
._offset_B = { 0, 4, 8, 12, 16, 20, 0, 0},
.sample_size_B = 24,
.nr_samples = 4,
.tile_size = { 16, 16 },
},
24576
},
};
/* clang-format on */