feat(agc): mipmapped 3D textures #394
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/394"
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 MichonGoddijn231849 on 2026-10-02T17:51:16Z.
What
3D textures with more than one mip level were refused ("mipmapped 3D textures are not implemented").
blockDepthslices holds the whole mip chain. The smallest level comes first and level 0 last, the order 2D chains use. A level's width and height are padded to the 3D block, and the slab stride is the size of the whole chain. A level hasmax(depth >> level, 1)slices, so it uses only the first slabs.SurfaceGeometry::HasLayer(level, layer)tells the texture upload, write-back and copy loops which depth slices a level has. For anything that is not 3D, and for single-mip 3D textures, it is always true.GTA V's character shaders sample a 64x64x32 RGBA8 volume in SW_4KB_S with 3 levels. Every character draw into the G-buffer was skipped, about 900 every 10 s in the Prologue, so only the characters' eyes rendered. With this PR the characters render.
Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
ctest: all tests pass. A new tiling test covers the slab layout of a 3-level SW_4KB_S volume, the per-level depth and the tail refusal.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T06:28:27Z.
This refuses 3D textures whose mips reach the mip tail. My integration branch has the thick (3D) mip tail layout, with tests checked against addrlib's Navi10 output. I can send it as a follow-up once this lands, if that's useful.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-03T08:43:26Z.
Yes please, a follow-up with the thick mip tail would be useful; checking it against addrlib's Navi10 output is better than anything I'd have done here. I'll leave this PR refusing the tail until then.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T07:43:52Z.
While preparing the thick-tail follow-up I checked #394's 3D layout against addrlib (Navi10, built from Mesa e5f06878): the non-tail levels are padded to the rounded-down level size, but addrlib rounds up, so any volume whose width or height isn't a power of two gets a different layout (33x20x12 is one; 50 of 680 test volumes differed). Rounding the padded level size up matches addrlib on all of them. Happy to fold it into the follow-up instead if you'd rather keep this PR as is.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-04T08:30:52Z.
Thanks for checking it against addrlib. I folded the fix in here (
66a46259): a tiled level's padding now comes from its size rounded up (ShiftCeil), while the image extents stay rounded down. Linear layouts are unchanged. The test adds a 33x20x12 volume in 4 KiB thick blocks, where level 1 is padded from 17 texels (3 blocks per row, not 2). I also rebased ontomain.