fix(agc): use gfx1013's smaller mip tail limits for 8 and 16 bpp SW_64KB_Z_X #1639
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1639"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by gerardlesan on 2026-10-08T15:24:42Z.
What
GetMipTailLayoutgaveSW_64KB_Z_Xthe same mip tail limits as the other 64 KiB modes. In addrlib that is only the case on Navi10. On every other GFX10 chip, including the PS5's gfx1013, addrlib uses smaller limits for 8 and 16 bpp Z-order surfaces. As a result, mipmapped 8 and 16 bppZ_Xtextures (D16 depth, R8, R16, R8G8 and so on) started their tail too early, and every level was read and written back at the wrong offset.Source, Mesa
src/amd/addrlib/src/gfx10/gfx10addrlib.cppatd778ede7:HwlConvertChipFamily(L1003-1010) setsdsMipmapHtileFixand clears it only for Navi10.ComputeSurfaceInfoMacroTiled(L3923-3926): with the setting on, for a Z-order swizzle at 8 or 16 bpp, the tail limits are divided byBlock256_2d[index] / Block256_2d[2]. That halves the width at 8 and 16 bpp, and also the height at 8 bpp.GetMipTailLayoutnow halves the limits the same way. Only the level where the tail starts changes. The tail slot positions stay the same, because addrlib computes them from each level's index inside the tail, not from the limits (L3999-4001).Results from #1590,
SW_64KB_Z_X8 bpp 256x256, 9 levels:For 16 bpp 128x128 with a full mip chain, mip 0 now starts at 0x10000, as in addrlib, instead of 0x8000.
This follows addrlib's setting for gfx1013. The console's own layout has not been measured, as #1590 also notes.
Fixes #1590
Tested
CachyOS Linux (kernel 7.2.9), GCC 16.2.1, CMake 4.4.4, Ninja, Release with
BUILD_TESTING=ON, onmainf8c2f072. No GPU was needed:agc_driver_graphicsruns againstMockVulkan.agc_driver_graphicsgets two new cases: 8 bpp 256x256 with 9 levels, and 16 bpp 128x128 with 8 levels.swizzle mode 24, 1 bytes, 256x256, 9 levels, 1 slices: surface or slice size differs from addrlib.agc_driver_dcc_keys_first_write(an unchanged pending image was uploaded again), fails the same way onmainwithout this change.python3 tools/check_conventions.py --base origin/main: all checks passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T15:32:06Z.
Review: APPROVED
LGTM. Well-researched fix that correctly applies gfx1013's smaller mip tail limits for 8 and 16 bpp SW_64KB_Z_X textures, matching Mesa addrlib behavior. The block size ratio calculation is correct, and the test cases with specific surface sizes and first-tail-mip levels provide good validation against known-good reference values. Good documentation of the issue and fix rationale.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:22:24Z.
Please drop the merge commit (d6c57f4) and rebase onto main instead; the branch history has to stay linear. The fix itself is fine.
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:22:46Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
d6c57f46, merged ontomaind70b8998in one build with 33 other AGC/shader PRs that had no Windows run.agc_driver_graphics. None of them reported skipping a case.PATHsetup.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by gerardlesan on 2026-10-09T18:18:05Z.
@oneandonlydean Dropped the merge commit and rebased onto
main(f8c2f072). The branch is now the single commitb6a95307.