Repository navigation
runtime: give unknown-dimension views a default view and skip mismatched ones - #2649
Conversation
…hed ones Desktop D3D12 removes the device for a view description with ViewDimension 0 (UNKNOWN) or a dimension that does not suit the resource, instead of failing the call. A console package module made such SRVs on 2D RGBA8 textures. Views of device slots 18 to 21 are now checked first (view_dimension.h): dimension 0 gets the resource's default view (null description) where desktop allows one, else the view is skipped; a mismatched dimension is skipped. Both are logged, and a view that still removes the device logs its forwarded description and the resource's shape. New fixture with a negative control: startup_view_dimension; the control swaps the resource dimension of the mismatched cases.
tedin7
left a comment
There was a problem hiding this comment.
Review of head 639895a against main (comment only).
Code read: src/startup_stubs/view_dimension.h, the view_slot wiring in d3d12_xs_device.cpp, tests/startup_view_dimension_check.cpp.
- The SRV/UAV/RTV/DSV dimension tables match the public d3d12.h numbering. The description offset (
args[2]for slot 19,args[1]otherwise) is consistent with the existing code. - The default-view rules (no buffers, no typeless or unknown formats, no depth format in an SRV) match desktop behavior. The skips go through the existing "unmaterialized" path.
- Other open or merged PRs on the same slice: none found (only the parent #2591 and the earlier #1677 / #2338, which are different).
Commands run locally on the exact head:
g++ -std=c++17 -Isrc tests/startup_view_dimension_check.cpp:ok;--controlprints 12FAIL:lines.- Mutation: SRV dimension 8 mapped to texture2d makes the test fail (4 FAIL). Removing the typeless/unknown-format refusal makes it fail (3 FAIL).
python3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py,git diff --check origin/main...HEAD: all clean.
Findings:
- The fixture covers the decision header only. The
view_slotwiring (default_view,args[desc_index] = 0, the skip, theremoving view desclog) has no source-built fixture, as the PR body says. Nothing here shows the null description reaches the real call. - The PR says the change lets a console module's start-up run continue. That is an executable claim that I cannot check. Only the fixture results are reported here. I did not run Win2025, and I am not merging this.
- The merge stays with MasterDomino or @R0Y00, who can verify the start-up claim on the game.
AI-assisted; commands listed were executed locally.
R0Y00
left a comment
There was a problem hiding this comment.
The CPU table establishes dimension classification. The production fallback also strips the entire view description, including its requested format and component mapping, for four slot families. The reported SRV observation does not establish that contract for UAV, RTV or DSV. Please narrow the initial fallback to the evidenced typed SRV case or gate the wider mapping as an explicit experiment. Add a source-built wrapper test that samples a distinct colour through the created SRV, proves an incompatible explicit view is refused without device removal, and verifies that a rejected replacement cannot later bind the old valid descriptor from the same slot. Keep the existing resource and live-descriptor lifetime checks.
… refused SRVs The default view for a view description with ViewDimension 0 replaces the whole description, including its format and component mapping. Only the shader resource view case is measured, so by default only slot 18 views of typed, non-depth textures get it. UAV, RTV and DSV descriptions with dimension 0 are skipped unless the experimental X2W_D3D12_VIEW_DEFAULTS=all is set; =off skips the SRV case too. A refused SRV now writes a null SRV into its destination descriptor. The skipped call used to leave the slot's previous descriptor there, bindable and copied by CopyDescriptors, after the slot's record had dropped the reference that kept its resource alive. New fixture startup_view_dimension_warp (and _hardware) through d3d12_xs.dll: an unknown-dimension SRV samples its texture's colour, an explicit TEXTURE3D SRV of a 2D texture is refused without device removal, and a refused replacement over a valid view reads zero, as does a copy of that slot. startup_view_dimension_off_control_warp runs it with X2W_D3D12_VIEW_DEFAULTS=off and must fail on the missing default view alone, with the device not removed.
|
Thanks. Addressed in c759b14 (new commit on top of 639895a, no rebase). 1. Fallback narrowed to the evidenced typed-SRV case
2. Source-built wrapper test: The test goes through
3. Resource and live-descriptor lifetime checks kept No existing test was changed except the CPU table, which gains the mode argument and new checks; no existing check was removed or relaxed. Mutation checks (each reverted afterwards):
Commands and results (commit c759b14; release preset; NVIDIA GeForce RTX 5090, driver 32.0.16.1088; Windows 10.0.26200.9974; debug layer off; WARP = Microsoft Basic Render Driver) . .\tools\dev.ps1
cmake --preset release
cmake --build --preset release
ctest --preset release --no-tests=error -R 'view' -V54 tests: 50 passed, 4 capability skips, 0 failed. Skips: ctest --preset release -j 6 --no-tests=error -R '^startup_' -E '_hardware$|^startup_audio_'642 tests: 636 passed, 6 capability skips, 0 failed. Skips: python -B tests/docs_links_check.py # 19 Markdown files, 508 links: ok
python -B tests/bidi_controls_check.py # 1869 files: no bidirectional controls
git diff --check origin/main...HEAD # cleanNot addressed here: a refused UAV, RTV or DSV still leaves its slot's previous descriptor in place. The reported observation and this fixture cover SRVs only, so I kept this change to slot 18. New head: c759b14 This change was AI-assisted. |
R0Y00
left a comment
There was a problem hiding this comment.
Windows Release passed all five view-dimension cases at ae6aa4a, including WARP and RTX 4060 Laptop. The typed SRV samples its expected color. The mismatched SRV remains harmless and both the replaced slot and its copy return zero. The added UAV case failed on c759b14 because the refused replacement changed the token while the desktop descriptor stayed live. It now preserves the old token on both adapters. The off control distinguishes the missing default view from other failures.
Change
Slice 3 of 4 from #2591.
On desktop D3D12, a view description with
ViewDimension0 (UNKNOWN) removes the device instead offailing the call. A dimension that does not suit the resource does the same (debug layer: "The
ViewDimension in the View Desc is incompatible with the type of the Resource"). A console package
module made such SRVs on 2D RGBA8 textures. The views of device slots 18 to 21 (SRV, UAV, RTV, DSV)
are now checked before they are forwarded (
src/startup_stubs/view_dimension.h):allows one. Desktop does not allow one for buffers, typeless or unknown formats, or depth formats in
an SRV, so those views are skipped and logged.
resource has is skipped and logged.
description bytes and the resource's shape (
removing view desc).A skipped view is recorded unmaterialized, the same way as the existing "resource lacks ..." skips.
Refs #2591. Independent of the other three slices.
Verification
Build: this branch, one commit
639895a2onmainat02368737. From the worktree in PowerShell:. .\tools\dev.ps1,cmake --preset release,cmake --build --preset release(Python envout/pe-envfromrequirements-dev.txt).Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088, Windows 10.0.26200.9974. The new fixture
creates no device.
ctest --preset release --no-tests=error -R '^startup_view_dimension(_control)?$' -V: 2/2 passed.The control prints 12
FAIL:lines.ctest --preset release -j 6 --no-tests=error -R '^startup_' -E '_hardware$|^startup_audio_': 640 tests, 634 passed, 6 skipped (capability, exit 77), 0 failed. (Run before a final amend that only moved an#include/ CMake block to avoid a merge conflict with the sibling slices; the slice's own tests were rerun after it and pass.)python -B tests/docs_links_check.py: pass (19 Markdown files, 507 links).python -B tests/bidi_controls_check.py: pass.git diff --check origin/main...HEAD: clean.Evidence
startup_view_dimension(from #2591, unchanged) checksview_dimension.hon the publicd3d12.henumerations. It covers which resource dimension each SRV/UAV/RTV/DSV dimension needs, and when a
dimension-0 view may become the default view.
--controlswaps the resource dimension of themismatched cases for the matching one, so the refusal rows print
FAIL:. The test is registered withPASS_REGULAR_EXPRESSION "FAIL: ".Measured in a start-up run with a local console executable (not included), on the Series S profile:
with dimension 0, the module's SRVs removed the device. With this change they get the default view and
the run continues (#2591). The wiring in
view_slothas no source-built device fixture. The testcovers the decision, not the forwarded call.
Checklist
This change was AI-assisted.