runtime: give unknown-dimension views a default view and skip mismatched ones #2641
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2649"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-26T00:26:32Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:31:58Z.
Review: COMMENTED
Review of head
639895a2against main (comment only).Code read:
src/startup_stubs/view_dimension.h, theview_slotwiring ind3d12_xs_device.cpp,tests/startup_view_dimension_check.cpp.args[2]for slot 19,args[1]otherwise) is consistent with the existing code.Commands run locally on the exact head:
g++ -std=c++17 -Isrc tests/startup_view_dimension_check.cpp:ok;--controlprints 12FAIL:lines.python3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py,git diff --check origin/main...HEAD: all clean.Findings:
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.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T00:42:26Z.
Review: CHANGES_REQUESTED
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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T01:45:39Z.
Review: APPROVED
Windows Release passed all five view-dimension cases at
ae6aa4ae, 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 onc759b14bbecause 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.Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-26T01:13:16Z.
Thanks. Addressed in
c759b14b(new commit on top of639895a2, no rebase).1. Fallback narrowed to the evidenced typed-SRV case
view_dimension.h:default_view_allowed()now takes aDefaultViewsmode. The default (srv) allows the default view only for slot 18 (CreateShaderResourceView) on a texture with a typed, non-depth format. That is the observed case.ViewDimension0 are now skipped by default. The skip log says that a default view of that type needsX2W_D3D12_VIEW_DEFAULTS=all.X2W_D3D12_VIEW_DEFAULTS=allturns on the wider mapping as an explicit experiment.=offalso skips the SRV case, and the negative control uses it. Any other value, or none, issrv.startup_view_dimension) adds checks for the gate (slots 19 to 21 refused undersrv, everything refused underoff) and for the env parsing. Its--controlturns the gate on for all slots, so those three checks printFAIL:.2. Source-built wrapper test:
startup_view_dimension_warp(also_hardware),tests/startup_view_dimension_device.cppThe test goes through
d3d12_xs.dll!D3D12XboxCreateDevice, the same way asstartup_resource_retire_views. A compute probe on the fixture's own desktop queue samples (0,0) with a point sampler through each slot of a shader-visible guest heap, using the desktop heap behind it.ViewDimension0 and format R32G32B32A32_FLOAT. The texture is an R8G8B8A8_UNORM texture filled with (51,153,204,255). It reads back0.200 0.600 0.800 1.000.GetDeviceRemovedReasonreturns S_OK afterwards on both the desktop device and the wrapper (slot 37).X2W_D3D12_RELEASE_RETIRED_VIEWSalready writes.CopyDescriptors, whilerecord_view(false)had already dropped the reference that kept its resource alive.0 0 0 0.CopyDescriptorsSimple(slot 24) of that slot over another valid view also reads0 0 0 0.startup_view_dimension_off_control_warpruns the same fixture withX2W_D3D12_VIEW_DEFAULTS=off. It must printFAIL: (a) default view reads 0.000 0.000 0.000 0.000, expected 0.200 0.600 0.800 1.000; device not removedfollowed bycases complete.FAIL_REGULAR_EXPRESSIONrejects any setup failure, any failure in (b) or (c), and any device removal. Without WARP, all of these return 77.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.
retire_null_srv_descnow calls the sharednull_srv_desc()and produces the same description as before. The retire, retire-views, retire-title, null-views and view-census tests all pass (below).Mutation checks (each reverted afterwards):
args[desc_index] = 0for the default view makesstartup_view_dimension_warpfail withFAIL: (a) the unknown-dimension SRV removed the device.FAIL: (c) slot after the refused replacement reads 1.000 0.251 0.000 0.502, expected null (all zero); device not removed. The copy check fails the same way.Commands and results (commit
c759b14b; release preset; NVIDIA GeForce RTX 5090, driver 32.0.16.1088; Windows 10.0.26200.9974; debug layer off; WARP = Microsoft Basic Render Driver)54 tests: 50 passed, 4 capability skips, 0 failed. Skips:
startup_view_heap_warpandstartup_logical_view_warp(the adapter accepts the descriptor count directly),spirv_sampler_views_warpandspirv_sampler_views_hardware(SPIR-V tools not installed). The new tests passed:startup_view_dimension,startup_view_dimension_control,startup_view_dimension_warp,startup_view_dimension_hardware(RTX 5090) andstartup_view_dimension_off_control_warp.642 tests: 636 passed, 6 capability skips, 0 failed. Skips:
startup_gameinput_script_syntax,startup_logical_view_warp,startup_run_sh,startup_sharedexp_target_warp,startup_small_texture_4k_addrlibandstartup_view_heap_warp.Not 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:
c759b14b6eThis change was AI-assisted.