Shadows, sea floor and small surface spots flicker together with a still camera (AMD) #74

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

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

Same machine as #73. With the camera and the player perfectly still, several things flicker at the same moments: a small object's contact shadow, the sea floor seen through the water, and tiny spots of a wooden floor. Because they flicker together, we think it is one cause, probably a screen-space or shadow resource that is sometimes read before it is finished, or from the previous frame. Ideas welcome.

**@⁠PastiiJay** on GitHub · 2026-11-26 11:45 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/74) Same machine as #73. With the camera and the player perfectly still, several things flicker at the same moments: a small object's contact shadow, the sea floor seen through the water, and tiny spots of a wooden floor. Because they flicker together, we think it is one cause, probably a screen-space or shadow resource that is sometimes read before it is finished, or from the previous frame. Ideas welcome.
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:54 UTC · original

One way to narrow this down on beta-2 is to capture two consecutive presented frames at the fixed camera, one lit and one dark. In a diagnostics build, set VICTORY_CAPTURE to a folder and VICTORY_CAPTURE_FRAMES to the two frame numbers, with VICTORY_DUMP_TARGETS=1. Match the target by dimensions, format and resource in that run. If it alternates between two resources, keep both identities.

For a suspected R32_UINT shadow-mask table, compare the target values as words rows, especially zero and all_ones. Those count actual words. The PNGs are scaled per image, so an apparently brighter mask alone is ambiguous. Once you have a candidate writer from frame-<n>-ops.txt, VICTORY_DUMP_AFTER=<shader hash> takes a copy immediately after its draw or dispatch. If the mask already differs there, focus on its producer and inputs. If the producer outputs match but the displayed patches differ, the later passes are the place to look. Record whether the flicker survives capture, since readbacks add GPU work and transitions. Per-pass capture · Integer mask counters.

**@⁠HandshakeHackin** on GitHub · 2026-11-26 11:54 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/74#issuecomment-7191310553) One way to narrow this down on `beta-2` is to capture two consecutive presented frames at the fixed camera, one lit and one dark. In a diagnostics build, set `VICTORY_CAPTURE` to a folder and `VICTORY_CAPTURE_FRAMES` to the two frame numbers, with `VICTORY_DUMP_TARGETS=1`. Match the target by dimensions, format and resource in that run. If it alternates between two resources, keep both identities. For a suspected R32_UINT shadow-mask table, compare the `target values as words` rows, especially `zero` and `all_ones`. Those count actual words. The PNGs are scaled per image, so an apparently brighter mask alone is ambiguous. Once you have a candidate writer from `frame-<n>-ops.txt`, `VICTORY_DUMP_AFTER=<shader hash>` takes a copy immediately after its draw or dispatch. If the mask already differs there, focus on its producer and inputs. If the producer outputs match but the displayed patches differ, the later passes are the place to look. Record whether the flicker survives capture, since readbacks add GPU work and transitions. [Per-pass capture](https://github.com/PastiiJay/klbf-lab/blob/74a7e38358898b0ec698dc4ae9cfd848bab06525/crates/victory-gpu/src/capture.rs#L311-L319) · [Integer mask counters](https://github.com/PastiiJay/klbf-lab/blob/74a7e38358898b0ec698dc4ae9cfd848bab06525/crates/victory-gpu/src/capture.rs#L938-L973).
Author
Owner

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

Thanks @⁠HandshakeHackin, that's a much better way in than guessing switches. We're building a diagnostics build now and will capture two consecutive frames, one lit and one dark, at the same fixed camera, with VICTORY_DUMP_TARGETS=1. If a target alternates between two resources, we'll follow it back to its writer with VICTORY_DUMP_AFTER. We'll post what we find here.

One extra detail from today: the sea floor keeps the same flicker rhythm whatever we change on the water path, while the sea surface (#73) changes rhythm with VICTORY_CLAMP_AHEAD=0 / VICTORY_INDIRECT_RAW=1. So these look like two separate causes.

**@⁠PastiiJay** on GitHub · 2026-11-26 11:56 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/74#issuecomment-7191360685) Thanks @⁠HandshakeHackin, that's a much better way in than guessing switches. We're building a diagnostics build now and will capture two consecutive frames, one lit and one dark, at the same fixed camera, with `VICTORY_DUMP_TARGETS=1`. If a target alternates between two resources, we'll follow it back to its writer with `VICTORY_DUMP_AFTER`. We'll post what we find here. One extra detail from today: the sea floor keeps the same flicker rhythm whatever we change on the water path, while the sea surface (#73) changes rhythm with `VICTORY_CLAMP_AHEAD=0` / `VICTORY_INDIRECT_RAW=1`. So these look like two separate causes.
Author
Owner

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

Capture results (same still-camera run as #73), and it's a separate cause from the sea, as suspected:

The sand, contact shadow and deck spots all live in the G-buffer albedo (1280x720, R8G8B8A8_TYPELESS), which toggles between two states: one with decals (wet sand, worn rug) and one without (dry sand, plain rug). Within a state the frames differ by 4.5–7.7; across states by 9–17.5. The likely writer is a deferred-decal pass: 64 indirect draws, vertex 167501e87c356551, pixel shaders 144249440a4b420e to fa3534fe1e406e51. It has no render target and writes the albedo through UAVs, depth-tested, followed by compute 565cc0b38920b229. The draw list is identical in both states, so the decals are recorded every frame but their result is lost on some frames. Our guess is submission order, or a missing UAV/RT barrier against the G-buffer lists that overwrite them. Next: VICTORY_DUMP_AFTER on those decal shaders.

**@⁠PastiiJay** on GitHub · 2026-11-26 12:15 UTC · [original](https://github.com/PastiiJay/klbf-lab/issues/74#issuecomment-7191761190) Capture results (same still-camera run as #73), and it's a separate cause from the sea, as suspected: The sand, contact shadow and deck spots all live in the G-buffer albedo (1280x720, R8G8B8A8_TYPELESS), which toggles between two states: one with decals (wet sand, worn rug) and one without (dry sand, plain rug). Within a state the frames differ by 4.5–7.7; across states by 9–17.5. The likely writer is a deferred-decal pass: 64 indirect draws, vertex `167501e87c356551`, pixel shaders `144249440a4b420e` to `fa3534fe1e406e51`. It has no render target and writes the albedo through UAVs, depth-tested, followed by compute `565cc0b38920b229`. The draw list is identical in both states, so the decals are recorded every frame but their result is lost on some frames. Our guess is submission order, or a missing UAV/RT barrier against the G-buffer lists that overwrite them. Next: `VICTORY_DUMP_AFTER` on those decal shaders.
This discussion has been locked. Commenting is limited to contributors.
No description provided.