device: hold the claimed capabilities against what the host reports #111

Open
xiaotu030202 wants to merge 1 commit from upstream-pr/111 into main
xiaotu030202 commented 2026-11-25 13:06:09 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T12:11:01Z.


What

device.rs answers the title's feature queries with a fixed table, OPTIONS, which is right — a title written for a console must see the console's values or it takes a different path. What was not checked anywhere is whether the host can deliver them. host::create reads two (OPTIONS1's wave lanes, OPTIONS7's mesh shader tier); the other fourteen are claimed and never compared with anything.

Two tests now compare them on the machine they run on. Neither fails when the tables differ — a host weaker than the console in a field the title never reads is not a bug — they fail only where the layer reads a field without a fallback.

What this machine reports

This is the device report the PR is really for: RTX 5070 Ti, driver 32.0.16.2140, Ryzen 7 9800X3D, Windows 11 22631.

CAP double precision ops         claimed=1   host=1
CAP output merger logic ops      claimed=1   host=1
CAP minimum precision 16-bit     claimed=2   host=2
CAP tiled resources tier         claimed=3   host=3
CAP resource binding tier        claimed=3   host=3
CAP stencil ref from PS          claimed=1   host=0     <--
CAP typed UAV loads              claimed=1   host=1
CAP rasterizer ordered views     claimed=1   host=1
CAP conservative raster tier     claimed=3   host=3
CAP GPU address bits             claimed=40  host=40
CAP 64 KiB standard swizzle      claimed=0   host=0
CAP viewport/RT index any stage  claimed=1   host=1
CAP resource heap tier           claimed=2   host=2
CAP wave lanes max               claimed=64  host=32    (known; read and handled)
CAP mesh shader tier             claimed=1   host=10    (same tier, different enum)

Thirteen of fifteen agree. The three that do not:

Mesh shader tier 1 vs 10 — 10 is D3D12_MESH_SHADER_TIER_1; 1 is the console's own numbering. host::create compares with != NOT_SUPPORTED, which is right, so this is not a gap. The test prints both so nobody reads 1 vs 10 as a regression later.

Wave lanes 64 vs 32 — known and handled: set_host_max_wave(32) from that same host::create, and the translator narrows what it can. The useful half of that check: cargo test -p victory-shader --lib with VICTORY_HOST_MAX_WAVE=32 is 211 passed, 0 failed on this card.

Stencil reference from a pixel shader — claimed 1, host says 0. This is the finding. emit supports SV_StencilRef (there is a test for its SFI0 bit), so a title that believes the claim can put that output in a shader, have it translated, and be handed to the host. What the host then does is tested nowhere, and on a card reporting 0 the honest possibilities are "pipeline creation refuses it" or "accepted and the output ignored". Either way the title was told something untrue about the machine.

Why this is not a patch

Changing OPTIONS[5] to 0 changes what the title does, and claiming 1 may be right anyway if the stencil work the title needs goes through OMSetStencilRef — which draw.rs implements, which is a different mechanism, and which does work. That is a call for someone who can watch the title react. The test records the difference and says so; it does not assert which answer is correct, only that the console's claim is 1 and that changing it should be deliberate.

Verification

Windows 11 22631, RTX 5070 Ti 32.0.16.2140, Rust 1.98.1 (pinned), MSVC 14.44.35207, Windows SDK 10.0.26100.0. No game files.

$ cargo test -p victory-gpu --lib -- --test-threads=1
test result: ok. 114 passed; 0 failed; 1 ignored

$ cargo clippy -p victory-gpu --all-targets
clean

$ cargo test -p victory-shader --lib            (VICTORY_HOST_MAX_WAVE=32)
test result: ok. 211 passed; 0 failed; 2 ignored

Both new tests skip on a machine with no host GPU, like the other hardware tests here.

One small addition outside them: claimed_stencil_ref(), #[cfg(test)], so the test holds the table entry instead of repeating the literal 1 — if someone changes OPTIONS[5] the test moves with it rather than silently passing.

Not done

The stencil gap itself. The two places to change are OPTIONS[5] here and whatever the title does with the answer — the second needs a run.

If this device report is useful on its own, it may belong in a comment on #37 (the other 5070 Ti report, driver 621.24) rather than as a patch; happy to move it if that is a better home.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6604173362 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/111). Originally posted by [xiaotu030202](https://github.com/xiaotu030202) on 2026-11-25T12:11:01Z. --- ## What `device.rs` answers the title's feature queries with a fixed table, `OPTIONS`, which is right — a title written for a console must see the console's values or it takes a different path. What was not checked anywhere is whether **the host can deliver them**. `host::create` reads two (`OPTIONS1`'s wave lanes, `OPTIONS7`'s mesh shader tier); the other fourteen are claimed and never compared with anything. Two tests now compare them on the machine they run on. Neither fails when the tables differ — a host weaker than the console in a field the title never reads is not a bug — they fail only where the layer reads a field without a fallback. ## What this machine reports This is the device report the PR is really for: **RTX 5070 Ti, driver 32.0.16.2140, Ryzen 7 9800X3D, Windows 11 22631.** ``` CAP double precision ops claimed=1 host=1 CAP output merger logic ops claimed=1 host=1 CAP minimum precision 16-bit claimed=2 host=2 CAP tiled resources tier claimed=3 host=3 CAP resource binding tier claimed=3 host=3 CAP stencil ref from PS claimed=1 host=0 <-- CAP typed UAV loads claimed=1 host=1 CAP rasterizer ordered views claimed=1 host=1 CAP conservative raster tier claimed=3 host=3 CAP GPU address bits claimed=40 host=40 CAP 64 KiB standard swizzle claimed=0 host=0 CAP viewport/RT index any stage claimed=1 host=1 CAP resource heap tier claimed=2 host=2 CAP wave lanes max claimed=64 host=32 (known; read and handled) CAP mesh shader tier claimed=1 host=10 (same tier, different enum) ``` Thirteen of fifteen agree. The three that do not: **Mesh shader tier 1 vs 10** — `10` is `D3D12_MESH_SHADER_TIER_1`; `1` is the console's own numbering. `host::create` compares with `!= NOT_SUPPORTED`, which is right, so this is not a gap. The test prints both so nobody reads `1` vs `10` as a regression later. **Wave lanes 64 vs 32** — known and handled: `set_host_max_wave(32)` from that same `host::create`, and the translator narrows what it can. The useful half of that check: `cargo test -p victory-shader --lib` with `VICTORY_HOST_MAX_WAVE=32` is **211 passed, 0 failed** on this card. **Stencil reference from a pixel shader — claimed 1, host says 0.** This is the finding. `emit` supports `SV_StencilRef` (there is a test for its SFI0 bit), so a title that believes the claim can put that output in a shader, have it translated, and be handed to the host. What the host then does is tested nowhere, and on a card reporting `0` the honest possibilities are "pipeline creation refuses it" or "accepted and the output ignored". Either way the title was told something untrue about the machine. ## Why this is not a patch Changing `OPTIONS[5]` to `0` changes what the title does, and claiming `1` may be right anyway if the stencil work the title needs goes through `OMSetStencilRef` — which `draw.rs` implements, which is a different mechanism, and which does work. That is a call for someone who can watch the title react. The test records the difference and says so; it does not assert which answer is correct, only that the console's claim is `1` and that changing it should be deliberate. ## Verification Windows 11 22631, RTX 5070 Ti 32.0.16.2140, Rust 1.98.1 (pinned), MSVC 14.44.35207, Windows SDK 10.0.26100.0. **No game files.** ``` $ cargo test -p victory-gpu --lib -- --test-threads=1 test result: ok. 114 passed; 0 failed; 1 ignored $ cargo clippy -p victory-gpu --all-targets clean $ cargo test -p victory-shader --lib (VICTORY_HOST_MAX_WAVE=32) test result: ok. 211 passed; 0 failed; 2 ignored ``` Both new tests skip on a machine with no host GPU, like the other hardware tests here. One small addition outside them: `claimed_stencil_ref()`, `#[cfg(test)]`, so the test holds the table entry instead of repeating the literal `1` — if someone changes `OPTIONS[5]` the test moves with it rather than silently passing. ## Not done The stencil gap itself. The two places to change are `OPTIONS[5]` here and whatever the title does with the answer — the second needs a run. If this device report is useful on its own, it may belong in a comment on #37 (the other 5070 Ti report, driver 621.24) rather than as a patch; happy to move it if that is a better home.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/111:upstream-pr/111'
git switch 'upstream-pr/111'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/111'
git switch 'upstream-pr/111'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/111'
git switch 'upstream-pr/111'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/111'
git switch 'main'
git merge --squash 'upstream-pr/111'
git switch 'main'
git merge --ff-only 'upstream-pr/111'
git switch 'main'
git merge 'upstream-pr/111'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Zettrox/ztrx!111
No description provided.