Skip to content

GPU: adapter choice and logging, presenter backoff, a texture-description ladder, and a display-deferral test a headless session can pass - #1630

Open
fiestorra wants to merge 2 commits into
Marvisak:mainfrom
fiestorra:fix/presenter-backoff-and-texture-fallbacks
Open

fiestorra wants to merge 2 commits into
Marvisak:mainfrom
fiestorra:fix/presenter-backoff-and-texture-fallbacks

Conversation

@fiestorra

@fiestorra fiestorra commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The ladder keeps every permission; the rest of the old description is gone

The branch is now one change: when the host refuses a texture description, make_texture retries it without the initial state, without the clear value, and without either, before giving up. Head e70d5f90, rebuilt on 63bcca43.

Why those four rungs and no more: the refusal in #1758/#1755 is of the description, and the state and the clear value are the two things that were not in the log. A rung that drops ALLOW_RENDER_TARGET or the unordered-access permission is not in the ladder, for the reason you gave: a texture made without the render-target permission takes no view, and the draw is lost later instead of here, which is a worse failure because it looks like a rendering bug. The case that does need a stand-in is handled where it belongs, by #2332 (stand_in_for, conditional on the host) and by Host::rtv binding a null view in its own slot rather than skipping it (#1700).

Each refused rung is logged at debug with its state and whether it carried a clear value, and the final failure keeps the warn! with the description. The texture's real initial state is set from the rung that worked, so the transitions that follow do not start from a lie.

The other four changes the old description listed are not in this branch — the swap-chain backoff, the adapter choice, the display-deferral test and the clear-value diagnosis each had their own PR, and mixing them is what made this one unreadable.

Measured: cargo test -p victory-gpu --lib → 231 passed, 0 failed; cargo clippy -p victory-gpu --all-targets --locked -- -D warnings clean.

Not claimed: that this rung set fixes the 2560x1440 target on its own. With #2332 the description never reaches the host as B4G4R4A4 on the cards that refuse it, so what this adds is the honest retry for the refusals that remain, and a log line that names which argument it was.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

Status of the checks, and the two ways to unblock them

CI for this head is in action_required (https://github.com/Marvisak/VIctory/actions/runs/45476638884): GitHub holds the workflow for a first-time contributor until a maintainer approves it, so gh pr checks reports nothing yet and the merge state is UNSTABLE only for that reason. Clicking Approve and run on that run is enough for this one; a collaborator invite would let later PRs run CI on their own, if that is preferable.

The three commits are the fixes described in #1591 (the swap-chain retry storm), #1600 (the two 2560×1440 textures the host refuses, with the GPU probe that narrows it and the ladder that makes them exist) and the display-deferral test in #1413, and each one states what it measured and what it does not resolve. If any of them is against the grain here — the texture ladder in particular trades a refused description for a usable texture and says what it gave up, which not everyone wants in the runtime — say which and I will drop or reshape that commit.

No game data in any of it: descriptions, states, error codes and counts only.

Written with an AI assistant.

@omeyasawant

omeyasawant commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Independent title check of the texture-resource commit 964cdbd67ef1fa8ecb0fa0ddbd17294183167146 on an RTX 5090.

Setup
Windows 11 Pro 10.0.26200; i7-14700K; 192 GiB RAM; RTX 5090 driver 32.0.16.1088; Rust 1.98.1 MSVC; diagnostics build. This is a local integration, not the complete PR: #189 head 54b333f plus #967 adapter selection. Before texture commit: local 2c77331; after: dc5210e. Both runs explicitly log RTX 5090 selection and Emulate wave64 mode. No driver changes between runs.

Measured

  • Before: 2560x1440 textures in formats 86 (flags 5) and 115 (flags 1) fail with E_INVALIDARG; inspected presented frames 120 and 600 are black.
  • After applying only the texture commit: both are created via fallbacks (86: flags 5 -> 1, clear retained; 115: flags 1 -> 0, clear dropped). No no host texture message in the run. A locally inspected frame 600 contains the intro video; frame 1200 contains loading artwork. No captures are attached under the asset policy.
  • cargo build --profile diag -p victory --features diagnostics --locked: passes.
  • cargo test -p victory-gpu --locked -- --test-threads=1: 58 passed, 0 failed, 2 ignored on this integration. Full shader/workspace results on the underlying Shaders: emulate Wave64 compute shaders on Wave32 and narrower hosts #189 branch were posted there; the complete combined workspace was not rerun for this report.

Remaining limitation
The title begins world submissions (about 2500-2700 draws/frame) but slows to roughly 0.2 FPS and exits with GPU removal / DXGI_ERROR_INVALID_CALL (0x887A0001). No correctly rendered world or gameplay is verified. This result supports texture creation and visible video, not an overall gameplay claim or proof of the later crash's cause. Initial-settings state and scripted Enter input were reused; this is not a synchronized FPS benchmark. Only two illustrative frames were inspected, not every frame.

AI assistance: OpenAI Codex performed the integrations and tests and drafted this report at the account owner's request. Exact runtime model identifier unavailable. No game bytes or game-derived dumps are included.

Runtime-measurement correction: A subsequent idle-GPU check, after the title exited, found a competing local CUDA workload with GPU utilization near 98% and about 31 GB of the 32 GB VRAM occupied. The game runs above were not performed with GPU resources isolated. Their FPS, presentation counts and memory/latency observations must not be treated as clean performance benchmarks or evidence of a project-specific stall. The reported test pass/fail counts are the actual observed results; the explicit texture-format/debug-layer errors and local frame-content observations are still observations, but causality of remaining slowdowns/crashes is not established. A clean rerun is needed. No details of the unrelated workload are included.

@fiestorra

Copy link
Copy Markdown
Contributor Author

The ladder now has a test that would have caught the bug it fixes

Added in dc73cce to crates/victory-gpu/src/resource.rs: an ignored GPU test, a_refused_description_still_leaves_a_texture, that makes the creation the old code made — the B5G5R5A1_UNORM 2560×1440 target with render-target and unordered-access, and a clear value naming a format the resource does not have — and checks both arms:

the one-shot creation is refused: The parameter is incorrect. (0x80070057)
host texture: 2560x1440 format 86 flags 0x5 of the 0x5 asked, state 0x4     <- integrated GPU
host texture: 2560x1440 format 86 flags 0x1 of the 0x5 asked, state 0x0     <- RTX 4090

cargo test --release -p victory-gpu -- --ignored --nocapture a_refused_description_still_leaves_a_texture

So the one-shot path — what this pull request changes — returns nothing at all and the ladder returns a usable texture, and that is now checked rather than argued. Before the ladder, a description the host refused left no host copy, and every draw that named one was lost.

The two lines also show what the ladder gives up, and that it is the host's answer and not a fixed order: the integrated GPU takes B5G5R5A1_UNORM with a UAV and keeps both permissions (flags 0x5), while the RTX 4090 refuses that format with a UAV and the texture is made as a render target only (flags 0x1), with the common state. The test asserts the portable part — the texture exists, its format is the one asked for, the render-target permission survives, and the state is one the texture may be made in — so it passes on both instead of pinning one driver's answer.

Why it matters beyond this test: the first version of this patch dropped every clear value whose format differed from the resource's, and a debug-layer boot showed it silently dropping 358 legitimate depth clears (D32_FLOAT_S8X24_UINT made from a clear naming R32_FLOAT_X8X24). A test that runs the real device would have failed that version in one second.

The rest is unchanged: cargo test -p victory-gpu --locked → 57 passed, 5 ignored; cargo clippy -p victory-gpu --all-targets --all-features -- -D warnings clean; rustfmt --check clean on the file.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

Field evidence for the ladder, from the other adapter

A 60-second boot on the RX 4090 (adapter 1, driver 32.0.16.2124, with this pull request applied) shows the ladder taking over for the exact two targets it was written for, and what it gives up:

host texture made only as a fallback flags_asked=5 flags_made=1 clear_asked=86  clear_dropped=false
host texture made only as a fallback flags_asked=1 flags_made=0 clear_asked=115 clear_dropped=true
  • The B5G5R5A1_UNORM target: the host refuses its UAV permission, so it is made as a render target only, with the clear value kept — the clear was never the problem there.
  • The B4G4R4A4_UNORM target: the host refuses the render target as well, and refuses the creation with the clear value in the resource's own format, so the only description taken is plain memory with no clear. Without the ladder there would be no host copy at all.

Both are logged once, and the boot is otherwise unchanged (1,024 frames, the same 11 programs as ffe310e). The open question — whether the ladder should stop before plain memory, since a flags 0 texture can never be an RTV — is in #1600 (comment), because it is a policy choice rather than a measurement.

Written with an AI assistant.

Calvix2k added a commit to Calvix2k/VIctory that referenced this pull request Nov 24, 2026
From the review on Marvisak#1707:

- A new section says when to stop and leave a decision to a maintainer, with
  the Needs human attention line and the cases that require it.
- Measurements must name the adapter and driver, and use the selector from
  Marvisak#1630 where available.
- No checks reported on a first-time contributor's PR means waiting for a
  maintainer to approve the run, not passing.
@aycow

aycow commented Nov 24, 2026

Copy link
Copy Markdown

Read-only comparison on a hybrid laptop with RTX 5070 Laptop GPU (10de:2d18) and AMD Radeon Graphics (1002:1114). Windows PnP lists the NVIDIA device as disconnected, with NVIDIA package 32.0.15.8191 still installed. Standard/high-performance DXGI and the DXCore D3D12 graphics list both expose only AMD and software WARP. D3D12 creates both, with SM 6.6, mesh tier 1, and wave ranges 32–64 on AMD and 4 on WARP. No driver, graphics-mode, or machine changes were made. This is a useful case where adapter preference cannot select a device that Windows does not currently enumerate.

AI-assisted using Codex.

@fiestorra

Copy link
Copy Markdown
Contributor Author

Verification: main's suite is red on this machine on exactly the test this pull request relaxes, and green with it

I ran the whole recipe on a branch that contains only the draw.rs change from #1700 (so its display.rs is main's), on the same machine I have been measuring on:

cargo test --workspace --locked
thread 'modules::display::tests::sdr_and_display_deferrals' panicked at
  crates\victory-hle\src\modules\display.rs:188:9:
assertion `left == right` failed
  left: -2147024846      # 0x80070032, E_NOT_SUPPORTED
 right: 0                 # S_OK

0x80070032 is exactly the code this pull request's sdr_and_display_deferrals change accepts alongside S_OK, with contract assertions on what each path must leave behind. On this branch (with it) the same command exits 0:

cargo test --workspace --locked                                   # all binaries ok, 0 failed
cargo clippy --workspace --all-targets --locked -- -D warnings    # clean
cargo clippy --workspace --all-targets --all-features -- -D warnings   # clean

So the change is not cosmetic: on a Windows session where the display stack answers NOT_SUPPORTED for that deferral, main fails its own test suite, and this branch does not.

Environment, since it decides whether you can reproduce it: Windows 11, the agent runs in session 0 (the interactive desktop is session 1), no presentable desktop, adapters AMD Radeon(TM) Graphics (driver 32.0.21045.29003) and RTX 4090 (driver 32.0.16.2124); the failing call is the display deferral, so the adapter is irrelevant and the session is the likely reason. If your CI runners are headless Windows machines, main is probably red on this test there too — which would explain a failing check without a code defect, and this pull request removes it.

Two smaller notes from the same run, so the reviewer does not have to take them on trust:

  • rustfmt --check on crates/victory-gpu/src/host.rs reports 25 hunks on this branch and 25 on main — the same pre-existing ones, so nothing here adds formatting debt (I did not reformat other people's code).
  • The diff is +967/−50 over six commits, each self-contained: the adapter choice and its logging, the presenter retry backoff, the texture description ladder, the display deferral, the offline adapter selector, and two GPU tests.

No game data is involved: test names and HRESULT values only.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

Correction to one line above: eight commits, not six

The diff size was right (+967/−50); the count was not. The branch has eight commits, and they are:

805e365 GPU: back off when no presenter can be made
964cdbd GPU: try a ladder of descriptions for a host texture
10bc4e3 HLE: a refused display deferral is the host's state, not a failure
8ffef90 GPU: say which adapter the device is on, and let it be chosen
187bfb7 Shaders: the offline host takes the same adapter selector
83b7393 GPU: the mesh-tier probe asks every adapter, not only the default
dc73cce GPU: a GPU test for the description ladder
f15a9f9 README: document VICTORY_D3D12_ADAPTER

Each still stands on its own, and for a reviewer who wants them separately rather than as a bundle I am happy to split the branch — the natural cut is the presenter backoff, the texture ladder plus its test, and the adapter work (selector, logging, the every-adapter probe, and the README row).

No game data is involved.

Written with an AI assistant.

0xkn0wh3r3 added a commit to 0xkn0wh3r3/VIctory that referenced this pull request Nov 25, 2026
0xkn0wh3r3 added a commit to 0xkn0wh3r3/VIctory that referenced this pull request Nov 26, 2026
@fiestorra

Copy link
Copy Markdown
Contributor Author

What this branch carries now, and the one rung that waits for #1700

The description listed five changes; the branch carries one of them, the texture-description ladder (attempts() / make_texture() in crates/victory-gpu/src/resource.rs), after the branch was cut down to what still applies to main. I am not going to claim the other four here: they are their own PRs (#1591's swap-chain backoff, the adapter choice, the display deferral, the clear-value diagnosis), and mixing them made this one hard to review.

The rungs that drop permissions. You are right and it is the reason the ladder is not safe as it stands: if a texture is made without ALLOW_RENDER_TARGET, a render target view of it is an invalid call, and the draw then either removes the device or renders into nothing — exactly the failure the ladder was meant to remove, moved one step later. The rungs that only change the initial state or drop the clear value stay; the rungs that drop a permission are removed from this branch until a dropped permission is bound as a null view in its own slot rather than skipped. That work is #1700, rebased onto current main (head 9ef0e429), which is what the ladder should depend on.

So: this PR is now only the ladder minus the permission rungs, and it says so. When #1700 lands, the remaining rungs can come back in a follow-up with the boot that shows they help.

CI: check passing. I will push the trimmed ladder once I have re-run the two boots that motivated it; the 120 s boot alone would not show an invalid RTV, which is your point, and it is why the permission rungs go.

Written with an AI assistant.

@fiestorra
fiestorra force-pushed the fix/presenter-backoff-and-texture-fallbacks branch from 3c036f7 to e70d5f9 Compare November 26, 2026 13:34
@fiestorra

Copy link
Copy Markdown
Contributor Author

The ladder keeps every permission; the rest of the old description is gone

The branch is now one change: when the host refuses a texture description, make_texture retries it without the initial state, without the clear value, and without either, before giving up. Head e70d5f90, rebuilt on 63bcca43.

Why those four rungs and no more: the refusal in #1758/#1755 is of the description, and the state and the clear value are the two things that were not in the log. A rung that drops ALLOW_RENDER_TARGET or the unordered-access permission is not in the ladder, for the reason you gave: a texture made without the render-target permission takes no view, and the draw is lost later instead of here, which is a worse failure because it looks like a rendering bug. The case that does need a stand-in is handled where it belongs, by #2332 (stand_in_for, conditional on the host) and by Host::rtv binding a null view in its own slot rather than skipping it (#1700).

Each refused rung is logged at debug with its state and whether it carried a clear value, and the final failure keeps the warn! with the description. The texture's real initial state is set from the rung that worked, so the transitions that follow do not start from a lie.

The other four changes the old description listed are not in this branch — the swap-chain backoff, the adapter choice, the display-deferral test and the clear-value diagnosis each had their own PR, and mixing them is what made this one unreadable.

Measured: cargo test -p victory-gpu --lib → 231 passed, 0 failed; cargo clippy -p victory-gpu --all-targets --locked -- -D warnings clean.

Not claimed: that this rung set fixes the 2560x1440 target on its own. With #2332 the description never reaches the host as B4G4R4A4 on the cards that refuse it, so what this adds is the honest retry for the refusals that remain, and a log line that names which argument it was.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

The ladder now has a test, and it pins the one property you cared about

Head 18812e76.

The rungs are out of make_texture's loop and into fn rungs(initial) -> Vec<(u32, bool)>, which makes the order checkable:

assert_eq!(rungs(0x0c), [(0x0c, true), (0, true), (0x0c, false), (0, false)]);
assert_eq!(rungs(0), [(0, true), (0, false)]);      // no repeated rung
assert_eq!(rungs(0x0c).len(), 4);

The property you objected to — a rung dropping a permission — is now structural and stated: rungs takes no flags, so every rung asks for the description it was given. The test says that instead of asserting something a no-op could pass; what it does pin is the order and the deduplication, which a refactor could get wrong silently.

cargo test -p victory-gpu --lib → 232 passed, 0 failed; cargo clippy -p victory-gpu --all-targets -- -D warnings clean.

Written with an AI assistant.

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.

6 participants