Texture layouts: every pipe and bank XOR mode is addressed, on both consoles (builds on #892) #932
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!932
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-932"
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?
@wildheathen on GitHub · 2026-11-28 09:18 UTC · original
wildheathen:xg-xor-modes→main· +559 −12 · 4 files · 4 commits · merged 2026-11-28 19:39 UTCBuilds on #892 (its two commits, up to
7f6e2aa, come first here; this replaces its single-layout case with the general one). Merge after #892, or instead of it.What happens
#880 and #892 found the ocean's height map, a 256x256
R32_FLOATtexture inSW_64KB_R_X, failing to tile on read-back (a texture copied back could not be tiled e=Unsupported). #892 addresses that one layout. Every other pipe and bank XOR mode (_X,_T) still had no addresses at all, intexbackand in the texture computer the title calls (its element offset and copy methods return an error for them). The height map's equation also depends on coordinate bits above 255, so it does not carry over to larger textures of the same mode.The change
victory-formats(texture.rs):XOR_PATTERNS: addrlib's RB+ single-sample swizzle patterns for the two consoles' pipes and packers (Series S 8 and 4, Series X 32 and 8, the configurations #892 uses), for every XOR mode and element size (1 to 16 bytes):SW_4K_S_X,SW_4K_D_X,SW_64K_S_T,SW_64K_D_T,SW_64K_Z_X_1xaa,SW_64K_S_X,SW_64K_D_X,SW_64K_R_X_1xaa, and the 3DSW_4K_S3_X,SW_64K_S3_T,SW_64K_S3_X,SW_64K_D3_X. Each row is theADDR_SW_PATINFOlabelled "8 pipes (4 PKRs)" or "32 pipes (8 PKRs)" ingfx10SwizzlePattern.h, expanded fromGFX10_SW_PATTERN_NIBBLE01..NIBBLE4asGetSwizzlePatternFromPatternInfodoes. They were extracted with a small script; I can add it to the repository if wanted.Layout::configure_xor(PipeConfig)(wasconfigure_render_xor(RenderPipeConfig)) picks the row asGetSwizzlePatternInfodoes: thick 3D layouts use theS3/D3patterns, 3DZ_XandR_Xthe 2D ones. MSAA stays unaddressed.offsetandtile/detilefollowComputeSurfaceAddrFromCoordMacroTiled: the block's place from the coordinates, plus the pattern applied to the whole coordinates and slice (shifted into the tail for a tail mip), whose bits above the block still pick the pipe. The copies move runs of elements whose x bits land on consecutive address bits, the rest one element at a time.victory-gpu:Console::pipes()gives the console'sPipeConfig.title_textureconfigures any texture whose title memory starts on a block boundary (was:R32_FLOATat a 64 KiB boundary). The addresses assume no pipe and bank XOR from the address, as #892's did. Layouts still not addressed (MSAA) are left to #881, as in #892.victory-hle(xg.rs): the texture computer configures its layouts the same way, so its element offset and copy methods work for XOR modes.Tests
texture::tests::xor_modes_tile_where_offset_points: 13 layouts (every XOR mode, 3DS_Tincluded; 2D, arrays, thick and thin 3D; full mip chains with tails; 1 to 16-byte elements), on both consoles. Each element gets its own value; aftertile, every element is whereoffsetsays (so no two elements share an address), anddetilegives the rows back.modules::xg::tests::xor_modes_have_element_offsets: the texture computer gives element offsets for a 256x256 R32SW_64KB_R_Xtexture, including the pipe bit x bit 7 flips.render_xor_water_matches_both_consoles_with_padded_rowspasses unchanged except for the renamed API: the general code gives the same bytes as the XCL digests for both consoles.xor_layouts_are_addressed_at_a_block_boundary:SW_64KB_S_Xat a 64 KiB boundary is now addressed (was not); a new row checks it is not 4 KiB off one.cargo test -p victory-formats --lib: 48 passed, 5 ignored.cargo test -p victory-gpu --lib: 454 passed, 36 ignored.cargo test -p victory-hle --lib: 189 passed, 3 ignored.manual_is_multiple_ofinshadow.rsandgameinput.rsremain).Not run with the game. On a boat or in the water, a log with this change should no longer have
could not be tiledfor an XOR mode.No game files, dumps or extracted data are included.
@Dukestar69 on GitHub · 2026-11-28 09:30 UTC · original · approved these changes
Tested locally merged onto
main(63b902f).victory-formats,victory-gpu, andvictory-hle;cargo xtask policypassed (294 files ok).cargo test -p victory-formats --lib texture::passed (24 passed; 0 failed, includingrender_xor_water_matches_both_consoles_with_padded_rowsandxor_modes_tile_where_offset_points).cargo test -p victory-hle --lib xg::passed (5 passed; 0 failed, includingxor_modes_have_element_offsets).cargo clippy -p victory-formats --lib -- -D warningspassed with 0 warnings.Comprehensive pipe/bank XOR swizzle addressing coverage for both console profiles. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@cxy0072019-sketch on GitHub · 2026-11-28 11:10 UTC · original
Confirmed the
256×256 R32_FLOATocean read-back on an RTX 5070 Ti (621.24), Windows 11 build 28000, Series S profile, and 1920×1080 output. Both runs used the same1b1ad18diagnostic executable, Gambit Bay save, and input sequence. A local test switch disabled only the new XOR layout configuration in the control.256x256 ocean-layout readback landed format=Some(DXGI_FORMAT(41)) bytes=262144.256x256 ocean-layout readback rejected e=Unsupported format=DXGI_FORMAT(41).The surface and seabed were visible in both runs. The dark underwater waterline remained, and the live camera positions differed. The comparison confirms the read-back fix.
@jptorres96 on GitHub · 2026-11-28 11:20 UTC · original
I compared this PR's
Layout::offsetat1b1ad18with AMD's PAL addrlib (c5e800072a32f68b6ccc4422936d96167c6e0728, the same commit Yoshi-233 used for #892), for every XOR mode here, not onlySW_64KB_R_X.Setup. addrlib was built from source with
ADDR_GFX10_BUILD, familyFAMILY_NV, revision0x28(Navi21, RB+), andGB_ADDR_CONFIGset to 8 pipes / 4 packers (Series S) and 32 pipes / 8 packers (Series X), 256-byte pipe interleave. The surfaces wereflags.texture = 1, one sample,pipeBankXor = 0. A small example invictory-formatswroteoffset(mip, x, y, z)for every element of every mip and slice. For each of those coordinates the harness calledAddr2ComputeSurfaceAddrFromCoordand compared the result.Layout::sizewas also compared withAddr2ComputeSurfaceInfo'ssurfSize.Layouts. The 13 cases of
xor_modes_tile_where_offset_points, unchanged: 2D and 3D, arrays, full mip chains with tails, 1 to 16-byte elements, modes 17, 18, 21, 22, 24, 25, 26 and 27. I added twoSW_64KB_R_Xplanes: the 256x256R32_FLOATsurface from #880, and a 1024x512 one, so that the coordinate bits above 255 are covered.Checks on the harness itself:
d4556429b544c925(32/8) andce798e86f5ab1d25(8/4). These are the digests Yoshi-233 posted from their own PAL build.cargo test --locked -p victory-formats --libat1b1ad18: 48 passed, 5 ignored.Not covered: MSAA (not addressed here), a non-zero
pipeBankXor(this PR assumes block-aligned memory, as #892 does), and thevictory-hletexture computer beyond its own test. This is synthetic only: no game files, dumps or extracted data. I can share the harness (about 150 lines of C++ plus a small Rust example) if it's useful.@kibagami-nc on GitHub · 2026-11-28 11:22 UTC · original
Good to have the general case, thanks, and for keeping #892's two commits first. If this lands, it contains #892, so #892 can be closed then.
One way to check the new rows the way the 256x256 case was checked: Yoshi-233 compared #892's
Layout::offsetwith a separately built AMD PAL addrlib, every offset, for both configurations, with 0 mismatches. The same comparison over a few more modes and element sizes, for instanceSW_64KB_S_XandSW_64KB_D_Xat 4 and 8 bytes and one_Tmode, would cover the rows extracted by script.@jptorres96 on GitHub · 2026-11-28 11:39 UTC · original
@kibagami-nc Our comments crossed: the one just above is that comparison, for the 13 test layouts. To cover the rows extracted by script, I then ran the whole matrix: every XOR mode here (17, 18, 21, 22, 24, 25, 26, 27) at every element size (1, 2, 4, 8 and 16 bytes). Each combination was run as a 203x141 2D array of 2 slices and as a 45x37x19 3D texture, with full mip chains, on both consoles, at
1b1ad18, against the same addrlib build.addrlib was used two independent ways:
Addr2ComputeSurfaceAddrFromCoord, as before. This path goes through addrlib's equation table.Addr2CopyMemToSurface. This path tiles memory from the swizzle patterns (LutAddresser) and does not use the equations. Each element of a linear mip holds its own 32-bit index, split over passes for 1- and 2-byte elements. After addrlib tiles it, the byte atLayout::offsetof each element must hold that element's index.Notes:
SW_64KB_D_Xat 8 and 16 bytes: addrlib has no equation for these and returnsADDR_INVALIDPARAMSper coordinate. By copy they match: 35,640 / 35,640 each, on both consoles.SW_64KB_Z_Xat 16 bytes: addrlib rejects the surface itself (a Z layout has no 128-bit element). Per coordinate its offsets match anyway.SW_64KB_D_TandSW_4KB_D_X:Layout::newrefuses them, so they stay unaddressed rather than wrong. Not in the matrix.So the rows extracted by script agree with addrlib's own patterns for every mode and element size, 2D and 3D, on both consoles. MSAA and a non-zero pipe/bank XOR remain outside, as in the PR. Synthetic only: no game files.