From 56c9b038432ad40849f82155d9b22bf930d8eef4 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Mon, 9 May 2022 15:42:18 +0530 Subject: [PATCH] Fix incorrect swizzling Y extent calculation This calculation for the amount of lines on the Y axis relative to the start of the last block was wrong and would instead determine the amount of lines to the last Y-axis GOB which wasn't accurate when padding was considered, this resulted in titles like Celeste having broken texture decoding (on a 1922x1082 texture) for the last ROB as most pixels would be masked out. --- app/src/main/cpp/skyline/gpu/texture/layout.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/texture/layout.h b/app/src/main/cpp/skyline/gpu/texture/layout.h index 302688ab..c3ceacf8 100644 --- a/app/src/main/cpp/skyline/gpu/texture/layout.h +++ b/app/src/main/cpp/skyline/gpu/texture/layout.h @@ -99,9 +99,9 @@ namespace skyline::gpu::texture { } if (surfaceHeightLines % robHeight != 0) { - blockHeight = (util::AlignUp(surfaceHeightLines, GobHeight) - (surfaceHeightRobs * robHeight)) / GobHeight; // Calculate the amount of Y GOBs which aren't padding - u32 surfaceHeightLinesCeil{util::DivideCeil(guest.dimensions.height, u32{guest.format->blockHeight})}; - deswizzleRob(linearRob, std::true_type{}, (guest.tileConfig.blockHeight - blockHeight) * (SectorWidth * SectorWidth * SectorHeight), surfaceHeightLinesCeil - util::AlignDown(surfaceHeightLinesCeil, GobHeight)); + u32 robOffsetLines{surfaceHeightRobs * robHeight}; + blockHeight = (util::AlignUp(surfaceHeightLines, GobHeight) - robOffsetLines) / GobHeight; // Calculate the amount of Y GOBs which aren't padding + deswizzleRob(linearRob, std::true_type{}, (guest.tileConfig.blockHeight - blockHeight) * (SectorWidth * SectorWidth * SectorHeight), util::DivideCeil(guest.dimensions.height, u32{guest.format->blockHeight}) - robOffsetLines); } }