Formats: render-target XOR layouts (SW_64KB_R_X) have addresses on both consoles #2877
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T22:58:07Z.
What
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.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:04:55Z.
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.
Imported from Marvisak/VIctory. Originally posted by AwsAli05 on 2026-11-25T23:06:48Z.
Review: COMMENTED
All 18
victory-formatstexture tests passed on Windows atf343026. That includes the independent address-library hashes for both models and the round trip with a padded linear row pitch.The tests construct layouts through
new_for_model, while the title usesconsole::setfollowed byLayout::new. A profile-level test that checks one known XOR address after Series S selection would cover that wiring too. The format tests establish the single-slice, single-mip layouts described in the PR.AI-assisted review and test.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:37:07Z.
Review: COMMENTED
Scoped review: the per-console XOR tables for SW_64K_R_X can't be verified bit-by-bit in review, but the structure is right — element-size-keyed OnceLock patterns, Series S toggle set once with the emulated console before any texture, and the pipe-vs-bank routing split documented per entry. Wrong values would show immediately as RT corruption on S-profile targets, so the value is in having the table at all. LGTM.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:26:31Z.
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
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T04:30:55Z.
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.
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-27T06:44:49Z.
On the credit: the commit that adds the tables,
f3430262("Formats: render-target XOR layouts (SW_64KB_R_X) have addresses on both consoles"), already carriesCo-authored-by: DexNom, since they come from DexNom's570a941. Whether this lands or the same tables come in through #2643 or #2759 is your call. If one of those goes first, I'll drop the table commit here and keep only the staging change.On the pipe and packer counts: I don't have a public source for them. The 32/8 and 8/4 figures come from DexNom's work, so this needs either a source or a run on a title texture from someone who can do that.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.