fix(agc): XOR overlapping R_X coordinate contributions

This commit is contained in:
MarcZX100 2026-10-11 11:49:23 +00:00
parent a6cb65e481
commit 8a390b06df
2 changed files with 3 additions and 1 deletions

View File

@ -156,7 +156,7 @@ std::size_t ColorTargetLayout::offset(std::uint32_t x, std::uint32_t y) const {
const auto highY = ((y & ~(blockHeight - 1u)) << 12u) & 0xfff000u;
for (std::uint32_t bit = 0; bit < 16u; ++bit) {
const auto coordinates = (highX & equation->bits[bit]) ^ (highY & equation->bits[bit]);
inBlock |= (parity(coordinates) << bit);
inBlock ^= (parity(coordinates) << bit);
}
}
return block * Alignment() + (inBlock ^ pipeBankXor);

View File

@ -55,6 +55,8 @@ void RunColorTargetLayoutTests() {
const ColorTargetLayout r128(129, 67, ColorTileMode::RenderTarget, 16);
Require(r64.Offset(0, 64) == 67584, "64 bpp SW_64KB_R_X dropped a cross-block y-coordinate XOR bit");
Require(r128.Offset(64, 0) == 66560, "128 bpp SW_64KB_R_X dropped a cross-block x-coordinate XOR bit");
Require(r64.Offset(32, 64) == 65536, "64 bpp SW_64KB_R_X did not XOR overlapping coordinate contributions");
Require(r128.Offset(32, 64) == 3 * 65536, "128 bpp SW_64KB_R_X did not XOR overlapping coordinate contributions");
Require(DecodeColorTileMode(0x4dc14000) == ColorTileMode::Standard4KB, "4 KiB standard color descriptor was rejected");
const ColorTargetLayout standard(256, 256, ColorTileMode::Standard4KB);
Require(standard.Bytes() == ComputeSurfaceSize(ComputeElementMipLayout(TextureTileMode::kStandard4KB, 4, 256, 256, 1), 1) && standard.Alignment() == 4096, "4 KiB standard color layout differs from the texture layout");