Guard reflection holds against empty indirect dispatches #127

Manually merged
github merged 3 commits from github-bot/gh-127 into main 2026-11-27 04:15:41 +00:00 AGit
Owner

@⁠TaynanGT on GitHub · 2026-11-27 03:11 UTC · original
TaynanGT:fix/reflection-nonempty-dispatch → main · +606 −30 · 3 files · 3 commits · merged 2026-11-27 04:11 UTC

Brings the reflection hold from #99 onto main with CowboyBingus’s authorship preserved. This also addresses the empty indirect-dispatch finding in #120.

For a single uncounted indirect resolve, the GPU reads the actual group counts after the clamp. If any dimension is zero, the hold leaves the reflection texture untouched. Counted and multiple-record indirect resolves skip the hold. The ordinary ambient pass keeps its existing root signature.

  • WARP readback preserved the texture for zero X, Y and Z separately, and for an oversized dispatch that the GPU clamp turned into [0, 0, 0]. A valid dispatch changed the texel.
  • The targeted run reported no Direct3D debug-layer errors. Seven ambient tests and eight indirect tests passed, with one existing test ignored. Clippy passed with and without diagnostics.

I’d like to repeat the RTX 5070 Ti scene before merging. The new indirect_gated and multiple counters show which path was recorded. The repeat should also check the image and GPU time.

**@⁠TaynanGT** on GitHub · 2026-11-27 03:11 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127) `TaynanGT:fix/reflection-nonempty-dispatch` → `main` · +606 −30 · 3 files · 3 commits · merged 2026-11-27 04:11 UTC Brings the reflection hold from #99 onto `main` with CowboyBingus’s authorship preserved. This also addresses the empty indirect-dispatch finding in #120. For a single uncounted indirect resolve, the GPU reads the actual group counts after the clamp. If any dimension is zero, the hold leaves the reflection texture untouched. Counted and multiple-record indirect resolves skip the hold. The ordinary ambient pass keeps its existing root signature. - WARP readback preserved the texture for zero X, Y and Z separately, and for an oversized dispatch that the GPU clamp turned into `[0, 0, 0]`. A valid dispatch changed the texel. - The targeted run reported no Direct3D debug-layer errors. Seven ambient tests and eight indirect tests passed, with one existing test ignored. Clippy passed with and without diagnostics. I’d like to repeat the RTX 5070 Ti scene before merging. The new `indirect_gated` and `multiple` counters show which path was recorded. The repeat should also check the image and GPU time.
With the ray-tracing structure builder off, the stand-in for the indirect
light (VICTORY_AMBIENT) can now also hold the image the reflections'
resolve programs write: right after such a program each texel is held to
no more than a multiple of the stand-in's light around it, hue kept.

Off by default. It acts only when all of these hold:
- VICTORY_AMBIENT_REFLECT=<multiple> (a positive number; unset, 0 or off:
  the title's own reflections);
- VICTORY_AMBIENT_REFLECT_IN=<text>[,<text>]: text in the names of the
  programs that resolve the reflections (given at run time, so the
  reflections' programs are not named in the code; these texts are looked
  for after the other roles' names);
- the stand-in on (VICTORY_AMBIENT set) and the builder not running. With
  VICTORY_AMBIENT_RT the stand-in also runs while the builder does; the
  hold does not.

The hold's pass is compiled only when both switches are set, and a
failure to make it leaves the rest of the stand-in running. The hook
after indirect dispatches runs only for the reflections' resolve, so the
other roles are unchanged.

Ported from Serph91P's avatarmanz/VIctory-7900XTX#314 (commit 6c7e3a87,
GPL-3.0-or-later): the HOLD pass, the Reflect role and the hook after indirect
dispatches. That the reflections can be held to the ambient light, and the
switch's name, are beloooo's (VIctory-Belobug-AMD 44dcd437). Left out of
the port: the replay's --reflect and the docs.

Tests: ambient::tests::settings (the two switches' parsing),
roles_by_name (Reflect only by the given texts; none without them),
the_hold_compiles (the HOLD pass compiles with the system's compiler).
After an ExecuteIndirect with a count buffer the record count is read on
the card and may be 0, and a Dispatch may ask for no groups. The resolve
then writes nothing, and a hold recorded after it would rewrite what the
image held before. In both cases the hold is no longer recorded. The first
time each happens while `ambient::after` would record a hold (the image's
view is not checked), an INFO line says so:
"reflections not held after a counted indirect dispatch" and
"reflections not held after a dispatch of no groups".

To show which ways the title dispatches the resolves, they are counted
by how they were dispatched: holds after a Dispatch and after an
ExecuteIndirect without a count buffer; counted and empty resolves left
alone (counted only while `ambient::after` would record a hold; the
image's view is not checked). The counts are logged at INFO at the first
noted resolve 100 or more frames after the first noted one, then at most
once every 1000 frames
("reflections' resolves: held after a direct dispatch, held after an
indirect one without a count, not held after a counted one or a direct
one of no groups", with frames, direct, indirect, counted and empty).

Nothing changes while the hold is off (VICTORY_AMBIENT_REFLECT or
VICTORY_AMBIENT_REFLECT_IN unset): no program has the reflections' role
(Role::Reflect), so neither
the new branches nor the counts are reached.

Not covered: an ExecuteIndirect without a count buffer whose records ask
for no groups; the hold still follows it.

Test: ambient::tests::counts_by_dispatch_are_due_after_the_first_note_then_every_so_often.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:16:07 +00:00
Author
Owner

@⁠CowboyBingus on GitHub · 2026-11-27 03:50 UTC · original

Ran #127 on the same setup as before.

Setup: a --profile diag --features diagnostics build of 486076d3 (exe md5 3fe5c262…). RTX 5070 Ti, Windows 11, Series S, play.ps1 -Machine 4070 (log line 1: "Settings for the 4070."), with VICTORY_AMBIENT_REFLECT=1 and VICTORY_AMBIENT_REFLECT_IN set. The builder was off (32 "structure builder, which is off" lines). One run capped at 230 s, with a screenshot about every 2.3 s (98 shots).

Counters (every count line in the log; the last is at frames=2100):

frames=100 direct=0 indirect_gated=199 counted=0 empty=0 multiple=0
frames=1100 direct=0 indirect_gated=2201 counted=0 empty=0 multiple=0
frames=2100 direct=0 indirect_gated=4201 counted=0 empty=0 multiple=0

Timing. The figures below are from the frame lines with more than 1,000 draws (n=31 for #127, n=32 for fa90adf). We have no per-pass GPU timing for this run. The card-busy figure is the average of the "the card about N% busy" lines over the whole log (218 lines for #127, 220 for fa90adf).

Build Median ms/frame Median "on the GPU" (ms) Card busy (avg)
#127 (486076d3) 48.8 0.8 48.6%
fa90adf (previous run) 46.65 0.65 59.9%

Eyes: in the close-ups at s0118, s0122, s0125 and s0127, the irises are dark, with no blue-white glow.

Separate observation. In this run one character's face had multicoloured block patches at s0113 and s0115. The same kind of patches appear in an earlier run of plain 4e3e366 (default 4090 settings, no reflection switches, only VICTORY_GPU_TIMING=1). Their cause is not established.

**@⁠CowboyBingus** on GitHub · 2026-11-27 03:50 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7209318425) Ran #127 on the same setup as before. **Setup:** a `--profile diag --features diagnostics` build of `486076d3` (exe md5 `3fe5c262…`). RTX 5070 Ti, Windows 11, Series S, `play.ps1 -Machine 4070` (log line 1: "Settings for the 4070."), with `VICTORY_AMBIENT_REFLECT=1` and `VICTORY_AMBIENT_REFLECT_IN` set. The builder was off (32 "structure builder, which is off" lines). One run capped at 230 s, with a screenshot about every 2.3 s (98 shots). **Counters** (every count line in the log; the last is at frames=2100): ``` frames=100 direct=0 indirect_gated=199 counted=0 empty=0 multiple=0 frames=1100 direct=0 indirect_gated=2201 counted=0 empty=0 multiple=0 frames=2100 direct=0 indirect_gated=4201 counted=0 empty=0 multiple=0 ``` **Timing.** The figures below are from the frame lines with more than 1,000 draws (n=31 for #127, n=32 for `fa90adf`). We have no per-pass GPU timing for this run. The card-busy figure is the average of the "the card about N% busy" lines over the whole log (218 lines for #127, 220 for `fa90adf`). | Build | Median ms/frame | Median "on the GPU" (ms) | Card busy (avg) | |---|---|---|---| | #127 (`486076d3`) | 48.8 | 0.8 | 48.6% | | `fa90adf` (previous run) | 46.65 | 0.65 | 59.9% | **Eyes:** in the close-ups at s0118, s0122, s0125 and s0127, the irises are dark, with no blue-white glow. **Separate observation.** In this run one character's face had multicoloured block patches at s0113 and s0115. The same kind of patches appear in an earlier run of plain 4e3e366 (default 4090 settings, no reflection switches, only `VICTORY_GPU_TIMING=1`). Their cause is not established.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-27 03:59 UTC · original · edited 2026-11-27 04:02 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T04:01:17.346420Z 486076d Draft marked ready
🔒 Security Review ✅ Completed 2026-11-27T04:02:36.102833Z 486076d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-27 03:59 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7209433982) · edited 2026-11-27 04:02 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"486076d35185effbd619ba5d2ebf0e550a9df20c","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":"486076d35185effbd619ba5d2ebf0e550a9df20c","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} --> <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"486076d35185effbd619ba5d2ebf0e550a9df20c","mergeGateEnabled":false,"pullRequestNumber":127,"repository":"TaynanGT/Vice-Tay","status":"completed"} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-27T04:01:17.346420Z">2026-11-27T04:01:17.346420Z</relative-time> | `486076d` | Draft marked ready | | 🔒 **Security Review** | ✅ **Completed** <relative-time datetime="2026-11-27T04:02:36.102833Z">2026-11-27T04:02:36.102833Z</relative-time> | `486076d` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 03:59 UTC · original

Thanks for repeating the scene on the RTX 5070 Ti, @⁠CowboyBingus. The 4,201 gated calls and the close-ups with dark irises answer the functional check. I also tested #127 against current main: all 22 enabled ambient and indirect tests passed, including the WARP test for empty dispatches. I moved this out of draft for review as an opt-in change. The 48.8 vs 46.65 ms frame medians describe the two runs, and a per-pass capture would be needed to measure the cost of the hold itself. The face patches can be tracked separately from this change.

**@⁠TaynanGT** on GitHub · 2026-11-27 03:59 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7209436588) Thanks for repeating the scene on the RTX 5070 Ti, @⁠CowboyBingus. The 4,201 gated calls and the close-ups with dark irises answer the functional check. I also tested #127 against current `main`: all 22 enabled ambient and indirect tests passed, including the WARP test for empty dispatches. I moved this out of draft for review as an opt-in change. The 48.8 vs 46.65 ms frame medians describe the two runs, and a per-pass capture would be needed to measure the cost of the hold itself. The face patches can be tracked separately from this change.
github manually merged commit 2182d7d2da into main 2026-11-27 04:15:41 +00:00
Author
Owner

@⁠Geckomacabre on GitHub · 2026-11-27 04:36 UTC · original

A question about using this: which name text did you pass in VICTORY_AMBIENT_REFLECT_IN for this title? The PR describes "text in the names of the programs that resolve the reflections" and says you used VICTORY_AMBIENT_REFLECT=1, but not the text. We had held a different pass before (the history update at table 1, dword 40) and would like to switch to this hold with the same programs you tested, so the image lookup at (1,128)/(1,136) matches.

🤖 Generated with Claude Code

**@⁠Geckomacabre** on GitHub · 2026-11-27 04:36 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7209942269) A question about using this: which name text did you pass in `VICTORY_AMBIENT_REFLECT_IN` for this title? The PR describes "text in the names of the programs that resolve the reflections" and says you used `VICTORY_AMBIENT_REFLECT=1`, but not the text. We had held a different pass before (the history update at table 1, dword 40) and would like to switch to this hold with the same programs you tested, so the image lookup at (1,128)/(1,136) matches. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 04:39 UTC · original

@⁠Geckomacabre The original port in avatarmanz/VIctory-7900XTX#314 matches CS_TemporalResolve2_Opaque and CS_TemporalResolve1_Alpha. Vice-Tay takes comma-separated substrings, so the equivalent launcher settings are:

-More @{ VICTORY_AMBIENT_REFLECT='1'; VICTORY_AMBIENT_REFLECT_IN='CS_TemporalResolve2_Opaque,CS_TemporalResolve1_Alpha' }

Keep the ambient stand-in enabled and the structure builder off, then check for role=Reflect in the log. The 5070 Ti report says the filter was set. @⁠CowboyBingus, could you confirm whether you used this exact pair on 486076d3?

**@⁠TaynanGT** on GitHub · 2026-11-27 04:39 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7209979617) @⁠Geckomacabre The original port in avatarmanz/VIctory-7900XTX#314 matches `CS_TemporalResolve2_Opaque` and `CS_TemporalResolve1_Alpha`. Vice-Tay takes comma-separated substrings, so the equivalent launcher settings are: ```powershell -More @{ VICTORY_AMBIENT_REFLECT='1'; VICTORY_AMBIENT_REFLECT_IN='CS_TemporalResolve2_Opaque,CS_TemporalResolve1_Alpha' } ``` Keep the ambient stand-in enabled and the structure builder off, then check for `role=Reflect` in the log. The 5070 Ti report says the filter was set. @⁠CowboyBingus, could you confirm whether you used this exact pair on `486076d3`?
Author
Owner

@⁠CowboyBingus on GitHub · 2026-11-27 04:47 UTC · original

@⁠TaynanGT Yes, that exact pair. The #127 run (exe md5 3fe5c262…, built from 486076d3) had VICTORY_AMBIENT_REFLECT=1, and VICTORY_AMBIENT_REFLECT_IN set to the two names in your comment, comma-separated in the same order, according to the settings recorded for the run.

The log has one role=Reflect line:

a stand-in for the indirect light role=Reflect size=[1280, 720] level=0.800000011920929 constant=0.0

The structure builder was off: there are 32 "structure builder, which is off" lines. The stand-in was on: play.ps1 sets VICTORY_AMBIENT=0.8, and the line above shows level 0.8.

**@⁠CowboyBingus** on GitHub · 2026-11-27 04:47 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7210094542) @⁠TaynanGT Yes, that exact pair. The #127 run (exe md5 `3fe5c262…`, built from `486076d3`) had `VICTORY_AMBIENT_REFLECT=1`, and `VICTORY_AMBIENT_REFLECT_IN` set to the two names in your comment, comma-separated in the same order, according to the settings recorded for the run. The log has one `role=Reflect` line: ``` a stand-in for the indirect light role=Reflect size=[1280, 720] level=0.800000011920929 constant=0.0 ``` The structure builder was off: there are 32 "structure builder, which is off" lines. The stand-in was on: `play.ps1` sets `VICTORY_AMBIENT=0.8`, and the line above shows level 0.8.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 04:52 UTC · original

Thanks for confirming the exact pair, @⁠CowboyBingus. That ties CS_TemporalResolve2_Opaque,CS_TemporalResolve1_Alpha to the 486076d3 RTX 5070 Ti run. The role=Reflect line confirms the 1280×720 target with the ambient stand-in at 0.8 and the builder off.

**@⁠TaynanGT** on GitHub · 2026-11-27 04:52 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/127#issuecomment-7210160399) Thanks for confirming the exact pair, @⁠CowboyBingus. That ties `CS_TemporalResolve2_Opaque,CS_TemporalResolve1_Alpha` to the `486076d3` RTX 5070 Ti run. The `role=Reflect` line confirms the 1280×720 target with the ambient stand-in at 0.8 and the builder off.
This discussion has been locked. Commenting is limited to contributors.
No description provided.