Repository navigation
Texture layouts: every pipe and bank XOR mode is addressed, on both consoles (builds on #892) - #932
Conversation
… each console (port of DoubleGhosty/cool_fox d9f3ea6f8) The title's CPU code reads the ocean's 256x256 R32_FLOAT height map, which its wave passes write, and texback copies it into title memory in the console's layout. That texture is in SW_64KB_R_X, a pipe and bank XOR mode the tiler had no addressing for, so the copy back could not be tiled and the CPU read what was in that memory before. The logs of trustno1-coder#788, trustno1-coder#853 and trustno1-coder#859 each have "a texture copied back could not be tiled e=Unsupported"; the warning does not say for which texture. victory-formats: Layout::configure_render_xor addresses that one layout (a 256x256 plane of 4-byte elements, one mip, a 64 KiB-aligned allocation) with addrlib's GFX10_SW_64K_R_X_1xaa_RBPLUS equations for the console's pipes and packers: Series S 8 and 4, Series X 32 and 8. victory-gpu: title_texture sets it for an R32_FLOAT texture at a 64 KiB-aligned address, by the console the title runs as. A texture whose layout still cannot be addressed is left alone before any copy is recorded, with one warning that names its size, format and swizzle. From DoubleGhosty/cool_fox d9f3ea6f8 ("Support the aligned water height texture readback for boat missions"). The test's digests come from XCL's independent GFX10 tiler.
…o1-coder#881 trustno1-coder#881 skips the copy back of a texture whose layout the tiler cannot address, at the list, with a test on WARP. This change also returned no target for such a texture: the same skip twice, and trustno1-coder#881 came first. So title_texture only sets the XOR addressing now, and its test checks what it gives: the layout addressed or not, at the right place and size.
…onsoles Builds on the one SW_64KB_R_X layout the ocean's height map uses. The XOR modes (_X, _T) now have addresses for every element size, 2D, arrays and 3D, mips and mip tails, from addrlib's RB+ swizzle patterns for the console's pipes and packers (Series S 8 and 4, Series X 32 and 8): - XOR_PATTERNS holds the single-sample PATINFO rows of gfx10SwizzlePattern.h for those two configurations, expanded from the NIBBLE01..NIBBLE4 tables as GetSwizzlePatternFromPatternInfo does. - Layout::configure_xor(PipeConfig) picks the row as GetSwizzlePatternInfo does; offset and the copies follow ComputeSurfaceAddrFromCoordMacroTiled: block place, then the pattern on the whole coordinates and slice. - title_texture configures any texture at a block-aligned address, and the xg texture computer configures its layouts, by the console the title runs as (Console::pipes).
…; the texture computer's XOR offsets are tested Review notes: the doc names the nibble tables used, says SW_4KB_R_X has no pattern, and the element sizes the test covers.
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto main (63b902f).
- Merge & Policy: Clean merge across
victory-formats,victory-gpu, andvictory-hle;cargo xtask policypassed (294 files ok). - Tests:
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).
- Lint:
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).
|
Confirmed the
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. |
|
I compared this PR's Setup. addrlib was built from source with Layouts. The 13 cases of
Checks on the harness itself:
Not covered: MSAA (not addressed here), a non-zero |
|
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 |
|
@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 addrlib was used two independent ways:
Notes:
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. |
Extend texture readback and XG element offsets to the active console pipe and bank configuration. Adapt trustno1-coder/VIctory-NVIDIA#932.
Builds 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 Texture read-back: the ocean's height map in SW_64KB_R_X is tiled for each console (port of DoubleGhosty/cool_fox d9f3ea6f8) #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 Texture read-back: the ocean's height map in SW_64KB_R_X is tiled for each console (port of DoubleGhosty/cool_fox d9f3ea6f8) #892's did. Layouts still not addressed (MSAA) are left to Skip texture readbacks that the CPU tiler cannot land #881, as in Texture read-back: the ocean's height map in SW_64KB_R_X is tiled for each console (port of DoubleGhosty/cool_fox d9f3ea6f8) #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.