GPU: finish pending texture checks before a host callback #1314

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

@⁠Cuebert on GitHub · 2026-11-26 13:54 UTC · original
Cuebert:codex/flush-first-texture-upload → main · +4 −0 · 1 files · 1 commits · open

In the optional parallel refresh path, checking a texture is deferred. The host callback that maps a reserved texture needs the mip mask that check publishes. On the first upload it can observe an empty mask and leave every mip unmapped.

Finish pending texture checks before executing the host callback. The existing ordering for title-written steps stays in place.

A synthetic four-mip upload on ceb9e1f reproduced the problem on WARP and a physical RTX 5090. With parallel refresh enabled, the first mask was zero and none of the 5,570,560 bytes matched. With the four-line fix, the first mask was 0xf and all 5,570,560 bytes matched. Both serial controls also matched every byte. Each case used a fresh process. The same source hunk applies to a20809d. AI-assisted development and testing with Codex.

**@⁠Cuebert** on GitHub · 2026-11-26 13:54 UTC · [original](https://github.com/fxceless/victory-fork/pull/1314) `Cuebert:codex/flush-first-texture-upload` → `main` · +4 −0 · 1 files · 1 commits · open In the optional parallel refresh path, checking a texture is deferred. The host callback that maps a reserved texture needs the mip mask that check publishes. On the first upload it can observe an empty mask and leave every mip unmapped. Finish pending texture checks before executing the host callback. The existing ordering for title-written steps stays in place. A synthetic four-mip upload on `ceb9e1f` reproduced the problem on WARP and a physical RTX 5090. With parallel refresh enabled, the first mask was zero and none of the 5,570,560 bytes matched. With the four-line fix, the first mask was `0xf` and all 5,570,560 bytes matched. Both serial controls also matched every byte. Each case used a fresh process. The same source hunk applies to `a20809d`. AI-assisted development and testing with Codex.
The first reserved-texture upload reads the resident mip mask inside the callback. In parallel refresh mode it can run before the check that publishes that mask. Complete the pending checks at the callback boundary.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:54:18 +00:00
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-26 15:37 UTC · original

Independent ordering qualification on RTX 4060 / Proton

Confirmed the ordering defect on receiving main 58de9bf4c367d4e27f6dd5da523ca2f68951bc77, then applied only Cuebert's four-line correction from this PR (cf3c7717823f146f27e290747ba4c9a89929c020, parent a20809de366186a5770cb9ff00019537fbcc9eda). The same host/texture source is present in the subsequently observed main 93db653ada3ee0b94b2334243d7af81c3d12f27a; that newer revision was not built for this comparison.

Both actual Windows-target victory-gpu diagnostic test executables built successfully (x86_64-pc-windows-gnullvm, Rust 1.98.1, locked dependencies, profile diag). Each of the four processes started in its own matched prefix with empty private driver cache, under GE-Proton 11-14 / Wine 11.0 Staging, vkd3d-proton 71cae091b06571e, physical NVIDIA RTX 4060 (8 GB), driver 620.73.04. Kept VICTORY_TEXTURE_GUARD=0 in all arms to hold the ordinary hashing path fixed.

The shared test-only fixture uses the real HostList::run_deferred and two independent, fully committed 512 x 128 RGBA8 textures with four mips each. It queues both texture checks (including one duplicate), observes their actual completed-mip masks at the first and subsequent host-only callbacks, then independently checks texture contents after all preparation finishes. The callbacks only observe readiness. A second sequence exercises the existing title-write notification (Run) ordering.

Configuration First host callback, A/B masks Pending checks when deferred loop returns Run control, A/B masks Windows child exit
Main, serial 0xf / 0xf 0 0xf / 0xf 0
Main, parallel 0x0 / 0x0 2 0xf / 0xf 101 (expected ordering assertion)
Correction, serial 0xf / 0xf 0 0xf / 0xf 0
Correction, parallel 0xf / 0xf 0 0xf / 0xf 0

The initial callback before any texture check still observes the empty masks in every arm; the subsequent callback agrees with the first relevant callback. Each parallel sequence really processed one batch containing both distinct textures. Once preparation finished, all arms had complete masks and all 64 independently fenced mip readbacks matched byte-for-byte (5,570,560 bytes across the four invocations). This last result is deliberately a fully prepared control, not a claim that the uncorrected first upload was correct. The only expected failing assertion concerns readiness at callback time; the physical readbacks are ordinary committed-resource copies performed afterward.

Both guarded scopes completed, with a 512 MiB external host-memory stop threshold, no OOM kills, no observed kernel GPU faults and no device loss. The results support the ordering fix as a correctness prerequisite for the optional parallel refresh path on this receiving tree. I did not exercise a reserved-resource tile mapping, run the title, measure frame rate, or verify any specific visual symptom here. The independent-consumer qualification on #115 covers a separate part of texture refresh correctness.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol Max).

**@⁠ArturoWolff** on GitHub · 2026-11-26 15:37 UTC · [original](https://github.com/fxceless/victory-fork/pull/1314#issuecomment-7196528237) ### Independent ordering qualification on RTX 4060 / Proton Confirmed the ordering defect on receiving main `58de9bf4c367d4e27f6dd5da523ca2f68951bc77`, then applied only Cuebert's four-line correction from this PR (`cf3c7717823f146f27e290747ba4c9a89929c020`, parent `a20809de366186a5770cb9ff00019537fbcc9eda`). The same host/texture source is present in the subsequently observed main `93db653ada3ee0b94b2334243d7af81c3d12f27a`; that newer revision was not built for this comparison. Both actual Windows-target `victory-gpu` diagnostic test executables built successfully (`x86_64-pc-windows-gnullvm`, Rust 1.98.1, locked dependencies, profile `diag`). Each of the four processes started in its own matched prefix with empty private driver cache, under GE-Proton 11-14 / Wine 11.0 Staging, vkd3d-proton `71cae091b06571e`, physical NVIDIA RTX 4060 (8 GB), driver 620.73.04. Kept `VICTORY_TEXTURE_GUARD=0` in all arms to hold the ordinary hashing path fixed. The shared test-only fixture uses the real `HostList::run_deferred` and two independent, fully committed 512 x 128 RGBA8 textures with four mips each. It queues both texture checks (including one duplicate), observes their actual completed-mip masks at the first and subsequent host-only callbacks, then independently checks texture contents after all preparation finishes. The callbacks only observe readiness. A second sequence exercises the existing title-write notification (`Run`) ordering. | Configuration | First host callback, A/B masks | Pending checks when deferred loop returns | Run control, A/B masks | Windows child exit | |---|---:|---:|---:|---:| | Main, serial | `0xf / 0xf` | 0 | `0xf / 0xf` | 0 | | Main, parallel | `0x0 / 0x0` | 2 | `0xf / 0xf` | 101 (expected ordering assertion) | | Correction, serial | `0xf / 0xf` | 0 | `0xf / 0xf` | 0 | | Correction, parallel | `0xf / 0xf` | 0 | `0xf / 0xf` | 0 | The initial callback before any texture check still observes the empty masks in every arm; the subsequent callback agrees with the first relevant callback. Each parallel sequence really processed one batch containing both distinct textures. Once preparation finished, all arms had complete masks and all 64 independently fenced mip readbacks matched byte-for-byte (5,570,560 bytes across the four invocations). This last result is deliberately a fully prepared control, **not** a claim that the uncorrected first upload was correct. The only expected failing assertion concerns readiness at callback time; the physical readbacks are ordinary committed-resource copies performed afterward. Both guarded scopes completed, with a 512 MiB external host-memory stop threshold, no OOM kills, no observed kernel GPU faults and no device loss. The results support the ordering fix as a correctness prerequisite for the optional parallel refresh path on this receiving tree. I did not exercise a reserved-resource tile mapping, run the title, measure frame rate, or verify any specific visual symptom here. The independent-consumer qualification on #115 covers a separate part of texture refresh correctness. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol Max).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
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/1314/head:github-bot/gh-1314'
git switch 'github-bot/gh-1314'

Merge

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