GPU: an opt-in constant takes the place of a named program that does not run (VICTORY_STAND_IN) #2618

Open
r4tedx wants to merge 5 commits from upstream-pr/2620 into main
r4tedx commented 2026-11-25 16:58:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by r4tedx on 2026-11-25T16:58:38Z.


Stacked on #2619 (VICTORY_AMBIENT), which is stacked on #2871 (clears of one view share one dynamic slot). Only the last commit is new here; merge order is #2871, #2619, then this.

A program can be held back (one walking acceleration structures the builder has not built yet), dropped, or left without a host pipeline (it does not translate). Its outputs then keep whatever the memory held, and the passes that read them see garbage: a shadow mask nothing writes can read as "in shadow" everywhere. This adds a run-time switch that clears the views a named program would have written, in place of a dispatch of it that did not run.

Opt-in, off by default. Nothing happens while VICTORY_STAND_IN is unset, and only named programs are touched. 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_STAND_IN=<program>:<view>:<value>, rules separated by ;, written exactly as for VICTORY_AMBIENT:

  • <program>: the 16-hex-digit shader hash the log prints for the compute program.
  • <view>: root parameter and table offset in dwords, s1+0 or 1+0.
  • <value>: r,g,b[,a], optionally rgb9e5= / r11g11b10= / rgba16f= for an integer view; or 0x..., mask, zero.

Example (a "lit" R16_FLOAT mask and an all-ones R8_UINT one): VICTORY_STAND_IN=0123456789abcdef:s1+0:1,1,1;0123456789abcdef:s1+8:mask. An integer view whose format does not say how a colour packs takes a raw word (0x..., mask, zero).

What it does

  • Where a dispatch of a named program, direct or indirect, does not run, its named views are cleared to the values in its place. None of the program runs, so it needs no translation, walks no structure, and holds back nothing that is held back now.
  • dispatch() and execute_indirect() become thin wrappers over their old bodies (run_dispatch() / run_indirect()), so every way a dispatch does not run reaches the stand-in. A direct dispatch records in the list state whether it ran, so an early return of any kind (skipped, held back, no host pipeline, tables not made) leaves the flag unset. An indirect dispatch returns false. Indirect draws are left alone.
  • The program's hash comes from the title pipeline without asking for a translation (pipeline::compute_hash). The program's views are not known when it does not run, so the rules are not checked against them. The first match logs the view, formats and value (with ran = false), as for VICTORY_AMBIENT.
  • The clears use the same path as VICTORY_AMBIENT, including its one dynamic slot per view per list.

Tests

The title was not used in these tests.

  • stand_ins_take_the_place_of_dispatches_that_do_not_run (WARP): three programs that do not translate, so they get no host pipeline, the same gate a held-back program meets. A named program's direct dispatch clears its two views (R16_FLOAT to 1, R8_UINT to a mask). A named program's indirect dispatch clears its view (0.5). An indirect draw, and a program no rule names, clear nothing, and no dispatch runs. Read back after the list: 1.0, 0xff, 0.5.
  • Results at 33df0691 (on #2619 a83bdc1d, #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: 253 passed, 0 failed, 1 ignored (an existing benchmark).

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.

Credits

  • The idea of standing in for a ray-traced shadow pass with "lit" comes from ScarlettPort's shadow-mask stand-in (ZigZagBoi1/ScarlettPort, runtime/victory/crates/victory-shader/src/emit/stand_in.rs, GPL-3.0-or-later). That version rewrites the program's stores at translation. Here the program does not run at all.
  • The rule format, value packing and clear path are from #2619, whose idea comes from the Belobug fork (Belobug/VIctory-Belobug-AMD, 0603123 and 4f45ab8, GPL-3.0-or-later).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6609478111 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2620). Originally posted by [r4tedx](https://github.com/r4tedx) on 2026-11-25T16:58:38Z. --- Stacked on #2619 (VICTORY_AMBIENT), which is stacked on #2871 (clears of one view share one dynamic slot). Only the last commit is new here; merge order is #2871, #2619, then this. A program can be held back (one walking acceleration structures the builder has not built yet), dropped, or left without a host pipeline (it does not translate). Its outputs then keep whatever the memory held, and the passes that read them see garbage: a shadow mask nothing writes can read as "in shadow" everywhere. This adds a run-time switch that clears the views a named program would have written, in place of a dispatch of it that did not run. **Opt-in, off by default.** Nothing happens while `VICTORY_STAND_IN` is unset, and only named programs are touched. 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_STAND_IN=<program>:<view>:<value>`, rules separated by `;`, written exactly as for `VICTORY_AMBIENT`: - `<program>`: the 16-hex-digit shader hash the log prints for the compute program. - `<view>`: root parameter and table offset in dwords, `s1+0` or `1+0`. - `<value>`: `r,g,b[,a]`, optionally `rgb9e5=` / `r11g11b10=` / `rgba16f=` for an integer view; or `0x...`, `mask`, `zero`. Example (a "lit" R16_FLOAT mask and an all-ones R8_UINT one): `VICTORY_STAND_IN=0123456789abcdef:s1+0:1,1,1;0123456789abcdef:s1+8:mask`. An integer view whose format does not say how a colour packs takes a raw word (`0x...`, `mask`, `zero`). ### What it does - Where a dispatch of a named program, direct or indirect, does not run, its named views are cleared to the values in its place. None of the program runs, so it needs no translation, walks no structure, and holds back nothing that is held back now. - `dispatch()` and `execute_indirect()` become thin wrappers over their old bodies (`run_dispatch()` / `run_indirect()`), so every way a dispatch does not run reaches the stand-in. A direct dispatch records in the list state whether it ran, so an early return of any kind (skipped, held back, no host pipeline, tables not made) leaves the flag unset. An indirect dispatch returns false. Indirect draws are left alone. - The program's hash comes from the title pipeline without asking for a translation (`pipeline::compute_hash`). The program's views are not known when it does not run, so the rules are not checked against them. The first match logs the view, formats and value (with `ran = false`), as for `VICTORY_AMBIENT`. - The clears use the same path as `VICTORY_AMBIENT`, including its one dynamic slot per view per list. ### Tests The title was not used in these tests. - `stand_ins_take_the_place_of_dispatches_that_do_not_run` (WARP): three programs that do not translate, so they get no host pipeline, the same gate a held-back program meets. A named program's direct dispatch clears its two views (R16_FLOAT to 1, R8_UINT to a mask). A named program's indirect dispatch clears its view (0.5). An indirect draw, and a program no rule names, clear nothing, and no dispatch runs. Read back after the list: 1.0, 0xff, 0.5. - Results at 33df0691 (on #2619 a83bdc1d, #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`: 253 passed, 0 failed, 1 ignored (an existing benchmark). ### 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. ### Credits - The idea of standing in for a ray-traced shadow pass with "lit" comes from ScarlettPort's shadow-mask stand-in ([ZigZagBoi1/ScarlettPort](https://github.com/ZigZagBoi1/ScarlettPort), `runtime/victory/crates/victory-shader/src/emit/stand_in.rs`, GPL-3.0-or-later). That version rewrites the program's stores at translation. Here the program does not run at all. - The rule format, value packing and clear path are from #2619, whose idea comes from the Belobug fork ([Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD), 0603123 and 4f45ab8, GPL-3.0-or-later). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kotekompotek commented 2026-11-25 18:02:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:52:18Z.


Reviewed: superset of #2619 — adds VICTORY_STAND_IN, where a program that cannot run (held, dropped, no pipeline) has its views cleared to the stand-in values without any code running. The distinction between the two knobs is well-drawn (ambient = program runs, view overwritten after; stand-in = program doesn't run at all, so views can't be validated). Both correctly opt-in and no-op when unset. CI green.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170116378 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2620#issuecomment-7170116378). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T17:52:18Z. --- Reviewed: superset of #2619 — adds `VICTORY_STAND_IN`, where a program that cannot run (held, dropped, no pipeline) has its views cleared to the stand-in values without any code running. The distinction between the two knobs is well-drawn (ambient = program runs, view overwritten after; stand-in = program doesn't run at all, so views can't be validated). Both correctly opt-in and no-op when unset. CI green.
Marvisak commented 2026-11-25 23:06:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:18:46Z.


Automated triage for the maintainers.

Needs the maintainer's decision. This PR's own commit is 33df069 (VICTORY_STAND_IN), stacked on #2619 and #2871, so it can only be decided after those two. The change isn't purely opt-in in structure. dispatch() and execute_indirect() in crates/victory-gpu/src/draw.rs become wrappers over run_dispatch() / run_indirect(), with a ran-flag in the list state, for every title, even when the variable is unset. By the in-game measurements in #2619's thread, the four shadow-mask stand-ins alone made no measurable difference, and the right mask value is still open.

On your reply: the rebase onto the split-out #2871 is noted. It doesn't change the open points: the scope decision on #2619 applies here too, and the evidence for this part is weaker. CI check is passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176205362 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2620#issuecomment-7176205362). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:18:46Z. --- <!-- victory-triage v1 head=33df069166e0c69275bf01aaa3c7ea761ea083ff verdict=needs-work at=2026-11-26T00:24:28Z --> Automated triage for the maintainers. Needs the maintainer's decision. This PR's own commit is `33df069` (`VICTORY_STAND_IN`), stacked on #2619 and #2871, so it can only be decided after those two. The change isn't purely opt-in in structure. `dispatch()` and `execute_indirect()` in `crates/victory-gpu/src/draw.rs` become wrappers over `run_dispatch()` / `run_indirect()`, with a ran-flag in the list state, for every title, even when the variable is unset. By the in-game measurements in #2619's thread, the four shadow-mask stand-ins alone made no measurable difference, and the right mask value is still open. On your reply: the rebase onto the split-out #2871 is noted. It doesn't change the open points: the scope decision on #2619 applies here too, and the evidence for this part is weaker. CI `check` is passing. --- _Generated by [Claude Code](https://claude.ai/code)_
r4tedx commented 2026-11-26 00:03:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by r4tedx on 2026-11-25T23:28:40Z.


Rebased with #2619, which is now stacked on #2871 (the slot sharing, split out at triage). This PR's own commit is the last one, 33df0691 (the same change as af1973b2). The merge order is #2871, #2619, then this.

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

AI-assisted

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177613640 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2620#issuecomment-7177613640). Originally posted by [r4tedx](https://github.com/r4tedx) on 2026-11-25T23:28:40Z. --- Rebased with #2619, which is now stacked on #2871 (the slot sharing, split out at triage). This PR's own commit is the last one, 33df0691 (the same change as af1973b2). The merge order is #2871, #2619, then this. WARP at 33df0691 (on `main` f3578e38): clippy `-D warnings` clean with and without `--all-features`; victory-gpu lib 253 passed, 0 failed, 1 ignored. The description is updated. The title was not used in these tests. AI-assisted
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2620:upstream-pr/2620'
git switch 'upstream-pr/2620'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2620'
git switch 'upstream-pr/2620'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2620'
git switch 'upstream-pr/2620'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2620'
git switch 'main'
git merge --squash 'upstream-pr/2620'
git switch 'main'
git merge --ff-only 'upstream-pr/2620'
git switch 'main'
git merge 'upstream-pr/2620'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2618
No description provided.