Formats: render-target XOR layouts (SW_64KB_R_X) have addresses on both consoles #2879
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2879
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2879"
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?
@0xkn0wh3r3 on GitHub · 2026-11-25 22:58 UTC · original
0xkn0wh3r3:formats/render-target-xor-tiling→main· +381 −3 · 3 files · 4 commits · openWhat
Render-target XOR layouts had no address equation (
Layout::addressable()was false). They could be sized, but not detiled, tiled or addressed. So a title texture in such a layout uploaded nothing from title memory, andXGTextureAddressComputeroffsets into it came back as 0 with a warning.The XOR modes route pipe and bank address bits by the GPU's configuration, and that differs between the Series X and S. This PR adds:
XOR tables: for
SW_64KB_R_X, the per-coordinate-bit XOR tables of GFX10SW_64K_R_X_1xaa_RBPLUSwithout a base pipe XOR. They cover 32 pipes and 8 packers (Series X) and 8 pipes and 4 packers (Series S). Bits past a block's side choose the pipe of the neighbouring blocks.Scope: single-mip, single-slice, single-sample 2D layouts with 2-, 4- and 8-byte elements. Other XOR layouts stay unaddressable, as before.
Console model:
set_series_s_tilingpicks the tables, andvictory_gpu::console::setcalls it.Copies: detiling and tiling move 16-byte runs, since the low four address bits are column bits in every table.
Uploads: texture staging used to refuse every XOR layout. It now refuses only layouts without addresses (
Layout::addressable), so title-written textures in these layouts are uploaded. Uploads still go only to textures without render-target, depth or unordered use (texture::title_written), so host-rendered targets aren't overwritten.Where it came from
From DexNom's fork, DexNom/VIctory@570a941:
render_xor_pattern,render_xor_offset,set_series_s_tilingand their address-library test, adapted to this tree's shared pattern tables. Credited withCo-authored-by: DexNom.Tested
texture::tests::render_xor_layouts_match_the_address_library(DexNom's): an FNV-1a hash of every element's offset in row order. It matches the hashes DexNom computed with AMD'sAddr2ComputeSurfaceAddrFromCoord(GFX10.3, PAL c5e8000) for 256×256 and 513×357, both consoles and the three element sizes. Tiling and detiling round-trip.texture::tests::render_xor_blocks_hold_each_element_once(new): each 64 KiB block holds each of its elements exactly once, wherever the block lies. 16-byte elements, mips and arrays stay unaddressable.texture::tests::a_render_target_xor_texture_is_staged(new, victory-gpu): a 256×256 RGBA8SW_64KB_R_Xtexture is staged, and the bytes read back from the upload buffer equalvictory-formats' detile of its memory. The test builds theStagingdirectly, so it doesn't go throughstaging()'s layout check.cargo test -p victory-formats(48 passed, 5 ignored) andcargo test -p victory-hle(all pass).cargo test -p victory-gpu: 230 passed. The 2 known NVIDIA failures are fixed by #2121.cargo clippy --all-targets -- -D warningson victory-formats, and on victory-gpu with and without--features diagnostics: clean.Not tested
SW_64KB_R_Xwith title-written contents.Changes after review
cf9deaa:console::tests::the_console_set_chooses_render_target_xor_addressessets the Series S, then the Series X, and checks one element whose bit the two consoles route differently (0x800 and 0x2000). That covers theconsole::set→Layout::newwiring.@fuzeofficlal on GitHub · 2026-11-25 23:04 UTC · original
Reviewed and verified
f3430262on Windows 11 againstmain(842b0cb):render_xor_pattern(series_s, element_bytes)cleanly coversSW_64KB_R_X(2/4/8B/px, 2D, single mip/slice/sample,block == 1) for both Series X (32 pipes / 8 packers) and Series S (8 pipes / 4 packers), withconsole::setwiringSERIES_S_TILINGcleanly.x & (ox.len() - 1)/y & (oy.len() - 1)handle high pipe-XOR bits past a 64 KiB tile, 16-byte copy chunks clamp properly (16.min(bytes - at)) for odd/small extents, and unsupported shapes (16 B/px, multi-mip, array/3D,SW_64KB_D_X) stay!addressable().victory-formats48/48 passed (5 ignored; includingrender_xor_layouts_match_the_address_libraryandrender_xor_blocks_hold_each_element_once),victory-gpu --lib console4/4 passed,cargo clippy --locked -p victory-formats -p victory-gpu --all-targets -- -D warnings0 warnings,cargo xtask policy(191 files ok).Looks solid and ready to merge.
@Marvisak on GitHub · 2026-11-26 04:26 UTC · original · edited 2026-11-26 05:31 UTC
Automated triage for the maintainers.
Needs work. Thanks for the reply.
8016b43takes care of one point:staging()invictory-gpu/src/texture.rsnow refuses an XOR-layout texture that is not on a 64 KiB boundary (pipe_bank_xor), so a base pipe/bank XOR no longer gives a scrambled upload. That reads correctly.The main point is still open. The
render_xor_patterntables invictory-formats/src/texture.rsdepend on the 32-pipe/8-packer (Series X) and 8-pipe/4-packer (Series S) counts, and nothing public gives those counts. The tests only check that the tables match those same inputs. Your reply also says the tables come from DexNom's commit570a941, which is part of the open PRs #2643 and #2759. If the tables are taken from there, please credit that author in the commit, or let that work land through its own PR.What would change the verdict: a public source for the pipe and packer counts of each console, or one title texture in this layout detiling correctly on
mainplus this PR, from anyone who can run it.CI: passing.
Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 04:30 UTC · original
Thanks for the review. Taking the three points in order:
Non-zero base pipe/bank XOR: handled in
8016b43, which refuses it. In an XOR layout the GPU takes the base pipe/bank XOR from base-address bits 8–15 of the descriptor; Mesa ORstile_swizzle << 8into the address. This tree has no other place a base XOR could come from, becausetexture_layoutalready refuses anylayoutword above0x1ff. So staging now refuses an XOR-layout texture whose memory is not on a 64 KiB boundary, with the same warning as before. A texture whose layout has one is no longer uploaded scrambled. Test:a_base_pipe_bank_xor_is_refused.Address-library inputs: I can't give a public source for the consoles'
GB_ADDR_CONFIG. The tables are DexNom's. In570a941they describe them as addrlib'sGFX10_SW_64K_R_X_1xaa_RBPLUSwith no base pipe XOR, computed withAddr2ComputeSurfaceAddrFromCoord(PAL c5e8000) for 32 pipes / 8 packers (Series X) and 8 pipes / 4 packers (Series S). No register values or source for those counts are given. The test hashes therefore check consistency with those inputs. They don't tie the inputs to a documented register value. If that's not enough to merge, I understand keeping this open until someone can confirm the counts.A title texture detiling correctly: I can't produce that here. I don't have a legitimately obtained title to run.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.