GPU: give screen passes dedicated pipeline workers and wait budget (fixes #2433) #2435

Open
github-bot wants to merge 1 commit from github-bot/gh-2435 into main AGit
Owner

@⁠pushkarreddyy on GitHub · 2026-11-25 13:28 UTC · original
pushkarreddyy:feat/gpu-screen-pass-pipeline-workers → main · +89 −26 · 2 files · 1 commits · open

Fixes #2433.

Root Cause

One-off screen passes (no vertex input, no depth/stencil testing, triangle topology) — such as PS_IntegrateEnvBRDF* and PS_AreaLightIlluminance that fill lighting tables once at world entry — previously shared the same worker pool and 500 ms per-frame wait budget (BUDGET) as 1,200+ world mesh and compute pipelines. Stuck behind world pipelines, they waited past the frame budget and were dropped, leaving diffuse lighting tables unpopulated.

Implementation Details

  1. Screen-Pass Classification (crates/victory-gpu/src/pipeline/host.rs):
    • Added GraphicsState::screen_pass(&self) -> bool, returning true when inputs is empty, depth_format == DXGI_FORMAT_UNKNOWN or both DepthEnable and StencilEnable are false, and topology == D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE.
  2. Dedicated Workers & Budget (crates/victory-gpu/src/pipeline/make.rs):
    • Added screen: bool to Pending.
    • Split QUEUES, WORKERS, and wait()'s per-frame FRAME/WAITED_US tracking into two independent kinds: ordinary pipelines (BUDGET = 500 ms, 2..=8 workers) and screen passes (SCREEN_BUDGET = 20 s, 2 dedicated victory-pipelines-screen-* workers).

Verification

  • Added screen_pass_requires_triangle_without_inputs_or_depth unit test in crates/victory-gpu/src/pipeline/host.rs verifying depth-free triangle pass classification, depth-enabled rejection, and vertex-input rejection.
  • Existing draws_go_ahead_of_early_starts and first_use_is_made_by_a_worker tests in make.rs remain intact.

Scope & Limitations

  • Adapted from @Belobug's VIctory-Belobug-AMD@18e57db onto current main (940d32f).
  • Only screen-pass scheduling and wait budget are changed; shader translation and host PSO creation are unchanged.
  • No title files or proprietary assets were used.
**@⁠pushkarreddyy** on GitHub · 2026-11-25 13:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435) `pushkarreddyy:feat/gpu-screen-pass-pipeline-workers` → `main` · +89 −26 · 2 files · 1 commits · open Fixes #2433. ### Root Cause One-off screen passes (no vertex input, no depth/stencil testing, triangle topology) — such as `PS_IntegrateEnvBRDF*` and `PS_AreaLightIlluminance` that fill lighting tables once at world entry — previously shared the same worker pool and 500 ms per-frame wait budget (`BUDGET`) as 1,200+ world mesh and compute pipelines. Stuck behind world pipelines, they waited past the frame budget and were dropped, leaving diffuse lighting tables unpopulated. ### Implementation Details 1. **Screen-Pass Classification (`crates/victory-gpu/src/pipeline/host.rs`):** - Added `GraphicsState::screen_pass(&self) -> bool`, returning `true` when `inputs` is empty, `depth_format == DXGI_FORMAT_UNKNOWN` or both `DepthEnable` and `StencilEnable` are false, and `topology == D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE`. 2. **Dedicated Workers & Budget (`crates/victory-gpu/src/pipeline/make.rs`):** - Added `screen: bool` to `Pending`. - Split `QUEUES`, `WORKERS`, and `wait()`'s per-frame `FRAME`/`WAITED_US` tracking into two independent kinds: ordinary pipelines (`BUDGET = 500 ms`, `2..=8` workers) and screen passes (`SCREEN_BUDGET = 20 s`, `2` dedicated `victory-pipelines-screen-*` workers). ### Verification - Added `screen_pass_requires_triangle_without_inputs_or_depth` unit test in `crates/victory-gpu/src/pipeline/host.rs` verifying depth-free triangle pass classification, depth-enabled rejection, and vertex-input rejection. - Existing `draws_go_ahead_of_early_starts` and `first_use_is_made_by_a_worker` tests in `make.rs` remain intact. ### Scope & Limitations - Adapted from `@Belobug`'s `VIctory-Belobug-AMD@18e57db` onto current `main` (`940d32f`). - Only screen-pass scheduling and wait budget are changed; shader translation and host PSO creation are unchanged. - No title files or proprietary assets were used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:05:43 +00:00
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-25 13:36 UTC · original

Hi @⁠Marvisak — this PR resolves #2433 (dedicated pipeline workers and 20 s per-frame budget for screen passes so first-frame lighting table draws like PS_IntegrateEnvBRDF* and PS_AreaLightIlluminance are not dropped behind world pipelines), adapted from @Belobug's VIctory-Belobug-AMD@18e57db onto main (940d32f). Ready for review and merge whenever convenient!

**@⁠pushkarreddyy** on GitHub · 2026-11-25 13:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7164023284) Hi @⁠Marvisak — this PR resolves #2433 (dedicated pipeline workers and 20 s per-frame budget for screen passes so first-frame lighting table draws like `PS_IntegrateEnvBRDF*` and `PS_AreaLightIlluminance` are not dropped behind world pipelines), adapted from `@Belobug`'s `VIctory-Belobug-AMD@18e57db` onto `main` (`940d32f`). Ready for review and merge whenever convenient!
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-25 14:19 UTC · original

If any testers on untested GPU models (NVIDIA RTX 30/40/50 series, AMD RDNA2/RDNA3/RDNA4, Intel Arc, or Linux/Wine/vkd3d-proton) can test deefe98 at world entry for first-frame diffuse lighting / indoor bloom, test reports would be greatly appreciated!

AI-assisted: yes (Gemini 4 Neon)

**@⁠pushkarreddyy** on GitHub · 2026-11-25 14:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7165093507) If any testers on untested GPU models (NVIDIA RTX 30/40/50 series, AMD RDNA2/RDNA3/RDNA4, Intel Arc, or Linux/Wine/vkd3d-proton) can test `deefe98` at world entry for first-frame diffuse lighting / indoor bloom, test reports would be greatly appreciated! AI-assisted: yes (Gemini 4 Neon)
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 14:24 UTC · original

Reviewed — the split is coherent:

  • screen_pass classification is safe: no vertex input + triangle topology can only be a procedural/fullscreen draw; depth disabled or absent matches the lighting-table fills. A misclassified draw would only get the longer budget — benign.
  • Per-kind queues (2 workers), per-kind FRAME/WAITED_US budget accounting, and per-kind wait in wait() keep the two pools fully independent — a screen draw cannot drain the ordinary 500 ms and vice versa.
  • SCREEN_BUDGET = 20 s stays under the title 30 s watchdog, so the drop path remains the documented fallback.

Merge note: this rewrites queue() where #2250's VICTORY_PIPELINE_THREADS reads its env — whichever lands second should apply the env to the ordinary kind (and probably not the screen kind, whose size is deliberate).

**@⁠kotekompotek** on GitHub · 2026-11-25 14:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7165239245) Reviewed — the split is coherent: - `screen_pass` classification is safe: no vertex input + triangle topology can only be a procedural/fullscreen draw; depth disabled or absent matches the lighting-table fills. A misclassified draw would only get the longer budget — benign. - Per-kind queues (2 workers), per-kind `FRAME`/`WAITED_US` budget accounting, and per-kind wait in `wait()` keep the two pools fully independent — a screen draw cannot drain the ordinary 500 ms and vice versa. - `SCREEN_BUDGET` = 20 s stays under the title 30 s watchdog, so the drop path remains the documented fallback. Merge note: this rewrites `queue()` where #2250's `VICTORY_PIPELINE_THREADS` reads its env — whichever lands second should apply the env to the ordinary kind (and probably not the screen kind, whose size is deliberate).
Author
Owner

@⁠Venom2054 on GitHub · 2026-11-25 14:31 UTC · original

I compared #2435 at deefe988 with the same local integration without the PR, on native Windows 11 build 26200, RTX 5070 Ti, driver 621.01 and i7-14700. With a populated VIctory pipeline library, both builds showed the people and the watchtower through the opening in the prologue. The foreground character remained a silhouette and the wall to the right stayed dark in both.

Prologue yard, populated pipeline library Without #2435 With #2435
Foreground character, luma on a 0–255 scale 0.45 0.62
Wall right of the opening 0.52 0.51
Sunlit opening 228.05 228.21

These are medians of per-frame means from fixed image regions. I sampled the nearest saved frame to each five-second mark from 225 through 250 seconds after GameInput creation (six distinct frames without the PR, five with it). I checked the framing against the character, opening and tower. Both runs loaded the same 295,036,268-byte pipeline library with 2,618 entries on the early-start list.

With an initially empty VIctory pipeline directory, the two runs diverged. Without the PR the yard, people and tower were visible at 306 and 316 seconds after GameInput creation. With the PR the prologue title card was still visible at 285 seconds, and the captures at 310 and 318 seconds were almost black. The host continued submitting draws. I stopped both runs at 321.5 seconds from launch. I could not compare the yard lighting directly under this condition or establish what caused the difference.

One run per build per cache condition. The empty-library pair ran control first, and the populated-library pair ran PR first. Each pair used isolated copies of the same save, settings and translated shader cache, with identical scripted inputs. The NVIDIA driver cache was left in place. The control window briefly lost focus during the empty-library run. The source trees differed only in the two files from this PR. All four runs ended at their planned cutoff without a logged device removal. All 24 targeted GPU pipeline tests passed on the PR build. Local integration details.

**@⁠Venom2054** on GitHub · 2026-11-25 14:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7165400091) I compared #2435 at `deefe988` with the same local integration without the PR, on native Windows 11 build 26200, RTX 5070 Ti, driver 621.01 and i7-14700. With a populated VIctory pipeline library, both builds showed the people and the watchtower through the opening in the prologue. The foreground character remained a silhouette and the wall to the right stayed dark in both. | Prologue yard, populated pipeline library | Without #2435 | With #2435 | | --- | ---: | ---: | | Foreground character, luma on a 0–255 scale | 0.45 | 0.62 | | Wall right of the opening | 0.52 | 0.51 | | Sunlit opening | 228.05 | 228.21 | These are medians of per-frame means from fixed image regions. I sampled the nearest saved frame to each five-second mark from 225 through 250 seconds after GameInput creation (six distinct frames without the PR, five with it). I checked the framing against the character, opening and tower. Both runs loaded the same 295,036,268-byte pipeline library with 2,618 entries on the early-start list. With an initially empty VIctory pipeline directory, the two runs diverged. Without the PR the yard, people and tower were visible at 306 and 316 seconds after GameInput creation. With the PR the prologue title card was still visible at 285 seconds, and the captures at 310 and 318 seconds were almost black. The host continued submitting draws. I stopped both runs at 321.5 seconds from launch. I could not compare the yard lighting directly under this condition or establish what caused the difference. One run per build per cache condition. The empty-library pair ran control first, and the populated-library pair ran PR first. Each pair used isolated copies of the same save, settings and translated shader cache, with identical scripted inputs. The NVIDIA driver cache was left in place. The control window briefly lost focus during the empty-library run. The source trees differed only in the two files from this PR. All four runs ended at their planned cutoff without a logged device removal. All 24 targeted GPU pipeline tests passed on the PR build. [Local integration details](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2349).
Author
Owner

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

Following up on the RTX 5070 Ti yard test at deefe988, I traced the four lighting passes named in #2433. In two fresh runs, one with #2435 and one without, the host recorded one three-vertex draw for each pass. Both runs started with an empty VIctory pipeline library.

I then repeated the pair with a local diagnostic that associated the currently bound color target with each named draw and read back mip 0 at the next present. The four pairs of raw texture digests matched exactly. Each target contained varying values.

Lighting pass Level-zero dimensions Distinct raw texel values in each build
IntegrateEnvBRDF 256 × 256 63,134
IntegrateEnvBRDF, Beckmann 256 × 256 25,519
IntegrateEnvBRDF, ThinFilm 256 × 256 61,304
AreaLightIlluminance 127 × 128 10,007

The digest covered the active texel bytes of each row, excluding D3D12 row padding, before conversion to PNG. Each pair used separate copies of the same save and translated shader cache. The driver cache stayed in place. The trace pair ran PR first, and the readback pair ran control first. The independently built readback versions had identical diagnostic changes and differed only in the two source files from #2435.

On this setup the control already produced all four tables at first use. Both builds still showed the dark foreground in the earlier yard comparison. We have not checked how a later pass samples these tables, or compared their values with a console reference.

**@⁠Venom2054** on GitHub · 2026-11-25 14:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7166060825) Following up on the RTX 5070 Ti yard test at `deefe988`, I traced the four lighting passes named in #2433. In two fresh runs, one with #2435 and one without, the host recorded one three-vertex draw for each pass. Both runs started with an empty VIctory pipeline library. I then repeated the pair with a local diagnostic that associated the currently bound color target with each named draw and read back mip 0 at the next present. The four pairs of raw texture digests matched exactly. Each target contained varying values. | Lighting pass | Level-zero dimensions | Distinct raw texel values in each build | | --- | ---: | ---: | | IntegrateEnvBRDF | 256 × 256 | 63,134 | | IntegrateEnvBRDF, Beckmann | 256 × 256 | 25,519 | | IntegrateEnvBRDF, ThinFilm | 256 × 256 | 61,304 | | AreaLightIlluminance | 127 × 128 | 10,007 | The digest covered the active texel bytes of each row, excluding D3D12 row padding, before conversion to PNG. Each pair used separate copies of the same save and translated shader cache. The driver cache stayed in place. The trace pair ran PR first, and the readback pair ran control first. The independently built readback versions had identical diagnostic changes and differed only in the two source files from #2435. On this setup the control already produced all four tables at first use. Both builds still showed the dark foreground in the [earlier yard comparison](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2435). We have not checked how a later pass samples these tables, or compared their values with a console reference.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:58 UTC · original · edited 2026-11-25 22:23 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-gpu/src/pipeline/make.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: a run where main demonstrably drops these lighting passes and this PR fixes it, and a narrower screen_pass classification or budget so ordinary full-screen passes cannot stall for seconds.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7167476363) · edited 2026-11-25 22:23 UTC <!-- victory-triage v1 head=deefe98805aee74604c1a0b75845c2f2c55742be verdict=needs-rebase at=2026-11-25T22:31:40Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-gpu/src/pipeline/make.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: a run where `main` demonstrably drops these lighting passes and this PR fixes it, and a narrower `screen_pass` classification or budget so ordinary full-screen passes cannot stall for seconds. --- _Generated by [Claude Code](https://claude.ai/code)_
github-bot force-pushed github-bot/gh-2435 from deefe98805 to d783c095c7 2026-11-26 15:08:23 +00:00 Compare
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-26 15:07 UTC · original

Rebased cleanly onto latest main (63bcca4) in d783c09, resolving the Pending struct merge in crates/victory-gpu/src/pipeline/make.rs while keeping skipped_shader.

Thank you @Venom2054 for the RTX 5070 Ti readback trace! If testers on untested GPU models (e.g., AMD RDNA2/RDNA3/RDNA4, NVIDIA RTX 30/40 series, Intel Arc, or Wine/vkd3d-proton) under cold-cache first-frame world load can verify d783c09, test reports would be appreciated.

AI-assisted: yes (Gemini 4 Neon)

**@⁠pushkarreddyy** on GitHub · 2026-11-26 15:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2435#issuecomment-7195824091) Rebased cleanly onto latest `main` (`63bcca4`) in `d783c09`, resolving the `Pending` struct merge in `crates/victory-gpu/src/pipeline/make.rs` while keeping `skipped_shader`. Thank you `@Venom2054` for the RTX 5070 Ti readback trace! If testers on untested GPU models (e.g., AMD RDNA2/RDNA3/RDNA4, NVIDIA RTX 30/40 series, Intel Arc, or Wine/vkd3d-proton) under cold-cache first-frame world load can verify `d783c09`, test reports would be appreciated. AI-assisted: yes (Gemini 4 Neon)
This pull request can be merged automatically.
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/2435/head:github-bot/gh-2435'
git switch 'github-bot/gh-2435'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2435'
git switch 'github-bot/gh-2435'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2435'
git switch 'github-bot/gh-2435'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2435'
git switch 'main'
git merge --squash 'github-bot/gh-2435'
git switch 'main'
git merge --ff-only 'github-bot/gh-2435'
git switch 'main'
git merge 'github-bot/gh-2435'
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!2435
No description provided.