feat(texture): add GFX10 64 KiB tiling, XOR modes, mip tails, and 2D texture arrays (#14) #188
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!188
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/188/head"
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?
@Lewandox on GitHub · 2026-11-25 01:02 UTC · original
Lewandox:feat/texture-gfx10-64k-tiling→main· +1459 −25 · 9 files · 2 commits · closed without mergingSummary
Extends
rust/anyxboxx-texturebeyondSW_4K_Sto support GFX10 / RDNA 2 64 KiB tiling, XOR swizzle modes (_T,_X,R_X,Z_X), 4 KiB / 64 KiB mip tails, and 2D texture arrays (Issue #14).What changed
rust/anyxboxx-texture/src/gfx10_eq.rs:SwizzleMode(Linear,Sw256BS/D,Sw4KS/D,Sw64KS/D,Sw64KST/D_T,Sw4KSX/D_X,Sw64KSX/D_X,Sw64KRX,Sw64KZX) andPipeConfig(defaultSCARLETT16 pipes / 8 PKRs, plus general power-of-two pipe/PKR configs andeffective_pipe_bank_xor).Equation::for_mode) derived from AMD's public MIT Mesaaddrlib(src/amd/addrlib/src/gfx10/gfx10SwizzlePattern.h,gfx10addrlib.cpp), verified against all 900 RB+ entries acrossS/D/S_T/D_T/S_X/D_X(1..64 pipes, 1..32 PKRs, 1..16 BPE) plus the RB+ 16-pipe / 8-PKR tables forSW_64K_R_XandSW_64K_Z_X(1xAA).rust/anyxboxx-texture/src/gfx10.rs:SurfaceDesc/SurfaceLayout(ComputeThinBlockDimension,GetMipTailDim,GetMaxNumMipsInTail,IsInMipTailwithdsMipmapHtileFixforSW_64K_Z_X, smallest-first mip offsets, 4 KiB and 64 KiB mip tails up to 12 levels, and 2D texture array slicing).element_offset,detile_subresource, andtile_subresource.rust/anyxboxx-texture/src/tiles.rs&src/main.rs:SW_4K_Shelpers and--4k-sCLI flag unchanged.linearize_64k_s,linearize_64k_s_tail,linearize_bc7, and CLI options--64k-s,--mode <mode>,--xor <val>,--pipes <n>,--pkrs <n>,--mips <n>,--mip <i>,--array <n>,--slice <i>(rejecting unknown options explicitly).THIRD_PARTY.md& 9 READMEs:src/amd/addrlib(MIT) inTHIRD_PARTY.mdand updates the automated test count from658to660across all 9 READMEs.Verification
cargo build --release --manifest-path rust/Cargo.toml -p anyxboxx-texture— clean build (0 warnings).cargo test --release --manifest-path rust/Cargo.toml -p anyxboxx-texture— 13 passed, 0 failed (tests/bc7.rs: 5/5 unchanged digests;tests/gfx10_tiling.rs: 8/8 coveringSW_4K_Sparity,SW_64K_S, Mesa RB+ golden bit vectors, bijectivity across all 14 tiled modes × 5 BPEs × slices, 12-level 64 KiB mip tails, non-square XOR texture arrays, BC7 round-trip, and error paths).python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools— passed.python -m pytest -q— 459 passed, 201 skipped (tests/test_textures.py: 4/4 passed;tests/test_readme_sync.py: 660 tests synced across all 9 languages).Refs #14
@Yoshi-233 on GitHub · 2026-11-25 02:47 UTC · original
I ran the texture crate at the actual PR head
22c1cf973e7eon Ubuntu 24.04.5 x86-64 with Rust 1.98.1:All 8 new tiling tests and all 5 existing BC7 tests passed. In particular, the twelve mip-tail levels stayed disjoint and round-tripped, the legacy 4 KiB S path matched byte for byte, and the BC7 round-trip through a 64 KiB XOR-tiled array passed. These are CPU layout/codec results from synthetic fixtures.
@akimfomin on GitHub · 2026-11-25 03:02 UTC · original · edited 2026-11-25 04:17 UTC
Lewandox, I used PortBridge to try a follow-up on your exact
22c1cf9GFX10 copy path. The candidate reuses the X side of the address equation across rows and the Y side across columns. I compared detiling and the entire tiled backing against yourelement_offseton 104 generated layouts, including higher pipe bits, arrays and mip tails. All eight upstream GFX10 tests and our three targeted tests passed in both arms.On an i5-13600KF, four alternating warm CPU pairs for synthetic 1920×1080 RGBA8 XOR copies went from 35.62 → 2.51 ms for tiling and 36.34 → 3.71 ms for detiling. At 3840×2160 BC7 they went from 8.85 → 1.54 ms and 10.15 → 1.70 ms. A direct path kept the smallest mip copies near the old cost. All timed output hashes matched.
Patch, standalone fixture and raw pairs. These measure the generated texture copy on CPU, with the same input and output. No GPU or game-load effect was measured.
Separate BC7 export follow-up, source checked against main
b92a71b9and apply-checked on your22c1cf97head. The block decoder no longer allocates a vector for anchors, selects the weight tables once per block and copies visible rows into the image. The CPU output matched on 4,560 generated blocks and 400 image shapes. A 512-block image went from 513 allocations to 1. Four alternating warm CPU pairs measured 91.14 → 51.86 ms for 3840×2160 and 22.18 → 12.17 ms for cropped 1919×1079. This is a separate patch for BC7-to-RGBA conversion. Patch, oracle and raw samples. AI-assisted PortBridge engineering (OpenAI Codex).The same patch was also checked against the actual synthetic BC7-to-PNG CLI path, with a new process for each arm. Full 3840×2160 export was 273.925 → 226.422 ms and 1919×1079 was 72.327 → 60.443 ms. All 16 files matched exactly within their shape and passed an independent PNG/CRC check. The OS page cache was not flushed. CLI runner and all samples.
@akimfomin on GitHub · 2026-11-25 08:16 UTC · original
Lewandox, I used PortBridge to check the earlier GFX10 copy change with the full locked texture crate on your unchanged
22c1cf9head. All 13 original tests passed, as did all 16 with the GFX10 patch alone and all 17 with both patches applied. The GFX10 copy patch is now available by itself, with its exact address checks. The BC7 work also applies independently to current upstream maind02eee0and passed all six texture tests there. If you'd like to take the copy change into #188, the first patch is ready to apply. Patches and verification@akimfomin on GitHub · 2026-11-25 09:22 UTC · original · edited 2026-11-25 09:32 UTC
PortBridge found a separate address oracle for the GFX10 copy follow-up in Xbox2Windows #1469. On the unchanged #188 head
22c1cf9and the GFX10-only candidatef2329f13, all 105 published Mesa 25.1.0/navi21 coordinates across 12 synthetic layouts matched both the expected offsets and the bytes copied in both directions, including selected BC7 mip-tail locations. This check used CPU fixtures and did not cover GPU execution or array layouts. Reproduction and exact results. It can be rerun with the GFX10-only patch on any later #188 head; no BC7 decoder change is needed.Independent Ubuntu confirmation: Yoshi-233 tested the same pinned GFX10-only patch and
22c1cf9base on Ubuntu 24.04.5 x86-64 with Rust/Cargo 1.98.1. The locked suite passed 16/16, including all three added GFX10 copy tests, with no failures or skips.@Lewandox on GitHub · 2026-11-25 11:22 UTC · original
Thanks @Yoshi-233 and @akimfomin for the independent Ubuntu/Rust and Mesa 25.1.0 / Navi21 coordinate verifications!
Rebased onto latest
main(d02eee0, synced all 9 READMEs to 667 tests) and added the separable X/Y/Z precomputation optimization todetile_subresource/tile_subresource:Equationexposeseval_x,eval_y, andeval_z(eval_byte_offset(x, y, z) == eval_x(x) ^ eval_y(y) ^ eval_z(z)).copy_tiled_subresourcecomputes the slice Z term once per subresource, precomputes(x_blk, eval_x)once per column (keeping a zero-allocation direct path for small mips<= 64elements), and computes(y_blk, eval_y ^ z_xor)once per row;SwizzleMode::Linearuses per-row slice copies.fast_copy_matches_element_offset_across_linear_and_tiled_modesverifying byte-for-byte identity againstelement_offsetacrossLinear, 4 KiB, 64 KiB,_T,_X,R_X, andZ_Xmodes with mip tails, texture arrays, and non-zeropipe_bank_xor(14/14 Rust tests +ruff+pytestpassing).@akimfomin on GitHub · 2026-11-25 13:58 UTC · original
Lewandox, I independently reran the texture crate on your exact integrated head
c5ca937c371d8b21e56feb36f3d009ecffe5765awith PortBridge. On Windows 11 with Rust 1.100.0 (gnullvm),cargo test --locked --manifest-path rust/Cargo.toml -p anyxboxx-texturereturned 15 passed, 0 failed and 0 ignored. That includes all nine GFX10 tests and the newfast_copy_matches_element_offset_across_linear_and_tiled_modescheck. The other six tests cover BC7. This was a CPU test run. AI use: OpenAI Codex prepared the clean checkout, ran the test and drafted this report.@LooperSalty on GitHub · 2026-11-25 15:00 UTC · original
Closed by the maintainer during PR triage: since #199, VIctory lives in this repository and is what runs the game. It already has its own XMA decoder (
third_party/victory/crates/victory-formats/src/xma.rs) and GFX10 texture tiling (victory-formats/src/texture.rs), whilerust/anyxboxx-*is only used by a test. Improvements in this area should go to VIctory's crates instead. Thanks for the work.Pull request closed