Skip to content

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

Open
pushkarreddyy wants to merge 1 commit into
Marvisak:mainfrom
pushkarreddyy:feat/gpu-screen-pass-pipeline-workers
Open

pushkarreddyy wants to merge 1 commit into
Marvisak:mainfrom
pushkarreddyy:feat/gpu-screen-pass-pipeline-workers

Conversation

@pushkarreddyy

Copy link
Copy Markdown
Contributor

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
pushkarreddyy force-pushed the feat/gpu-screen-pass-pipeline-workers branch from 5c2d0d1 to deefe98 Compare November 25, 2026 13:33
@pushkarreddyy

Copy link
Copy Markdown
Contributor Author

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!

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090:

  • Giving screen passes dedicated pipeline workers and a bounded wait budget (#2433) passes all pipeline tests cleanly.
  • cargo test -p victory-gpu pipeline::: 16/16 passed (including screen_pass_requires_triangle_without_inputs_or_depth).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dedicated pipeline workers for screen passes. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

@pushkarreddyy

Copy link
Copy Markdown
Contributor Author

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)

@kotekompotek

Copy link
Copy Markdown

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).

@Venom2054

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

…ixes Marvisak#2433)

# Conflicts:
#	crates/victory-gpu/src/pipeline/make.rs
@pushkarreddyy
pushkarreddyy force-pushed the feat/gpu-screen-pass-pipeline-workers branch from deefe98 to d783c09 Compare November 26, 2026 15:05
@pushkarreddyy

Copy link
Copy Markdown
Contributor Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU: give screen passes dedicated pipeline workers and wait budget

6 participants