startup: check the null Texture2D view fallback without a GPU #1730
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1737"
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 Asimmimx on 2026-11-24T17:58:36Z.
Refs #1149.
Change
src/startup_stubs/null_texture_view.hadapts two null descriptors. A null B5G5R5A1_UNORM Texture2D UAV (device slot 19, no resource, no counter) and a null B4G4R4A4_UNORM Texture2D RTV (slot 20, no resource) become R8G8B8A8_UNORM when the adapter lacks the view's use for the packed format (typed UAV or render target) and R8G8B8A8_UNORM has it. Everything else in the description stays as it was.Only one test reaches the header today:
startup_null_views_warp(and_hardware, which can skip). WARP supports both packed formats, so the rewrite is never taken there.docs/startup-runtime.mdalready records WARP's lineslot 19 format 86 -> 86; slot 20 format 115 -> 115. The test only checks that the result matches the adapter's answer, which on WARP is always "keep". That means 19 of 21 single-point mutants of the header passed it (table below).This PR adds
startup_null_texture_view, a check that runs without a GPU. It answersCheckFeatureSupportfrom fake adapters through a stand-in method table, the patternstartup_slice_footprintsuses forGetCopyableFootprints: slot 13 is the fake and every other slot ends the run. No D3D12 or DXGI library is linked.Each rewritten description must equal the source with only
Formatchanged. A kept one must leave the desktop description byte-for-byte untouched; it starts as a 0x5a pattern. Every query must beD3D12_FEATURE_FORMAT_SUPPORTwith the right size. That makes 28 cases.Negative control:
startup_null_texture_view_unchecked_fallback_controlruns the check with--mutate unchecked-fallback. That flag swaps in a copy of the header that rewrites without asking about R8G8B8A8. The control is registeredWILL_FAIL, and it prints 8 FAIL lines (startup_null_texture_view: 8 of 28 FAILED).The change adds
tests/startup_null_texture_view_check.cpp, nine CMake lines placed directly afterstartup_null_views, and one paragraph in the "Null Texture2D descriptors" section ofdocs/startup-runtime.md. The header and the existing test are unchanged.Mutation probe
I applied each mutation to the header alone and rebuilt the check:
startup_null_views_check(andd3d12_xs.dll) for the old column,startup_null_texture_view_checkfor the new one. Then I ran the test and reverted. None of this is committed.startup_null_views_warpstartup_null_texture_viewSurvivors: 19 of 21 before, 0 of 21 after.
Not pinned
!= TEXTURE2Dtest.Support2. The header never reads it.Verification
Commit
321ba502onorigin/mainbfe9158d,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260 (Visual Studio), Windows SDK 10.0.26100.0, WARP 10.0.26100.9818. No debug layer.startup_null_views_hardwarewas not run.tests/docs_links_check.py(17 files, 364 links),tests/bidi_controls_check.pyandgit diff --checkpassed.Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:17:30Z.
Review: COMMENTED
Verified commit
321ba50216343ff889d0cd7273210d817b5b662d— clean, no findings (0 P1, 0 P2).CMakeLists.txt,docs/startup-runtime.md,tests/startup_null_texture_view_check.cpp), clean-room and title-neutral.x2w_local::adapt_null_viewoverloads (UAV slot 19 and RTV slot 20) via a fakeID3D12Devicevtable trapping unexpected slots, verifying format-query counts, field preservation on rewrite, untouched output on refusal, crossed-use / single-use / B8G8R8A8-only / failed-query adapters, plus the--mutate unchecked-fallbacknegative control.Local verification
git diff --check,docs_links_check.py,bidi_controls_check.py): PASS--preset dev):cmake --build --preset dev --target startup_null_texture_view_check -- -j 8+ctest --preset dev -R '^(startup_null_texture_view|startup_null_texture_view_unchecked_fallback_control)$' --parallel 6 --no-tests=error --output-on-failure-> 2/2 passed (0.09s)/O2(--preset release):cmake --build --preset release --target startup_null_texture_view_check -- -j 8+ctest --preset release -R '^(startup_null_texture_view|startup_null_texture_view_unchecked_fallback_control)$' --parallel 6 --no-tests=error --output-on-failure-> 2/2 passed (0.10s)--patchmutatingsrc/startup_stubs/null_texture_view.h:13to returntruewithout queryingDXGI_FORMAT_R8G8B8A8_UNORM):startup_null_texture_viewfailed with8 of 28 FAILED(query count, single-use fallback, B8G8R8A8-only, and failed fallback query cases); automatically restored afterward.AI-assisted; commands listed were executed locally.