Skip to content

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

Merged
trustno1-coder merged 2 commits into
trustno1-coder:mainfrom
kibagami-nc:fix/water-height-readback-xor
Nov 28, 2026
Merged

trustno1-coder merged 2 commits into
trustno1-coder:mainfrom
kibagami-nc:fix/water-height-readback-xor

Conversation

@kibagami-nc

@kibagami-nc kibagami-nc commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

A port of DoubleGhosty/cool_fox d9f3ea6f8, "Support the aligned water height texture readback for boat missions": its addressing part. The finding and the code are DoubleGhosty's.

What happens

texback copies textures that the title's shaders write and its CPU code reads back into title memory, in the console's layout. By default it takes four kinds of the ocean's textures, among them 256x256 R32_FLOAT. Its module doc says that without it, boats sank.

DoubleGhosty found the ocean's height map in SW_64KB_R_X, a pipe and bank XOR mode. The tiler had no addressing for any XOR mode ("shortcut: no addressing for the XOR modes"), so tiling such a copy back failed with Unsupported, and the CPU went on reading what was in that memory before.

Three logs posted today on Series X show it: those of #788, #853 and #859 each have a texture copied back could not be tiled e=Unsupported mip=0 slice=0. The warning is logged once and does not name the texture.

The change

victory-formats (texture.rs):

  • Layout::configure_render_xor(config) addresses that one layout: a 2D plane of 256x256 4-byte elements, one mip, single-sampled, in 64 KiB blocks of 128x128.
  • The addresses come from 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. These are the two configurations XCL (gpu/texture.rs) found to match every texel of every mode against the console's own layout library.
  • offset and the copies use them. Every other XOR mode and MSAA still has no addressing; the shortcut: note now says so.

victory-gpu (resource.rs): title_texture turns it on for an R32_FLOAT texture at a 64 KiB-aligned address, by the console the title runs as. XOR addresses assume the allocation's low 16 bits are zero.

Not here: skipping the copy back of a layout that still cannot be addressed. DoubleGhosty's commit also did that, but #881 does it at the list, with a test on WARP, and came first. So this pull request leaves it to #881.

Tests

  • New texture::tests::render_xor_water_matches_both_consoles_with_padded_rows, from the same commit:
    • each texel holds its own index, with rows padded to 1,040 bytes;
    • for both consoles, the tiled bytes match a digest from XCL's independent GFX10 tiler;
    • offset finds every texel;
    • detiling gives the rows back.
  • New resource::tests::the_ocean_height_map_layout_is_addressed_at_a_64_kib_boundary: title_texture gives the layout at the texture's place and size, and the layout is addressable:
    • in SW_4KB_S: yes;
    • in SW_64KB_R_X at a 64 KiB boundary: yes;
    • in SW_64KB_R_X 256 bytes off: no;
    • in SW_64KB_S_X: no.
  • cargo test -p victory-formats --lib --locked: 47 passed, 5 ignored.
  • cargo test -p victory-gpu --lib --locked: 454 passed, 36 ignored.
  • cargo check --workspace --all-targets --locked: builds.
  • Clippy (-D warnings, default and --all-features): nothing in the changed lines. It stops on main's own manual_is_multiple_of in shadow.rs and descriptor.rs, fixed in CI: clippy clean again in both builds (four findings since 9b712a6) #665. With that lint allowed, both builds are clean.

Checked by others

Yoshi-233 compared Layout::offset at a231183 with a separately built AMD PAL addrlib (c5e8000). The surface was 256x256 R32_FLOAT, one mip, one sample, base XOR zero, and every byte offset was compared:

PAL configuration Matching offsets Mismatches
32 pipes / 8 packers (Series X) 65,536 / 65,536 0
8 pipes / 4 packers (Series S) 65,536 / 65,536 0

Yoshi-233 also ran this pull request with #881 on WARP. The only conflict was where both add a test to resource.rs. With both, an aligned SW_64KB_R_X texture is copied back and SW_64KB_S_X is skipped, so #881's test would take SW_64KB_S_X as its unsupported case.

Yoshi-233 also notes, from #880, that a 256x256 R32_FLOAT texture of this layout was the output of CS_ComputeTimestep, read by CS_MinTimestepReduce. A texture of this kind can serve more than the height map, so the effect on boats still needs its own look in the game.

cxy0072019-sketch (RTX 5070 Ti, Series S) ran #932's build, which carries this change, on the same save and inputs with and without the XOR layout:

  • with it: 256x256 ocean-layout readback landed format=Some(DXGI_FORMAT(41)) bytes=262144;
  • without it: rejected e=Unsupported.

The surface and the seabed showed in both runs, and the dark underwater waterline stayed.

#932 (wildheathen) builds on this pull request and addresses every XOR mode. If it lands, it contains this one.

Not run with the game. On a boat or in the water, a log with this change should no longer have could not be tiled for this kind. #826 (a physics glitch when swimming) is the kind of report it could bear on, but nobody has checked that yet.

No game files, dumps or extracted data are included.

… 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.
MystifiedSky added a commit to MystifiedSky/VIctory-NVIDIA-Improved that referenced this pull request Nov 28, 2026
@Yoshi-233

Copy link
Copy Markdown

I compared this PR’s actual Layout::offset at a231183 against a separately built AMD PAL addrlib (c5e800072a32f68b6ccc4422936d96167c6e0728). Each implementation exported every byte offset in row-major coordinate order; I compared the raw arrays element by element. The surface was 256×256 R32_FLOAT, one mip and one sample, with base XOR zero.

PAL configuration Matching offsets Mismatches FNV-1a of the 32-bit little-endian offsets
32 pipes / 8 packers 65,536 / 65,536 0 d4556429b544c925
8 pipes / 4 packers 65,536 / 65,536 0 ce798e86f5ab1d25

I also ran the victory-formats library suite at this head: 47 passed, 5 ignored. This independently validates the two configured address equations.

For the live 4070 Ti SUPER report in #880, the 256×256 resource I traced was bound as the output of CS_ComputeTimestep and read by CS_MinTimestepReduce in two separate runs. It matches this descriptor and alignment. A surface of this size and format can serve more than one purpose, so those bindings are useful when distinguishing the timestep texture from a CPU-read height map. The visual effect on boat buoyancy still needs its own observation.

…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.
@sawetco

sawetco commented Nov 28, 2026

Copy link
Copy Markdown

I tested the patch at 7f6e2aa on v2026.11.27.10 with #541 and #1111. My setup was an RTX 5070 on Windows 11 with NVIDIA 621.40, Series X at 1080p to 1440p, DLSS Quality and DLSS Frame Generation 2x.

I went back as Jason to the small pool next to the bar near the mission marked B. Entering the pool still swept Jason away abruptly, like a strong current. This was the same spot as my earlier swimming report. Pool report in #826

@trustno1-coder
trustno1-coder merged commit a9567c1 into trustno1-coder:main Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants