Water surface drawn in screen-space rectangles, angle-dependent (RX 9070 XT) #73

Open
opened 2026-11-26 11:48:38 +00:00 by github-bot · 7 comments
Owner

@⁠PastiiJay on GitHub · 2026-11-26 11:45 UTC · original

On our AMD test machine (RX 9070 XT 16 GB, Ryzen 7 9800X3D, Windows), the sea is only drawn in some rectangular screen tiles. Which tiles show water depends on camera angle and position: from some angles it is always there, from others never, and in between it flickers. A lone water rectangle can show over sand, and one tile once landed on the player character's chest.

What we already ruled out (no change): VICTORY_TEXTURE_BACK off, VICTORY_PORT_CONSTANTS off, VICTORY_CUT_WRITES=1, mesh vertex indices masked to 9 bits (Marvisak c0228d9).
What changes it: VICTORY_DEPTH_TWINS=0 (more rectangles), VICTORY_INDIRECT_RAW=1 (regular fast flicker, independent of the camera), and waiting for all earlier writes before clamping indirect records (frame-to-frame flicker gone, angle dependence stays).

Our guess: the water pass builds a tile list or indirect arguments on the GPU, and something between that pass and the indirect draw is wrong on our side. Any idea on where to look, or a small test that isolates it, is very welcome.

If you run an RX 9000-series card and the water looks right for you, which build and settings do you use? That alone would narrow it down a lot.

**@⁠PastiiJay** on GitHub · 2026-11-26 11:45 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73) On our AMD test machine (RX 9070 XT 16 GB, Ryzen 7 9800X3D, Windows), the sea is only drawn in some rectangular screen tiles. Which tiles show water depends on camera angle and position: from some angles it is always there, from others never, and in between it flickers. A lone water rectangle can show over sand, and one tile once landed on the player character's chest. What we already ruled out (no change): `VICTORY_TEXTURE_BACK` off, `VICTORY_PORT_CONSTANTS` off, `VICTORY_CUT_WRITES=1`, mesh vertex indices masked to 9 bits (Marvisak c0228d9). What changes it: `VICTORY_DEPTH_TWINS=0` (more rectangles), `VICTORY_INDIRECT_RAW=1` (regular fast flicker, independent of the camera), and waiting for all earlier writes before clamping indirect records (frame-to-frame flicker gone, angle dependence stays). Our guess: the water pass builds a tile list or indirect arguments on the GPU, and something between that pass and the indirect draw is wrong on our side. Any idea on where to look, or a small test that isolates it, is very welcome. If you run an RX 9000-series card and the water looks right for you, which build and settings do you use? That alone would narrow it down a lot.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:48:38 +00:00
Author
Owner

@⁠HandshakeHackin on GitHub · 2026-11-26 11:57 UTC · original

I built a small WARP test on beta-2 (74a7e38) that isolates when the indirect arguments are copied. A GPU producer changes a dispatch record from one group to five. The actual beta-2 clamp copies the record, then ExecuteIndirect marks one bit for each group that ran. Only the clamp’s position in the command list changes.

Clamp position Final source X Tile mask executed
Before the producer 5 0x01 (one tile)
After the producer 5 0x1f (all five tiles)

That gives a concrete signature to look for: reading correct arguments after the frame can hide the stale snapshot the draw actually consumed. It is a synthetic compute dispatch, so the next question is whether a real water draw goes through that path. On beta-2, I’d keep the same camera and other settings, with raw mode off, and change only VICTORY_CLAMP_AHEAD from its default to 0. Check the indirect records per frame line to make sure ahead clamps actually moved in place. If the rectangles change, trace the argument address of one affected draw against the earlier writer range checked by HostList::gpu_written. If the baseline already reports zero ahead clamps, this comparison won’t distinguish the paths.

Fixture source · Windows readbacks · Prelude eligibility check. The focused job temporarily excluded three unrelated beta-2 test bodies that fail compilation.

**@⁠HandshakeHackin** on GitHub · 2026-11-26 11:57 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7191374161) I built a small WARP test on `beta-2` (`74a7e38`) that isolates when the indirect arguments are copied. A GPU producer changes a dispatch record from one group to five. The actual beta-2 clamp copies the record, then `ExecuteIndirect` marks one bit for each group that ran. Only the clamp’s position in the command list changes. | Clamp position | Final source X | Tile mask executed | |---|---:|---:| | Before the producer | 5 | `0x01` (one tile) | | After the producer | 5 | `0x1f` (all five tiles) | That gives a concrete signature to look for: reading correct arguments after the frame can hide the stale snapshot the draw actually consumed. It is a synthetic compute dispatch, so the next question is whether a real water draw goes through that path. On `beta-2`, I’d keep the same camera and other settings, with raw mode off, and change only `VICTORY_CLAMP_AHEAD` from its default to `0`. Check the `indirect records per frame` line to make sure ahead clamps actually moved in place. If the rectangles change, trace the argument address of one affected draw against the earlier writer range checked by `HostList::gpu_written`. If the baseline already reports zero ahead clamps, this comparison won’t distinguish the paths. [Fixture source](https://github.com/HandshakeHackin/klbf-lab/commit/d34906c1d64a31dfe85f64d9ca2e9bc5f0e25faa) · [Windows readbacks](https://github.com/HandshakeHackin/klbf-lab/actions/runs/45814559826/job/139890801405) · [Prelude eligibility check](https://github.com/PastiiJay/klbf-lab/blob/74a7e38358898b0ec698dc4ae9cfd848bab06525/crates/victory-gpu/src/draw.rs#L3767-L3779). The focused job temporarily excluded three unrelated beta-2 test bodies that fail compilation.
Author
Owner

@⁠PastiiJay on GitHub · 2026-11-26 11:58 UTC · original

Thanks @⁠HandshakeHackin, your fixture matches what we see in game. We had just run exactly that A/B at the same spot:

  • default: indirect records per frame: ~2,540 clamped ahead in their lists' preludes, ~1,340 clamped in place
  • VICTORY_CLAMP_AHEAD=0: 0 clamped ahead, ~3,780 clamped in place

The pattern did change: the rectangles stopped following the camera and the sea flickers on its own rhythm instead. So the water does go through that path. Our reading is the same as yours: the ahead clamp snapshots the record before the tile pass writes it, and HostList::gpu_written misses the writer because it reaches its buffer through the view heap by a computed index. Next we'll try closing indirect batches after every writer, copy and barrier instead of clamping ahead, and report back here.

**@⁠PastiiJay** on GitHub · 2026-11-26 11:58 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7191396805) Thanks @⁠HandshakeHackin, your fixture matches what we see in game. We had just run exactly that A/B at the same spot: - default: `indirect records per frame: ~2,540 clamped ahead in their lists' preludes, ~1,340 clamped in place` - `VICTORY_CLAMP_AHEAD=0`: `0 clamped ahead, ~3,780 clamped in place` The pattern did change: the rectangles stopped following the camera and the sea flickers on its own rhythm instead. So the water does go through that path. Our reading is the same as yours: the ahead clamp snapshots the record before the tile pass writes it, and `HostList::gpu_written` misses the writer because it reaches its buffer through the view heap by a computed index. Next we'll try closing indirect batches after every writer, copy and barrier instead of clamping ahead, and report back here.
Author
Owner

@⁠PastiiJay on GitHub · 2026-11-26 12:15 UTC · original

Following your suggestion we captured a still-camera run (diagnostics build, VICTORY_DUMP_TARGETS=1, frames 2086–2095 and 2686–2689 dumped). Thanks again, it paid off right away.

The sea is all-or-nothing per frame, not a partial tile list: in "sand" frames the water draws (vertex 1707628854aa2241, pixel 7933d968ca095766, which write the 1280x720 water depth plus an R16_UINT and an R16G16_FLOAT target) are not recorded at all. There are 54 of them in frames 2090/2093 and 39 in 2689, but 0 in 2688. Frame 2088 has water on the left half only. Downstream, compute 42848ef43117d945 builds the 80x45 tile mask from that depth: 21–22 % water tiles in water frames, 0 % in sand frames. So nothing downstream drops the water; the title simply doesn't submit those draws on some frames. That points to something CPU-side the title reads (a visibility or readback result) that we serve stale or empty on alternate frames. Next capture will use VICTORY_DUMP_AFTER=7933d968ca095766,42848ef43117d945.

**@⁠PastiiJay** on GitHub · 2026-11-26 12:15 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7191760814) Following your suggestion we captured a still-camera run (diagnostics build, `VICTORY_DUMP_TARGETS=1`, frames 2086–2095 and 2686–2689 dumped). Thanks again, it paid off right away. The sea is all-or-nothing per frame, not a partial tile list: in "sand" frames the water draws (vertex `1707628854aa2241`, pixel `7933d968ca095766`, which write the 1280x720 water depth plus an R16_UINT and an R16G16_FLOAT target) are **not recorded at all**. There are 54 of them in frames 2090/2093 and 39 in 2689, but 0 in 2688. Frame 2088 has water on the left half only. Downstream, compute `42848ef43117d945` builds the 80x45 tile mask from that depth: 21–22 % water tiles in water frames, 0 % in sand frames. So nothing downstream drops the water; the title simply doesn't submit those draws on some frames. That points to something CPU-side the title reads (a visibility or readback result) that we serve stale or empty on alternate frames. Next capture will use `VICTORY_DUMP_AFTER=7933d968ca095766,42848ef43117d945`.
Author
Owner

@⁠PastiiJay on GitHub · 2026-11-26 12:30 UTC · original

Correction to my last comment: the "0 water draws in frame 2688" was wrong. It came from a bug in our capture tool, not from the title. The ops file for a frame could be recreated after a late recording thread wrote to it, which wiped the start of 2688 (and emptied 2088, 2089, 2092, 2686 and 2687). In every intact frame the main water pass is there, 54 draws (39 in 2689), and all five water passes are present in 2688 too. Sorry for the noise.

Also ruled out: queries cannot be the cause, since our resolve always reports "visible", and the title never calls SetPredication.

So the water is always submitted, and what flashes is what reaches the screen. The image dumps are taken at present, and with our delayed present an image can be caught while the water list is still running. That points to GPU ordering or timing between the water lists and the present (held queues, delayed present), which fits your fixture's reading. We fixed the capture tool and will redo the still-camera capture, looking at the presented image.

**@⁠PastiiJay** on GitHub · 2026-11-26 12:30 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7192097421) Correction to my last comment: the "0 water draws in frame 2688" was wrong. It came from a bug in our capture tool, not from the title. The ops file for a frame could be recreated after a late recording thread wrote to it, which wiped the start of 2688 (and emptied 2088, 2089, 2092, 2686 and 2687). In every intact frame the main water pass is there, 54 draws (39 in 2689), and all five water passes are present in 2688 too. Sorry for the noise. Also ruled out: queries cannot be the cause, since our resolve always reports "visible", and the title never calls `SetPredication`. So the water is always submitted, and what flashes is what reaches the screen. The image dumps are taken at present, and with our delayed present an image can be caught while the water list is still running. That points to GPU ordering or timing between the water lists and the present (held queues, delayed present), which fits your fixture's reading. We fixed the capture tool and will redo the still-camera capture, looking at the presented image.
Author
Owner

@⁠PastiiJay on GitHub · 2026-11-26 17:24 UTC · original

New finding, tested today on RX 9070 XT with the same 5-min bench at the same spot (BM-v1), changing only the console profile and the upscaler:

Profile Upscaler Sea
Series S FSR flickers / missing
Series S none missing most of the time (sea floor visible instead), flickers
Series X none drawn everywhere, stable

So the upscaler is not the cause, the Series S profile is. A tester on another 9070 XT in Series X also sees the sea correctly, even facing the sun. That points to something the title does differently at the smaller console's resolution (720p internal, maybe half-res water/tile passes) that our layer handles wrongly. Any idea where Series S takes a different path for water is welcome.

**@⁠PastiiJay** on GitHub · 2026-11-26 17:24 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7198967348) New finding, tested today on RX 9070 XT with the same 5-min bench at the same spot (BM-v1), changing only the console profile and the upscaler: | Profile | Upscaler | Sea | |---|---|---| | Series S | FSR | flickers / missing | | Series S | none | missing most of the time (sea floor visible instead), flickers | | Series X | none | drawn everywhere, stable | So the upscaler is not the cause, the **Series S profile** is. A tester on another 9070 XT in Series X also sees the sea correctly, even facing the sun. That points to something the title does differently at the smaller console's resolution (720p internal, maybe half-res water/tile passes) that our layer handles wrongly. Any idea where Series S takes a different path for water is welcome.
Author
Owner

@⁠HandshakeHackin on GitHub · 2026-11-26 20:15 UTC · original

There is a way to split the two profiles one step further. On 3a2c4dd, VICTORY_RENDER_S=1 changes the title-facing ConsoleMode query independently of the selected console. I verified the registry, analytics and memory results in fresh native Windows processes:

Selected profile Render override ConsoleMode Analytics Title memory (GPU-optimal + standard)
X unset 0x64 Xbox Series X 10 + 3.5 GiB
X 1 0x60 Xbox Series X 10 + 3.5 GiB
S unset 0x60 Xbox Series S 0 + 7,776 MiB

For the same BM-v1 save and camera, the useful pair is -SeriesX and -SeriesX -RenderS with this launcher-only change. No executable rebuild is needed on 3a2c4dd. Use the same flags for pre-build and play. Windows PowerShell 5.1 delivered the same command-line arguments in each pair and left FSR unset in all four launches. Launcher and runtime checks

If the second run also loses the sea, the render-mode query alone is sufficient to trigger the difference with the X memory profile held constant. If the sea stays stable, the full S profile still distinguishes the failing run. The Windows checks establish the inputs for that comparison. The water itself still needs the same-camera Radeon run.

**@⁠HandshakeHackin** on GitHub · 2026-11-26 20:15 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7202468137) There is a way to split the two profiles one step further. On `3a2c4dd`, `VICTORY_RENDER_S=1` changes the title-facing `ConsoleMode` query independently of the selected console. I verified the registry, analytics and memory results in fresh native Windows processes: | Selected profile | Render override | ConsoleMode | Analytics | Title memory (GPU-optimal + standard) | |---|---|---|---|---| | X | unset | `0x64` | Xbox Series X | 10 + 3.5 GiB | | X | `1` | `0x60` | Xbox Series X | 10 + 3.5 GiB | | S | unset | `0x60` | Xbox Series S | 0 + 7,776 MiB | For the same BM-v1 save and camera, the useful pair is **`-SeriesX`** and **`-SeriesX -RenderS`** with [this launcher-only change](https://github.com/HandshakeHackin/klbf-lab/commit/3cf4b3f7b53cc6750e95ab088161e95ea7789fae). No executable rebuild is needed on `3a2c4dd`. Use the same flags for pre-build and play. Windows PowerShell 5.1 delivered the same command-line arguments in each pair and left FSR unset in all four launches. [Launcher and runtime checks](https://github.com/HandshakeHackin/klbf-lab/actions/runs/45889172958/job/140147297771) If the second run also loses the sea, the render-mode query alone is sufficient to trigger the difference with the X memory profile held constant. If the sea stays stable, the full S profile still distinguishes the failing run. The Windows checks establish the inputs for that comparison. The water itself still needs the same-camera Radeon run.
Author
Owner

@⁠PastiiJay on GitHub · 2026-11-26 20:16 UTC · original

Thanks @⁠HandshakeHackin, holding the X memory profile and flipping only the render-mode query is a neat way to split this. We'll run the -SeriesX / -SeriesX -RenderS pair on the same save and post both results here.

**@⁠PastiiJay** on GitHub · 2026-11-26 20:16 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/73#issuecomment-7202491449) Thanks @⁠HandshakeHackin, holding the X memory profile and flipping only the render-mode query is a neat way to split this. We'll run the `-SeriesX` / `-SeriesX -RenderS` pair on the same save and post both results here.
This discussion has been locked. Commenting is limited to contributors.
No description provided.