GPU: an opt-in constant stands in for one view a named program writes (VICTORY_AMBIENT) #2619

Open
github-bot wants to merge 4 commits from github-bot/gh-2619 into main AGit
Owner

@⁠r4tedx on GitHub · 2026-11-25 16:58 UTC · original
r4tedx:gpu/ambient-stand-in-main → main · +1323 −12 · 5 files · 4 commits · open

Some outputs depend on inputs the host never fills. Light gathered by rays walks structures that are not built yet, so the program that resolves it leaves black (or whatever its memory held), and every shaded surface that reads it goes dark. This adds a run-time switch that clears one unordered view to a constant after every dispatch of one program the user names.

Opt-in, off by default. Nothing runs while VICTORY_AMBIENT is unset. No title program names or hashes appear in the code: the user names the program by the shader hash the log already prints.

Syntax

VICTORY_AMBIENT=<program>:<view>:<value>, rules separated by ;

  • <program>: the 16-hex-digit shader hash the log prints for the compute program (compute 0123456789abcdef).
  • <view>: the unordered view as the console shader addresses it: root parameter and table offset in dwords, s1+176 or 1+176 (the notation of the diagnostics' table listings). The address comes from the console code, so it holds across translator versions. An n-th-view index would shift as the translator finds more views.
  • <value>: a colour r,g,b[,a] (alpha 1 if left out). A float or normalized view takes it as it is (ClearUnorderedAccessViewFloat). An integer view takes it packed by the texture's format, or as named: rgb9e5=, r11g11b10= (into a 32-bit word) or rgba16f= (into R16G16B16A16_UINT / R32G32_UINT). A raw word is 0x..., mask (all ones) or zero, for an integer view of any width (zero clears float views too).

Example: VICTORY_AMBIENT=0123456789abcdef:s1+176:rgb9e5=0.3,0.294,0.282

(Level 0.3 per @⁠tippythetaidum's measurement against Series X footage in three prison shots, where 0.6 came out 12-16 display-luma steps too bright: #2619. The right level depends on the scene; it is a stand-in, not the title's lighting.)

What it does

  • After every dispatch of the named program, direct (dispatch) or indirect (execute_indirect of kind dispatch), the named view is cleared through the existing UAV clear path, between UAV barriers on the resource.
  • The first dispatch of a named program logs its table views, formats, size and the packed value. A rule naming a view the program does not have logs a warning once. Counts (filled / skipped) are logged every 5 s.
  • The slot sharing it relies on is now its own PR, #2871, as triage asked. This PR is stacked on it: the first two commits here are #2871's, so please merge #2871 first. The stand-in's own commits are the last two. Without #2871, each stand-in clear would take a fresh dynamic slot per dispatch per rule from the capped heap.

Tests

The title was not used in these tests.

  • the_ambient_stand_in_fills_the_named_views_after_the_named_program (WARP): a program writes three views of a title table. After it runs, the two views its rules name hold the R9G9B9E5 word and the RGBA16F colour, the third keeps what the program wrote, and a program no rule names changes nothing.
  • The slot tests (clears_of_one_view_in_a_list_share_a_dynamic_slot, and a_clear_after_a_cut_takes_a_new_slot_and_the_old_one_stays_held) are #2871's.
  • CPU tests in ambient.rs: R9G9B9E5 against a reference encoder (smallest shared exponent whose mantissas fit), small floats against a nearest-code search, rule parsing, and the packing chosen per format.
  • Results at a83bdc1d (on #2871 d3f9b11e, main f3578e38, WARP): cargo clippy -p victory-gpu --all-targets --locked -- -D warnings and the same with --all-features, both clean; VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib --locked: 251 passed, 0 failed, 1 ignored (an existing benchmark). The stacked VICTORY_STAND_IN branch (#2620, 33df0691): 253 passed, 0 failed, 1 ignored.

In game

In our play build (RTX 5070, local title data used for the in-game measurement; only log lines and a description of the picture are reported), with #2311 holding back the BVH walks:

  • With VICTORY_AMBIENT on the screen-probe resolve's R9G9B9E5 output, the prison cell scene was fully lit and textured. Earlier builds without it showed that scene dark, but they also lacked other changes, so this switch's share of the difference is not isolated.
  • VICTORY_STAND_IN filled the four held-back distant-shadow programs' 1280x720 R16_UINT masks: each logged fill=Ok on first use, and the combined fill count for both switches went 11 -> 348 over 2 min, 0 skipped. Whether all-ones is the right "lit" value for those masks still needs an A/B.

(VICTORY_STAND_IN is the follow-up PR, stacked on this one.)

Credits

  • The idea, and R9G9B9E5 held as 32-bit words, come from the Belobug fork (Belobug/VIctory-Belobug-AMD, 0603123 and 4f45ab8, GPL-3.0-or-later). That fork matches its program by name. Here the user names it by hash, so no program is named in the code.
  • The masks and zeros for narrower integer outputs follow ScarlettPort's stand-in encodings (ZigZagBoi1/ScarlettPort, runtime/victory/crates/victory-shader/src/emit/stand_in.rs, GPL-3.0-or-later).

🤖 Generated with Claude Code

**@⁠r4tedx** on GitHub · 2026-11-25 16:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619) `r4tedx:gpu/ambient-stand-in-main` → `main` · +1323 −12 · 5 files · 4 commits · open Some outputs depend on inputs the host never fills. Light gathered by rays walks structures that are not built yet, so the program that resolves it leaves black (or whatever its memory held), and every shaded surface that reads it goes dark. This adds a run-time switch that clears one unordered view to a constant after every dispatch of one program the user names. **Opt-in, off by default.** Nothing runs while `VICTORY_AMBIENT` is unset. No title program names or hashes appear in the code: the user names the program by the shader hash the log already prints. ### Syntax `VICTORY_AMBIENT=<program>:<view>:<value>`, rules separated by `;` - `<program>`: the 16-hex-digit shader hash the log prints for the compute program (`compute 0123456789abcdef`). - `<view>`: the unordered view as the console shader addresses it: root parameter and table offset in dwords, `s1+176` or `1+176` (the notation of the diagnostics' table listings). The address comes from the console code, so it holds across translator versions. An n-th-view index would shift as the translator finds more views. - `<value>`: a colour `r,g,b[,a]` (alpha 1 if left out). A float or normalized view takes it as it is (`ClearUnorderedAccessViewFloat`). An integer view takes it packed by the texture's format, or as named: `rgb9e5=`, `r11g11b10=` (into a 32-bit word) or `rgba16f=` (into `R16G16B16A16_UINT` / `R32G32_UINT`). A raw word is `0x...`, `mask` (all ones) or `zero`, for an integer view of any width (`zero` clears float views too). Example: `VICTORY_AMBIENT=0123456789abcdef:s1+176:rgb9e5=0.3,0.294,0.282` (Level 0.3 per @⁠tippythetaidum's measurement against Series X footage in three prison shots, where 0.6 came out 12-16 display-luma steps too bright: https://git.gtahub.st/github/Marvisak--VIctory/pulls/2619. The right level depends on the scene; it is a stand-in, not the title's lighting.) ### What it does - After every dispatch of the named program, direct (`dispatch`) or indirect (`execute_indirect` of kind dispatch), the named view is cleared through the existing UAV clear path, between UAV barriers on the resource. - The first dispatch of a named program logs its table views, formats, size and the packed value. A rule naming a view the program does not have logs a warning once. Counts (filled / skipped) are logged every 5 s. - The slot sharing it relies on is now its own PR, #2871, as triage asked. This PR is stacked on it: the first two commits here are #2871's, so please merge #2871 first. The stand-in's own commits are the last two. Without #2871, each stand-in clear would take a fresh dynamic slot per dispatch per rule from the capped heap. ### Tests The title was not used in these tests. - `the_ambient_stand_in_fills_the_named_views_after_the_named_program` (WARP): a program writes three views of a title table. After it runs, the two views its rules name hold the R9G9B9E5 word and the RGBA16F colour, the third keeps what the program wrote, and a program no rule names changes nothing. - The slot tests (`clears_of_one_view_in_a_list_share_a_dynamic_slot`, and `a_clear_after_a_cut_takes_a_new_slot_and_the_old_one_stays_held`) are #2871's. - CPU tests in `ambient.rs`: R9G9B9E5 against a reference encoder (smallest shared exponent whose mantissas fit), small floats against a nearest-code search, rule parsing, and the packing chosen per format. - Results at a83bdc1d (on #2871 d3f9b11e, `main` f3578e38, WARP): `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` and the same with `--all-features`, both clean; `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --lib --locked`: 251 passed, 0 failed, 1 ignored (an existing benchmark). The stacked VICTORY_STAND_IN branch (#2620, 33df0691): 253 passed, 0 failed, 1 ignored. ### In game In our play build (RTX 5070, local title data used for the in-game measurement; only log lines and a description of the picture are reported), with #2311 holding back the BVH walks: - With VICTORY_AMBIENT on the screen-probe resolve's R9G9B9E5 output, the prison cell scene was fully lit and textured. Earlier builds without it showed that scene dark, but they also lacked other changes, so this switch's share of the difference is not isolated. - VICTORY_STAND_IN filled the four held-back distant-shadow programs' 1280x720 R16_UINT masks: each logged fill=Ok on first use, and the combined fill count for both switches went 11 -> 348 over 2 min, 0 skipped. Whether all-ones is the right "lit" value for those masks still needs an A/B. (`VICTORY_STAND_IN` is the follow-up PR, stacked on this one.) ### Credits - The idea, and R9G9B9E5 held as 32-bit words, come from the Belobug fork ([Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD), 0603123 and 4f45ab8, GPL-3.0-or-later). That fork matches its program by name. Here the user names it by hash, so no program is named in the code. - The masks and zeros for narrower integer outputs follow ScarlettPort's stand-in encodings ([ZigZagBoi1/ScarlettPort](https://github.com/ZigZagBoi1/ScarlettPort), `runtime/victory/crates/victory-shader/src/emit/stand_in.rs`, GPL-3.0-or-later). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clear_unordered took a dynamic slot of the bound view heap on every call
and held it until the list was reset, so a list that clears the same
view many times (a per-frame clear inside a loop of passes, say) took one
slot per clear from the capped heap; when the pool runs out, later draws
and dispatches that need dynamic slots are dropped. The list's draw state
now keeps the slot it made per view (view heap, view, host resource) and
clears of that view reuse it. The cache lives with the slots: it goes
when the list is reset (or released) and at a cut of the list, where root
views are made again too. The host resource in the key is one the list
keeps, so its address names no other while the slot is held. The view is
now made before a slot is taken, so a view the host cannot make takes
none.

The clear itself moves into State::clear_view (taking the resolved view,
returning whether it was recorded), which clear_unordered calls after it
looks the title's CPU handle up; the test drives it directly.

Test (WARP): eight clears of a view take one slot, another view one
more, a further clear of the first none; the views hold their last
clears; the slots come back at reset. HostHeap::dynamic_free (tests
only) counts the free slots.

Split from #2619 at the maintainer's triage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A view cleared on both sides of a cut (a wait that moves the recording
on to a new host list), both segments submitted in order: the first
segment's clears share one slot, the cut gives none back, the second
segment takes one slot of its own (its view heap is bound afresh) and
shares it for its next clear, and both stay held until the list is
reset, when both come back. A read in each segment sees the last clear
recorded before it in that segment.

Suggested in review of #2871.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Some outputs have inputs the host never fills: light gathered by rays
walks structures that are not built yet, so the program that resolves it
leaves black (or whatever its memory held), and shaded surfaces read it.
VICTORY_AMBIENT=<program>:<view>:<value> clears one unordered view after
every dispatch, direct or indirect, of the program whose shader hash the
log prints, to a constant:

- the view as the console code addresses it: root parameter and table
  offset in dwords (s1+176, the diagnostics' notation). It comes from the
  shader, so it holds across translator versions; the n-th view would
  shift as the translator finds more;
- the value: r,g,b[,a]. A float or normalized view takes it as it is
  (ClearUnorderedAccessViewFloat); an integer view takes it packed:
  R9G9B9E5 or R11G11B10 into a 32-bit word, RGBA16F into
  R16G16B16A16_UINT or R32G32_UINT, by the texture's format or as named
  (rgb9e5=, r11g11b10=, rgba16f=); 0x..., mask (all ones) or zero is a
  raw word for an integer view of any width (zero clears floats too).

The clear goes through the existing UAV clear path (a dynamic slot of the
bound view heap), between UAV barriers on the resource. Nothing runs
while the variable is unset. The first dispatch of a named program logs
its table views, formats, size and the packed value; counts are logged
every 5 s.

Tests (WARP): a program writes three views of a title table; after it,
the two its rules name hold the R9G9B9E5 word and the RGBA16F colour,
the third keeps what it wrote, and a program no rule names changes
nothing. CPU: R9G9B9E5 against a reference encoder (smallest shared
exponent whose mantissas fit), small floats against a nearest-code
search, the rules' parsing and the packing chosen per format.

The idea, and R9G9B9E5 held as 32-bit words, come from the Belobug fork
(github.com/Belobug/VIctory-Belobug-AMD, 0603123 and 4f45ab8,
GPL-3.0-or-later), which matches its program by name; here the user
names it by hash, so no program is named in the code. The masks and
zeros for narrower integer outputs follow ScarlettPort's stand-in
encodings (github.com/ZigZagBoi1/ScarlettPort, emit/stand_in.rs,
GPL-3.0-or-later).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An indirect dispatch with a host pipeline and a count of zero runs no
records, but the stand-ins after it still cleared the named views, over
what the title expected them to keep (review of #2619). The stand-ins
follow shader work, so after an indirect dispatch:

- at most no records (MaxCommandCount 0): no clears;
- a record count in a buffer: the clears are predicated on it
  (SetPredication, D3D12_PREDICATION_OP_EQUAL_ZERO), so a count of zero
  skips them on the GPU. A predicate is a 64-bit value at an 8-byte
  aligned offset while the count is a 32-bit word anywhere, so the count
  is copied into the low half of the list's own predicate word (8 bytes
  of video memory, zeroed at creation, common between uses). The copy is
  recorded just before the execution, where it reads the count, so the
  word holds the count it read whatever its records then write; the
  clears after it move the word to PREDICATION and back. Only the Clear
  call is predicated, not the copies and barriers that ready its view.
  Without that word the clears are skipped and logged once;
- no count: every clear, as before.

Direct dispatches are unchanged.

Test (WARP): a view seeded with a sentinel, a host ExecuteIndirect of a
program that writes it (at most one record), then the stand-in. Count 0
(at offset 4, a nonzero word after it): the sentinel survives. Count 1:
the stand-in's value. At most no records: the sentinel. No count: the
stand-in's value.

Tests count their own stand-ins: under test, ambient::filled() is the
count of this thread (each test runs on its own), not the run's, which
the stand-in tests running alongside add to. The stand-in tests'
deltas of the shared count failed when they ran in parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:29 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 17:04 UTC · original

An indirect dispatch can have a valid pipeline and a zero count-buffer value. In that case ExecuteIndirect runs zero commands, but the success path still calls stand_ins and clears the named UAV. That can overwrite an output the title expected to keep. D3D12 command-count semantics

Should the clear run even when the indirect call executes zero commands? If it should only run after shader work, a focused regression test could seed the UAV with a sentinel, issue the indirect call with max = 1 and a zero count buffer, and verify that the sentinel survives.

Static review only.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-25 17:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7168957253) An indirect dispatch can have a valid pipeline and a zero count-buffer value. In that case `ExecuteIndirect` runs zero commands, but the success path still calls `stand_ins` and clears the named UAV. That can overwrite an output the title expected to keep. [D3D12 command-count semantics](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect#parameters) Should the clear run even when the indirect call executes zero commands? If it should only run after shader work, a focused regression test could seed the UAV with a sentinel, issue the indirect call with `max = 1` and a zero count buffer, and verify that the sentinel survives. Static review only. *AI-assisted with Codex.*
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 17:52 UTC · original

Reviewed together with #2620: this is the same new ambient.rs; #2620 is the superset (adds VICTORY_STAND_IN for programs that never run, ~250 more lines of docs + logic). If #2620 lands, this one is subsumed — the docs here are accurate on the spec (per-dispatch UAV clear between barriers, view addressed by console root-param + dword offset so it survives translator changes). Opt-in, off by default. CI green.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7170115509) Reviewed together with #2620: this is the same new `ambient.rs`; #2620 is the superset (adds `VICTORY_STAND_IN` for programs that never run, ~250 more lines of docs + logic). If #2620 lands, this one is subsumed — the docs here are accurate on the spec (per-dispatch UAV clear between barriers, view addressed by console root-param + dword offset so it survives translator changes). Opt-in, off by default. CI green.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 18:23 UTC · original

@⁠DrDarkDK, thanks, good catch. An indirect dispatch with a zero count ran nothing, but the stand-in still cleared the view. Fixed in the new commit on this branch (head 67320f31):

  • With at most zero records, nothing is cleared.
  • With a count buffer, the clear is predicated on the count (D3D12_PREDICATION_OP_EQUAL_ZERO), so a zero count skips it on the GPU. A predicate is a 64-bit value at an 8-byte-aligned offset, while the count is a 32-bit word anywhere, so the count is first copied into the low half of a zeroed 8-byte word the list owns. The copy is recorded just before ExecuteIndirect, at the point where the execution reads the count: after the count's host copy is refreshed and after the argument clamp's UAV barrier. Only the Clear call itself is predicated.
  • With no count buffer, it clears as before.

Regression test on WARP, as you suggested: the_ambient_stand_in_follows_only_indirect_dispatches_that_ran_records. It seeds the view with a sentinel and runs a host ExecuteIndirect with at most one record and a zero count, placed at an unaligned offset with a non-zero word after it. The sentinel survives. A count of one clears it, at most zero records keeps it, and no count clears it.

The same commit fixes a test flake: ambient::filled() now counts per calling thread under test, so stand-in tests running side by side no longer change each other's counts. The run-wide count in the log is unchanged.

clippy, both ways victory-gpu --lib, WARP, --test-threads=1 stand-in tests at --test-threads=4, 5 rounds
this PR, 67320f31 clean 205 passed, 0 failed, 1 ignored 7 of 7 each round
#2620, af1973b2 clean 207 passed, 0 failed, 1 ignored 9 of 9 each round

#2620 (VICTORY_STAND_IN) is rebased on this head and has the same fix for dispatches that don't run.

@⁠kotekompotek, thanks for reviewing both. Yes, #2620 is stacked on this one by design: this PR is the smaller, self-contained VICTORY_AMBIENT part, and #2620 adds only its last commit on top. If the maintainers prefer one PR, merging #2620 takes both.

The title was not used in these tests.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 18:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7170848706) @⁠DrDarkDK, thanks, good catch. An indirect dispatch with a zero count ran nothing, but the stand-in still cleared the view. Fixed in the new commit on this branch (head `67320f31`): - With at most zero records, nothing is cleared. - With a count buffer, the clear is predicated on the count (`D3D12_PREDICATION_OP_EQUAL_ZERO`), so a zero count skips it on the GPU. A predicate is a 64-bit value at an 8-byte-aligned offset, while the count is a 32-bit word anywhere, so the count is first copied into the low half of a zeroed 8-byte word the list owns. The copy is recorded just before `ExecuteIndirect`, at the point where the execution reads the count: after the count's host copy is refreshed and after the argument clamp's UAV barrier. Only the Clear call itself is predicated. - With no count buffer, it clears as before. Regression test on WARP, as you suggested: `the_ambient_stand_in_follows_only_indirect_dispatches_that_ran_records`. It seeds the view with a sentinel and runs a host `ExecuteIndirect` with at most one record and a zero count, placed at an unaligned offset with a non-zero word after it. The sentinel survives. A count of one clears it, at most zero records keeps it, and no count clears it. The same commit fixes a test flake: `ambient::filled()` now counts per calling thread under test, so stand-in tests running side by side no longer change each other's counts. The run-wide count in the log is unchanged. | | clippy, both ways | `victory-gpu --lib`, WARP, `--test-threads=1` | stand-in tests at `--test-threads=4`, 5 rounds | |---|---|---|---| | this PR, `67320f31` | clean | 205 passed, 0 failed, 1 ignored | 7 of 7 each round | | #2620, `af1973b2` | clean | 207 passed, 0 failed, 1 ignored | 9 of 9 each round | #2620 (`VICTORY_STAND_IN`) is rebased on this head and has the same fix for dispatches that don't run. @⁠kotekompotek, thanks for reviewing both. Yes, #2620 is stacked on this one by design: this PR is the smaller, self-contained `VICTORY_AMBIENT` part, and #2620 adds only its last commit on top. If the maintainers prefer one PR, merging #2620 takes both. The title was not used in these tests. AI-assisted
Author
Owner

@⁠Venom2054 on GitHub · 2026-11-25 18:25 UTC · original · edited 2026-11-25 18:27 UTC

I tested the two switches separately on an RTX 5070 Ti in the prison-window shot. I used the same local integration of #2619 (11012ead) and #2620 (9d73ed65), executable, initial save, starting caches, input sequence and SDR settings for all three runs. Character textures were present in the material buffer in every run.

Enabled switch Back of head Shirt Sky
Neither 1.33 0.36 220.01
Ambient only (#2619) 32.77 40.02 238.64
Four distant-shadow masks only (#2620) 1.31 0.37 219.84

Values are displayed SDR luma on a 0–255 scale, averaged within each region and then summarized by the median of three camera-matched frames per run. With ambient alone, the shirt lettering and seams became readable. Before lighting, the shirt's median RGB stayed within two code values per channel across all runs.

The captured screen-probe dispatch was direct (320×360×1). The ambient rule filled the 2560×1440 packed screen-probe output. In the shadow-only run, all four held-back passes reported a successful fill on their 1280×720 R16_UINT masks. The last counters were 197 ambient fills and 693 shadow fills respectively, with zero skipped in both runs.

This isolates a visible contribution from ambient in this shot. Filling the four distant-shadow masks with all ones on its own produced no appreciable change on the character here. Mask polarity and interaction with ambient remain open. The ambient result still looks flat, especially around the hair.

**@⁠Venom2054** on GitHub · 2026-11-25 18:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7170894581) · edited 2026-11-25 18:27 UTC I tested the two switches separately on an RTX 5070 Ti in the prison-window shot. I used the same local integration of #2619 (`11012ead`) and #2620 (`9d73ed65`), executable, initial save, starting caches, input sequence and SDR settings for all three runs. Character textures were present in the material buffer in every run. | Enabled switch | Back of head | Shirt | Sky | | --- | ---: | ---: | ---: | | Neither | 1.33 | 0.36 | 220.01 | | Ambient only (#2619) | 32.77 | 40.02 | 238.64 | | Four distant-shadow masks only (#2620) | 1.31 | 0.37 | 219.84 | Values are displayed SDR luma on a 0–255 scale, averaged within each region and then summarized by the median of three camera-matched frames per run. With ambient alone, the shirt lettering and seams became readable. Before lighting, the shirt's median RGB stayed within two code values per channel across all runs. The captured screen-probe dispatch was direct (320×360×1). The ambient rule filled the 2560×1440 packed screen-probe output. In the shadow-only run, all four held-back passes reported a successful fill on their 1280×720 R16_UINT masks. The last counters were 197 ambient fills and 693 shadow fills respectively, with zero skipped in both runs. This isolates a visible contribution from ambient in this shot. Filling the four distant-shadow masks with all ones on its own produced no appreciable change on the character here. Mask polarity and interaction with ambient remain open. The ambient result still looks flat, especially around the hair.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 18:28 UTC · original

@⁠Venom2054, thanks. The three runs on matched frames make this easy to read: ambient alone takes the back of the head from 1.33 to 32.77 and the shirt from 0.36 to 40.02, while the four distant-shadow masks alone change nothing measurable.

Two notes on the heads you tested:

  • 11012ead / 9d73ed65 predate the zero-count fix (DrDarkDK's report above). The current heads are 67320f31 (this PR) and af1973b2 (#2620). The fix only matters for indirect dispatches whose count is zero, so your runs should come out the same; your screen-probe dispatch was direct anyway.
  • "Flat" is what the ambient stand-in gives by design. It writes one constant into the packed screen-probe output in place of the probe GI the host doesn't produce yet: no direction, no occlusion. Detail around the hair would need the real probe and irradiance-cache passes, which are still refused on a 32-lane host.

On polarity: mask fills all ones. If those R16_UINT masks mean "1 = in shadow" in this title, all ones would keep the character shadowed, which looks the same as before. Two cheap checks on the same shot:

  1. the same four rules with zero in place of mask;
  2. ambient plus the masks together, once with mask and once with zero.

If zero brightens the character, the masks are "1 = shadowed". If neither moves it, those four distant passes aren't what darkens a close-up. The near cascades (cascadeshadows_rendering CS_ShadowRenderTiledCascades*) don't translate on a 32-lane host on main 940d32f (see my note on #1962), so a stand-in for one of them would need its own rule.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 18:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7170961074) @⁠Venom2054, thanks. The three runs on matched frames make this easy to read: ambient alone takes the back of the head from 1.33 to 32.77 and the shirt from 0.36 to 40.02, while the four distant-shadow masks alone change nothing measurable. Two notes on the heads you tested: - `11012ead` / `9d73ed65` predate the zero-count fix (DrDarkDK's report above). The current heads are `67320f31` (this PR) and `af1973b2` (#2620). The fix only matters for indirect dispatches whose count is zero, so your runs should come out the same; your screen-probe dispatch was direct anyway. - "Flat" is what the ambient stand-in gives by design. It writes one constant into the packed screen-probe output in place of the probe GI the host doesn't produce yet: no direction, no occlusion. Detail around the hair would need the real probe and irradiance-cache passes, which are still refused on a 32-lane host. On polarity: `mask` fills all ones. If those R16_UINT masks mean "1 = in shadow" in this title, all ones would keep the character shadowed, which looks the same as before. Two cheap checks on the same shot: 1. the same four rules with `zero` in place of `mask`; 2. ambient plus the masks together, once with `mask` and once with `zero`. If `zero` brightens the character, the masks are "1 = shadowed". If neither moves it, those four distant passes aren't what darkens a close-up. The near cascades (`cascadeshadows_rendering` CS_ShadowRenderTiledCascades*) don't translate on a 32-lane host on `main` 940d32f (see my note on #1962), so a stand-in for one of them would need its own rule. AI-assisted
Author
Owner

@⁠Venom2054 on GitHub · 2026-11-25 18:56 UTC · original

I ran the three follow-ups from your reply on the same RTX 5070 Ti using the same executable, initial state and camera-matching method as the earlier report. One run per setting, three matched window frames per run. The values are median displayed luma on the same 0–255 scale.

Distant-shadow setting Ambient Back of head Shirt Sky
Four masks set to zero Off 2.17 0.46 219.26
Four masks set to all ones On 32.89 39.92 238.81
Four masks set to zero On 32.94 41.61 236.76

For reference, ambient alone was 32.77 / 40.02 / 238.64. Each of the four 1280×720 R16_UINT outputs accepted the requested fill in each run. The last combined counters showed 928 fills for ambient + ones and 1,002 for ambient + zeros, with zero skipped in either run.

Changing the masks to zero without ambient left the character a silhouette. With ambient on, the lettering and collar stayed visible with either mask value. I could see individual strands at the right edge of the head in both the ambient-only and ambient-plus-ones frames, but no additional rim lighting or ponytail detail from the distant masks. This closes the interaction check for this close-up on these revisions. The small differences do not establish mask polarity elsewhere.

**@⁠Venom2054** on GitHub · 2026-11-25 18:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7171613552) I ran the three follow-ups from your reply on the same RTX 5070 Ti using the same executable, initial state and camera-matching method as the earlier report. One run per setting, three matched window frames per run. The values are median displayed luma on the same 0–255 scale. | Distant-shadow setting | Ambient | Back of head | Shirt | Sky | | --- | --- | ---: | ---: | ---: | | Four masks set to zero | Off | 2.17 | 0.46 | 219.26 | | Four masks set to all ones | On | 32.89 | 39.92 | 238.81 | | Four masks set to zero | On | 32.94 | 41.61 | 236.76 | For reference, ambient alone was 32.77 / 40.02 / 238.64. Each of the four 1280×720 R16_UINT outputs accepted the requested fill in each run. The last combined counters showed 928 fills for ambient + ones and 1,002 for ambient + zeros, with zero skipped in either run. Changing the masks to zero without ambient left the character a silhouette. With ambient on, the lettering and collar stayed visible with either mask value. I could see individual strands at the right edge of the head in both the ambient-only and ambient-plus-ones frames, but no additional rim lighting or ponytail detail from the distant masks. This closes the interaction check for this close-up on these revisions. The small differences do not establish mask polarity elsewhere.
Author
Owner

@⁠tippythetaidum on GitHub · 2026-11-25 21:53 UTC · original

Calibration data for the example value, measured against Series X footage instead of by eye.

On victory-fork (its own version of this switch, VICTORY_AMBIENT=<level>, written as level × (1.0, 0.98, 0.94) into the same screen-probe resolve output), level 0.6 is exactly this PR's example rgb9e5=0.6,0.588,0.564. I compared two 600 s runs on an RTX 5080 (Series X profile, ray-tracing structure builder off, otherwise the same build and settings) shot by shot with console footage of the same scenes. The numbers are the mean display luma of the whole frame (0-255, Rec. 709 weights, 240×135 downscale); the footage is a YouTube capture of the console:

shot Series X level 0.6 level 0.3
cell, Yolanda at the table (gameplay) 90 106 94
corridor with the guard (gameplay) 86 100 88
Lucia at the cell window (cutscene) 85 97 81

So 0.6 sits 12-16 above the console in these shots and 0.3 within 2-4. The rooms also lost their flat look at 0.3: ceilings and corners darker, closer to the footage. It's still one constant everywhere, so it can't give the console's falloff. The common room, about 52 in the footage, measured 86 at 0.6; I don't have a 0.3 shot of it yet. Most of the console's light there comes from the windows, which a constant can't follow.

Caveats: one machine, one capture of the footage (YouTube's encode and levels sit between the console and these numbers), and the shots are matched by camera, not frame-exact. If the example is meant as a sensible default, 0.3,0.294,0.282 measured closer here.

AI-assisted (Claude Code, Claude Opus 5.5): runs, captures, the measurement and this text. Numbers only; no frames attached.

**@⁠tippythetaidum** on GitHub · 2026-11-25 21:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7175666509) Calibration data for the example value, measured against Series X footage instead of by eye. On victory-fork (its own version of this switch, `VICTORY_AMBIENT=<level>`, written as `level × (1.0, 0.98, 0.94)` into the same screen-probe resolve output), level 0.6 is exactly this PR's example `rgb9e5=0.6,0.588,0.564`. I compared two 600 s runs on an RTX 5080 (Series X profile, ray-tracing structure builder off, otherwise the same build and settings) shot by shot with console footage of the same scenes. The numbers are the mean display luma of the whole frame (0-255, Rec. 709 weights, 240×135 downscale); the footage is a YouTube capture of the console: | shot | Series X | level 0.6 | level 0.3 | |---|---:|---:|---:| | cell, Yolanda at the table (gameplay) | 90 | 106 | 94 | | corridor with the guard (gameplay) | 86 | 100 | 88 | | Lucia at the cell window (cutscene) | 85 | 97 | 81 | So 0.6 sits 12-16 above the console in these shots and 0.3 within 2-4. The rooms also lost their flat look at 0.3: ceilings and corners darker, closer to the footage. It's still one constant everywhere, so it can't give the console's falloff. The common room, about 52 in the footage, measured 86 at 0.6; I don't have a 0.3 shot of it yet. Most of the console's light there comes from the windows, which a constant can't follow. Caveats: one machine, one capture of the footage (YouTube's encode and levels sit between the console and these numbers), and the shots are matched by camera, not frame-exact. If the example is meant as a sensible default, `0.3,0.294,0.282` measured closer here. AI-assisted (Claude Code, Claude Opus 5.5): runs, captures, the measurement and this text. Numbers only; no frames attached.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 21:55 UTC · original

@⁠tippythetaidum, thanks for measuring it against console footage. Three matched shots, with 0.6 at 12-16 over and 0.3 within 2-4, is enough to change the example. The PR description now suggests rgb9e5=0.3,0.294,0.282 and links your comment. The values in the tests stay as they are, because they check the parser, not a level.

Your caveat on the common room (about 52 on the console, 86 at 0.6) fits what the switch is: one constant for every pixel in place of probe lighting, so it can't match both a lit cell and a dim room. The real fix is getting the probe passes themselves to run, and the stand-in only bridges that gap.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 21:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7175708172) @⁠tippythetaidum, thanks for measuring it against console footage. Three matched shots, with 0.6 at 12-16 over and 0.3 within 2-4, is enough to change the example. The PR description now suggests `rgb9e5=0.3,0.294,0.282` and links your comment. The values in the tests stay as they are, because they check the parser, not a level. Your caveat on the common room (about 52 on the console, 86 at 0.6) fits what the switch is: one constant for every pixel in place of probe lighting, so it can't match both a lit cell and a dim room. The real fix is getting the probe passes themselves to run, and the stand-in only bridges that gap. AI-assisted
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:18 UTC · original · edited 2026-11-26 00:24 UTC

Automated triage for the maintainers.

Needs the maintainer's decision. The switch is opt-in, names no title program in code, and handles the zero-count indirect case raised in review (predicated clear).

On your reply: thanks for splitting the slot sharing out into #2871. That resolves the second point of the earlier triage. This branch still carries #2871's two commits (e7169ee, d3f9b11) under the stand-in's own (8d9a25b, a83bdc1), so it can only land after #2871. The scope question is still open and isn't something triage can settle. VICTORY_AMBIENT (crates/victory-gpu/src/ambient.rs, plus the dispatch hooks in draw.rs) overwrites a program's output with a hand-tuned constant in place of lighting the host doesn't produce. Whether VIctory wants user-configured per-program stand-ins of this kind is up to the maintainer. CI check is passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7176199762) · edited 2026-11-26 00:24 UTC <!-- victory-triage v1 head=a83bdc1d3d006943791372d7a3c393a47efba925 verdict=needs-work at=2026-11-26T00:24:25Z --> Automated triage for the maintainers. Needs the maintainer's decision. The switch is opt-in, names no title program in code, and handles the zero-count indirect case raised in review (predicated clear). On your reply: thanks for splitting the slot sharing out into #2871. That resolves the second point of the earlier triage. This branch still carries #2871's two commits (`e7169ee`, `d3f9b11`) under the stand-in's own (`8d9a25b`, `a83bdc1`), so it can only land after #2871. The scope question is still open and isn't something triage can settle. `VICTORY_AMBIENT` (`crates/victory-gpu/src/ambient.rs`, plus the dispatch hooks in `draw.rs`) overwrites a program's output with a hand-tuned constant in place of lighting the host doesn't produce. Whether VIctory wants user-configured per-program stand-ins of this kind is up to the maintainer. CI `check` is passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠r4tedx on GitHub · 2026-11-25 23:28 UTC · original

Following triage: the slot sharing (the old second commit, 11012ead) is now its own PR, #2871. It was adapted to main there, and a cut test was added in review. This PR is rebased on top of it, so its head a83bdc1d is #2871's two commits plus the stand-in's two (8d9a25b3, a83bdc1d). Please merge #2871 first. The stand-in code itself is unchanged; the only difference from the previous head is the rebase and #2871's added test.

WARP at a83bdc1d (on main f3578e38): clippy -D warnings clean with and without --all-features; victory-gpu lib 251 passed, 0 failed, 1 ignored. The description is updated to match. The title was not used in these tests.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-25 23:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2619#issuecomment-7177612176) Following triage: the slot sharing (the old second commit, 11012ead) is now its own PR, #2871. It was adapted to `main` there, and a cut test was added in review. This PR is rebased on top of it, so its head a83bdc1d is #2871's two commits plus the stand-in's two (8d9a25b3, a83bdc1d). Please merge #2871 first. The stand-in code itself is unchanged; the only difference from the previous head is the rebase and #2871's added test. WARP at a83bdc1d (on `main` f3578e38): clippy `-D warnings` clean with and without `--all-features`; victory-gpu lib 251 passed, 0 failed, 1 ignored. The description is updated to match. The title was not used in these tests. AI-assisted
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2619/head:github-bot/gh-2619'
git switch 'github-bot/gh-2619'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2619'
git switch 'github-bot/gh-2619'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2619'
git switch 'github-bot/gh-2619'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2619'
git switch 'main'
git merge --squash 'github-bot/gh-2619'
git switch 'main'
git merge --ff-only 'github-bot/gh-2619'
git switch 'main'
git merge 'github-bot/gh-2619'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2619
No description provided.