Repository navigation
feat(agc): mipmapped 3D textures - #394
oneandonlydean merged 2 commits into
Conversation
|
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. |
|
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. |
|
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. |
3D textures with more than one mip level were refused. Each slab of blockDepth slices of a thick (SW_4KB_S / SW_64KB_S) volume now holds the whole mip chain, smallest level first and level 0 last, as 2D chains are laid out. A level's depth halves per level, so the texture loops skip the slices a level does not have. Thin 3D (D/R 64KB_X) chains use the 2D mip layout per depth slice. Thick mip tails still throw. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lib does addrlib sizes a non-tail level with ShiftCeil; the layout used the image's rounded-down extent, so volumes with a non-power-of-two width or height (33x20x12 in the new test) got a different layout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks for checking it against addrlib. I folded the fix in here (66a4625): 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 onto |
a8f91ac to
66a4625
Compare
3D textures in SW_4KB_S or SW_64KB_S whose smaller levels reach the mip
tail were refused ("3D texture mip tails are not implemented"). The
tail now follows addrlib's GFX10 thick layout
(Gfx10Lib::ComputeSurfaceInfoMacroTiled):
- a level enters the tail once its size, rounded up, fits the thick
tail extent (the block with its height halved for 4 KiB blocks and
its width halved for 64 KiB blocks) and at most GetMaxNumMipsInTail
levels remain (5 for 4 KiB, 10 for 64 KiB);
- each slab starts with one tail block, then the other levels from the
smallest to level 0;
- tail level i sits in slot maxMipsInTail - 1 - i, at the element offset
addrlib derives from that slot's byte offset and the 256-byte thick
micro block, at every depth slice.
Levels outside the tail are padded from their rounded-up size, as
addrlib's GetMipSize does; this changes the layout only for sizes that
are not powers of two.
The tests check element addresses of five volumes (4 KiB and 64 KiB
blocks, 1 to 16 bytes per element, odd sizes, a chain that starts in
the tail) against Mesa addrlib's Addr2ComputeSurfaceAddrFromCoord for
a Navi10 configuration.
(cherry picked from commit 0e531c1)
integ: boykopovar#394 now carries 66a4625 (levels padded from their rounded-up
size), which this branch already took through the follow-up; the
follow-up is rebased over it: same ComputeThickLayout, boykopovar#394's 33x20x12
padding test kept, its 8x8x8 tail refusal test dropped (tails are now
laid out).
Takes the 13 gate-batch PRs that merged upstream (boykopovar#319 boykopovar#329 boykopovar#330 boykopovar#331 boykopovar#325 boykopovar#435 boykopovar#471 boykopovar#294 boykopovar#376 boykopovar#404 boykopovar#394 boykopovar#401 boykopovar#446) in place of astrobot's local versions, as integ/gate-batch cab0eab had them: boykopovar#294 and boykopovar#376 in astrobot's depth model (DepthTarget, state.depth), boykopovar#394 with the thick mip tails, boykopovar#401 over astrobot's slab pool, boykopovar#471 keeping the settled single-lane path. Also takes the rest of main since a818bee (boykopovar#532 boykopovar#340 boykopovar#486 boykopovar#484 boykopovar#316 boykopovar#243 boykopovar#334 boykopovar#434 boykopovar#437 boykopovar#470 boykopovar#373 boykopovar#452 boykopovar#455 and our upstreamed PRs, where astrobot keeps its later revisions and env switches). Resolution notes: relinker converter/matcher/tests are upstream's (boykopovar#432 decoder covers VEX RIP-relative followers); RecompileResult gains boykopovar#316's hostSubgroupSize (set from request.target.subgroupSize); shader disk cache format 9; boykopovar#452's scissor message; upstream's later live-stack and memory-copy decode tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mgp3oZvembQziVNE2xARQK
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