fix(gpu): a dispatch waits for its compute pipeline until it is made #243

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

@⁠mutlusinan on GitHub · 2026-11-27 20:04 UTC · original
mutlusinan:fix/compute-pipeline-wait → main · +26 −1 · 1 files · 1 commits · open

Problem

A draw whose pipeline is not ready within the frame's budget is dropped — and drawn again next frame, so it costs one frame. A dispatch may not be drawn again: the title runs some compute passes once, when a scene changes (a buffer is reset or cleared), and what they leave is read for as long as the scene lasts.

In the prison corridor, a compute program met for the first time took 4.4 s to make on a 16 GB machine; its one dispatch was dropped after the half second of budget, and the windows of the previous room stayed blended over the picture for minutes (run 195 of the fork it comes from).

Fix

In pipeline::make::ready, a compute pipeline (p.graphics.is_none()) is now made/waiting until it exists, whatever the frame's budget; a draw still waits within the budget. VICTORY_PIPELINE_COMPUTE_WAIT=0 restores the old behaviour. The pipeline library has the program on the next run, so the multi-second wait happens once.

Verification

  • cargo check -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked — clean.
  • Not run in game here; the observable check is the prison corridor / scene-change passes (no more blended-over windows after a first-time compute pipeline).

Ported from fxceless/victory-fork a42b627 (pull request #1312), GPL-3.0-or-later.

**@⁠mutlusinan** on GitHub · 2026-11-27 20:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/243) `mutlusinan:fix/compute-pipeline-wait` → `main` · +26 −1 · 1 files · 1 commits · open ### Problem A draw whose pipeline is not ready within the frame's budget is dropped — and drawn again next frame, so it costs one frame. A **dispatch** may not be drawn again: the title runs some compute passes once, when a scene changes (a buffer is reset or cleared), and what they leave is read for as long as the scene lasts. In the prison corridor, a compute program met for the first time took 4.4 s to make on a 16 GB machine; its one dispatch was dropped after the half second of budget, and the windows of the previous room stayed blended over the picture for minutes (run 195 of the fork it comes from). ### Fix In `pipeline::make::ready`, a compute pipeline (`p.graphics.is_none()`) is now made/waiting until it exists, whatever the frame's budget; a draw still waits within the budget. `VICTORY_PIPELINE_COMPUTE_WAIT=0` restores the old behaviour. The pipeline library has the program on the next run, so the multi-second wait happens once. ### Verification - `cargo check -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked` — clean. - Not run in game here; the observable check is the prison corridor / scene-change passes (no more blended-over windows after a first-time compute pipeline). Ported from fxceless/victory-fork `a42b627` (pull request #1312), GPL-3.0-or-later.
A draw whose pipeline is not ready within the frame's budget is dropped
and drawn again next frame. A dispatch may not be drawn again: the title
runs some compute passes once, when a scene changes, and what they leave
is read for as long as the scene lasts. A compute program met for the
first time took 4.4 s to make on a 16 GB machine; its one dispatch was
dropped after the half second of budget, and the windows of the room
before stayed blended over the picture for minutes (run 195).

A compute pipeline now waits for its own making, whatever the budget; a
draw still waits within the budget. The pipeline library has it on the
next run. `VICTORY_PIPELINE_COMPUTE_WAIT=0` restores the old behaviour.

Ported from fxceless/victory-fork a42b627 (pull request #1312), GPL-3.0-or-later.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:09:59 +00:00
Author
Owner

@⁠mutlusinan on GitHub · 2026-11-27 20:21 UTC · original

Risk assessment (porting review)

  • Highest risk in this batch. The change blocks the submitting thread until the compute pipeline exists. That is deliberate (a dropped one-shot dispatch leaves the picture wrong for the whole scene), but it runs against the design decision the module documents: pipelines are made off the title's threads and waited for only within a per-frame budget (decision 0007).
  • Cold cache: up to 4.4 s for one program upstream. Several first-time compute pipelines in one frame could trip the title's own hang watchdog, which is the failure mode this design exists to avoid.
  • Default on; VICTORY_PIPELINE_COMPUTE_WAIT=0 restores the old behaviour. Draws are unchanged (still budgeted and dropped).
  • Recommendation: measure on a cold %LOCALAPPDATA%\victory cache and on the title's first world frame before merging; if the watchdog shows up, this should go in default-off.
  • Compatibility: merges cleanly and type-checks against main at e69e39c.
**@⁠mutlusinan** on GitHub · 2026-11-27 20:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/243#issuecomment-7227422970) ### Risk assessment (porting review) - **Highest risk in this batch.** The change blocks the submitting thread until the compute pipeline exists. That is deliberate (a dropped one-shot dispatch leaves the picture wrong for the whole scene), but it runs against the design decision the module documents: pipelines are made off the title's threads and waited for only within a per-frame budget (decision 0007). - Cold cache: up to 4.4 s for one program upstream. Several first-time compute pipelines in one frame could trip the title's own hang watchdog, which is the failure mode this design exists to avoid. - Default on; `VICTORY_PIPELINE_COMPUTE_WAIT=0` restores the old behaviour. Draws are unchanged (still budgeted and dropped). - **Recommendation:** measure on a cold `%LOCALAPPDATA%\victory` cache and on the title's first world frame before merging; if the watchdog shows up, this should go in default-off. - **Compatibility:** merges cleanly and type-checks against `main` at `e69e39c`.
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/243/head:github-bot/gh-243'
git switch 'github-bot/gh-243'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-243'
git switch 'github-bot/gh-243'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-243'
git switch 'github-bot/gh-243'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-243'
git switch 'main'
git merge --squash 'github-bot/gh-243'
git switch 'main'
git merge --ff-only 'github-bot/gh-243'
git switch 'main'
git merge 'github-bot/gh-243'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.