Repository navigation
device: hold the claimed capabilities against what the host reports - #111
Open
xiaotu030202 wants to merge 1 commit into
Open
xiaotu030202 wants to merge 1 commit into
xiaotu030202 wants to merge 1 commit into
Conversation
`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 and everything downstream diverges. What was not checked anywhere is whether the host can deliver them. `host::create` reads two — `OPTIONS1`'s wave lanes and `OPTIONS7`'s mesh shader tier — and the other fourteen are claimed and never compared with anything. Two tests now do that comparison on the machine they run on. Neither fails when the tables differ, because 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 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) ``` Two of those need a note, and one is a finding. **Mesh shader tier.** `10` is `D3D12_MESH_SHADER_TIER_1`; the console's `1` is its own numbering. `host::create` compares with `!= D3D12_MESH_SHADER_TIER_NOT_SUPPORTED`, which is right, so this is not a gap — the test prints both numbers so nobody reads `1` vs `10` as a regression later. **Wave lanes 64 vs 32.** Known and handled: `set_host_max_wave(32)` is called from that same `host::create`, and the translator narrows what it can. `cargo test -p victory-shader --lib` with `VICTORY_HOST_MAX_WAVE=32` is 211 passed, 0 failed on this card, which is the useful half of that check. **Stencil reference from a pixel shader.** The title is told `1`. This host reports `0`. `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 with it is not tested anywhere, and on a card reporting `0` the honest possibilities are "the pipeline creation refuses it" or "it is accepted and the output is ignored". Either way the title has been told something untrue about the machine it runs on. That is a decision rather than a patch: claiming `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 and which is a different mechanism, and does work). So this test records the difference and says so, without asserting which answer is correct. ## The two tests - **`the_claimed_capabilities_against_what_the_host_reports`** — the table above, printed, and a failure only for the fields the layer reads without a fallback (wave lanes and mesh shader tier). - **`the_stencil_ref_claim_and_what_the_host_supports`** — the stencil claim against the host, with the consequence spelled out in the log. Both skip on a machine with no host GPU, like the other hardware tests here. ## 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 ``` One small addition outside the tests: `claimed_stencil_ref()`, `#[cfg(test)]`, so the test can hold the table entry rather than repeating the literal `1`. ## What this does not do It does not fix the stencil gap, and it does not make the tables agree. If the maintainer wants the claim changed, the two places are `OPTIONS[5]` in `device.rs` and whatever the title does with the answer — which needs a run to see, and I have no game files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
device.rsanswers 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::createreads 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.
Thirteen of fifteen agree. The three that do not:
Mesh shader tier 1 vs 10 —
10isD3D12_MESH_SHADER_TIER_1;1is the console's own numbering.host::createcompares with!= NOT_SUPPORTED, which is right, so this is not a gap. The test prints both so nobody reads1vs10as a regression later.Wave lanes 64 vs 32 — known and handled:
set_host_max_wave(32)from that samehost::create, and the translator narrows what it can. The useful half of that check:cargo test -p victory-shader --libwithVICTORY_HOST_MAX_WAVE=32is 211 passed, 0 failed on this card.Stencil reference from a pixel shader — claimed 1, host says 0. This is the finding.
emitsupportsSV_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 reporting0the 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]to0changes what the title does, and claiming1may be right anyway if the stencil work the title needs goes throughOMSetStencilRef— whichdraw.rsimplements, 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 is1and 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.
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 literal1— if someone changesOPTIONS[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.