fix(agc): round linear volume mip extents up as addrlib does #1602
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1602"
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 kr4y4 on 2026-10-08T14:07:20Z.
What
ComputeThickLayoutsizes the mips of a linear 3D texture frommip.widthandmip.height, which round down (max(dim >> level, 1)). Its tiled modes, and the 2D linear path inComputeLinearMipLayout, use the rounded-up element extent (ShiftCeil). addrlib rounds up for linear as well: its linear mip loop callsGetMipSize(gfx10addrlib.cppL5090), which isShiftCeil(Max(mip0Width, 1u), mipId)(gfx10addrlib.hL376-377).For any level that halves an odd size, the row count, mip offsets and slice size therefore come out smaller than the guest's. Linear 8 bpp 100×60×8 with 4 levels:
The linear levels now use the same rounded-up extent as the tiled ones, for the pitch and for the level's rows. A test in
RunTextureTilingTestspins addrlib's values for that volume.How it was found: AnyPS5's
TextureTiling.cppwas compared against Mesa's addrlib, compiled unmodified and called throughAddr2ComputeSurfaceInfo/Addr2ComputeSurfaceAddrFromCoord. The config was gfx1013, revision 0x82, GB_ADDR_CONFIG 0x00100044 (16 pipes).Tested
Windows 11 (26200), WinLibs GCC 15.2.0 r7, CI configure flags, main at
63c57d22:agc_driver_graphics(includes the tiling tests) passes on an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. With the old rounding put back, it fails withlinear 8 bpp 100x60x8, 4 levels: slice size differs from addrlib.Checklist
main; no other open PR implements the same thing🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T23:06:46Z.
Linux results, since this was tested on Windows only. Everything passes here, including
agc_driver_graphicswith the new tiling checks.Nobara 44 (Linux 7.2), GCC 16.2.1, Release,
BUILD_TESTING=ON. PR head merged ontomain29e533ac.ctest -R agc_driver -j1CPU tests (
-E agc_driver): 286 / 287. The one failure isguest_dynamic_loader(subprocess aborted), which fails the same way onmain29e533ac.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T01:13:59Z.
Checked the addrlib reference (
GetMipSizeusesShiftCeil), built and ran the AGC driver tests, and confirmed the new check fails without the fix; CI is green and it doesn't conflict with #1609. Merging.