startup: check the null Texture2D view fallback without a GPU #1737

Manually merged
github merged 1 commit from gh-pr/1737/head into gh-pr/1737/base 2026-11-26 23:29:53 +00:00
Owner

@⁠Asimmimx on GitHub · 2026-11-24 17:58 UTC · original
Asimmimx:tests/null-texture-view-check → main · +318 −0 · 3 files · 1 commits · merged 2026-11-24 18:35 UTC

Refs #1149.

Change

src/startup_stubs/null_texture_view.h adapts 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.md already records WARP's line slot 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 answers CheckFeatureSupport from fake adapters through a stand-in method table, the pattern startup_slice_footprints uses for GetCopyableFootprints: slot 13 is the fake and every other slot ends the run. No D3D12 or DXGI library is linked.

Fake adapter Slot 19 (UAV) Slot 20 (RTV)
packed formats can be sampled, neither use; R8G8B8A8 has both rewritten, 2 queries rewritten, 2 queries
same adapter: with a resource, with a counter, Texture2DArray, the other packed format, R32_UINT kept kept
both packed formats have both uses (WARP's answer) kept kept
B5G5R5A1 has render target only, B4G4R4A4 typed UAV only rewritten rewritten
R8G8B8A8 has render target only kept rewritten
R8G8B8A8 has typed UAV only rewritten kept
only B8G8R8A8 has both uses kept kept
packed-format query fails kept kept
R8G8B8A8 query fails (Support1 still filled) kept kept

Each rewritten description must equal the source with only Format changed. A kept one must leave the desktop description byte-for-byte untouched; it starts as a 0x5a pattern. Every query must be D3D12_FEATURE_FORMAT_SUPPORT with the right size. That makes 28 cases.

Negative control: startup_null_texture_view_unchecked_fallback_control runs the check with --mutate unchecked-fallback. That flag swaps in a copy of the header that rewrites without asking about R8G8B8A8. The control is registered WILL_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 after startup_null_views, and one paragraph in the "Null Texture2D descriptors" section of docs/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 (and d3d12_xs.dll) for the old column, startup_null_texture_view_check for the new one. Then I ran the test and reverted. None of this is committed.

Mutant startup_null_views_warp with startup_null_texture_view
packed-format query failure returns true killed killed
packed-format support not checked killed killed
fallback support result not checked (only SUCCEEDED) survived killed
fallback asks for B8G8R8A8 survived killed
fallback asks the packed format again survived killed
UAV rewritten to B8G8R8A8 survived killed
RTV rewritten to B8G8R8A8 survived killed
UAV rewrite does not copy the source survived killed
RTV rewrite does not copy the source survived killed
UAV requires render target survived killed
RTV requires typed UAV survived killed
UAV counter gate dropped survived killed
UAV resource gate dropped survived killed
RTV resource gate dropped survived killed
UAV dimension gate dropped survived killed
RTV dimension gate dropped survived killed
UAV format gate dropped survived killed
RTV format gate dropped survived killed
UAV gate keys on B4G4R4A4 survived killed
RTV gate keys on B5G5R5A1 survived killed
UAV rewrite returns false survived killed

Survivors: 19 of 21 before, 0 of 21 after.

Not pinned

  • The order of the gates and the queries: whether a refused view queries the device at all. The check counts queries only for the two rewrites (two each). A refused view is checked by its result and its untouched description only.
  • UAV and RTV dimensions other than Texture2D and Texture2DArray. They take the same != TEXTURE2D test.
  • Support2. The header never reads it.

Verification

Commit 321ba502 on origin/main bfe9158d, dev preset (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_hardware was not run.

cmake --build --preset dev --target startup_null_texture_view_check startup_null_views_check
ctest --preset dev --no-tests=error -R '^(startup_null_texture_view|startup_null_texture_view_unchecked_fallback_control|startup_null_views_warp)$' -V
#   3/3 passed
#   startup_null_texture_view: PASS (28 cases)
#   control: "startup_null_texture_view: 8 of 28 FAILED" (WILL_FAIL)
#   startup_null_views_warp: "slot 19 format 86 -> 86; slot 20 format 115 -> 115; device OK"

tests/docs_links_check.py (17 files, 364 links), tests/bidi_controls_check.py and git diff --check passed.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

**@⁠Asimmimx** on GitHub · 2026-11-24 17:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1737) `Asimmimx:tests/null-texture-view-check` → `main` · +318 −0 · 3 files · 1 commits · merged 2026-11-24 18:35 UTC Refs #1149. ## Change `src/startup_stubs/null_texture_view.h` adapts 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.md` already records WARP's line `slot 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 answers `CheckFeatureSupport` from fake adapters through a stand-in method table, the pattern `startup_slice_footprints` uses for `GetCopyableFootprints`: slot 13 is the fake and every other slot ends the run. No D3D12 or DXGI library is linked. | Fake adapter | Slot 19 (UAV) | Slot 20 (RTV) | |---|---|---| | packed formats can be sampled, neither use; R8G8B8A8 has both | rewritten, 2 queries | rewritten, 2 queries | | same adapter: with a resource, with a counter, Texture2DArray, the other packed format, R32_UINT | kept | kept | | both packed formats have both uses (WARP's answer) | kept | kept | | B5G5R5A1 has render target only, B4G4R4A4 typed UAV only | rewritten | rewritten | | R8G8B8A8 has render target only | kept | rewritten | | R8G8B8A8 has typed UAV only | rewritten | kept | | only B8G8R8A8 has both uses | kept | kept | | packed-format query fails | kept | kept | | R8G8B8A8 query fails (Support1 still filled) | kept | kept | Each rewritten description must equal the source with only `Format` changed. A kept one must leave the desktop description byte-for-byte untouched; it starts as a 0x5a pattern. Every query must be `D3D12_FEATURE_FORMAT_SUPPORT` with the right size. That makes 28 cases. Negative control: `startup_null_texture_view_unchecked_fallback_control` runs the check with `--mutate unchecked-fallback`. That flag swaps in a copy of the header that rewrites without asking about R8G8B8A8. The control is registered `WILL_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 after `startup_null_views`, and one paragraph in the "Null Texture2D descriptors" section of `docs/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` (and `d3d12_xs.dll`) for the old column, `startup_null_texture_view_check` for the new one. Then I ran the test and reverted. None of this is committed. | Mutant | `startup_null_views_warp` | with `startup_null_texture_view` | |---|---|---| | packed-format query failure returns true | killed | killed | | packed-format support not checked | killed | killed | | fallback support result not checked (only SUCCEEDED) | **survived** | killed | | fallback asks for B8G8R8A8 | **survived** | killed | | fallback asks the packed format again | **survived** | killed | | UAV rewritten to B8G8R8A8 | **survived** | killed | | RTV rewritten to B8G8R8A8 | **survived** | killed | | UAV rewrite does not copy the source | **survived** | killed | | RTV rewrite does not copy the source | **survived** | killed | | UAV requires render target | **survived** | killed | | RTV requires typed UAV | **survived** | killed | | UAV counter gate dropped | **survived** | killed | | UAV resource gate dropped | **survived** | killed | | RTV resource gate dropped | **survived** | killed | | UAV dimension gate dropped | **survived** | killed | | RTV dimension gate dropped | **survived** | killed | | UAV format gate dropped | **survived** | killed | | RTV format gate dropped | **survived** | killed | | UAV gate keys on B4G4R4A4 | **survived** | killed | | RTV gate keys on B5G5R5A1 | **survived** | killed | | UAV rewrite returns false | **survived** | killed | Survivors: 19 of 21 before, 0 of 21 after. ## Not pinned - The order of the gates and the queries: whether a refused view queries the device at all. The check counts queries only for the two rewrites (two each). A refused view is checked by its result and its untouched description only. - UAV and RTV dimensions other than Texture2D and Texture2DArray. They take the same `!= TEXTURE2D` test. - `Support2`. The header never reads it. ## Verification Commit `321ba502` on `origin/main` `bfe9158d`, `dev` preset (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_hardware` was not run. ```powershell cmake --build --preset dev --target startup_null_texture_view_check startup_null_views_check ctest --preset dev --no-tests=error -R '^(startup_null_texture_view|startup_null_texture_view_unchecked_fallback_control|startup_null_views_warp)$' -V # 3/3 passed # startup_null_texture_view: PASS (28 cases) # control: "startup_null_texture_view: 8 of 28 FAILED" (WILL_FAIL) # startup_null_views_warp: "slot 19 format 86 -> 86; slot 20 format 115 -> 115; device OK" ``` `tests/docs_links_check.py` (17 files, 364 links), `tests/bidi_controls_check.py` and `git diff --check` passed. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
src/startup_stubs/null_texture_view.h rewrites a null B5G5R5A1_UNORM
Texture2D UAV (device slot 19) or a null B4G4R4A4_UNORM Texture2D RTV
(slot 20) to R8G8B8A8_UNORM when the adapter lacks the view's use for
the packed format and R8G8B8A8_UNORM has it. Its only test,
startup_null_views_warp, runs on WARP, which supports both packed
formats (docs/startup-runtime.md records "86 -> 86; 115 -> 115"), so
the rewrite is never taken there. 19 of 21 single-point mutants of the
header survived it: the required-use flags swapped, B8G8R8A8 as the
fallback, the fallback query or its result dropped, the rewrite that
does not copy the source description, a wrong rewritten format, every
dropped gate (resource, counter, dimension, format) and a rewrite that
returns false.

The new device-free check startup_null_texture_view answers
CheckFeatureSupport from fake adapters through a stand-in method table
(the pattern of startup_slice_footprints): packed formats with and
without their use, each with only the other slot's use, R8G8B8A8 with
one use or none, only B8G8R8A8 with the uses, and failed queries of
either format. It checks each result, that a rewrite keeps every other
field of the description, that a refused one leaves the desktop
description untouched, and that each slot asks two format-support
queries of the right size. All 21 mutants are killed.

startup_null_texture_view_unchecked_fallback_control rewrites without
asking about R8G8B8A8 and must fail (WILL_FAIL).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:29:51 +00:00
github manually merged commit 321ba50216 into gh-pr/1737/base 2026-11-26 23:29:53 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 18:17 UTC · original · reviewed

Verified commit 321ba50216343ff889d0cd7273210d817b5b662d — clean, no findings (0 P1, 0 P2).

  • Scope is test + docs + test-only CMake (CMakeLists.txt, docs/startup-runtime.md, tests/startup_null_texture_view_check.cpp), clean-room and title-neutral.
  • Exercises both x2w_local::adapt_null_view overloads (UAV slot 19 and RTV slot 20) via a fake ID3D12Device vtable 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-fallback negative control.

Local verification

  • Linux checks (git diff --check, docs_links_check.py, bidi_controls_check.py): PASS
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--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)
    • Release /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)
  • Mutation check on Windows Server 2025 (--patch mutating src/startup_stubs/null_texture_view.h:13 to return true without querying DXGI_FORMAT_R8G8B8A8_UNORM): startup_null_texture_view failed with 8 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.

**@⁠tedin7** on GitHub · 2026-11-24 18:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1737#pullrequestreview-6044894170) · **reviewed** Verified commit `321ba50216343ff889d0cd7273210d817b5b662d` — clean, no findings (0 P1, 0 P2). - Scope is test + docs + test-only CMake (`CMakeLists.txt`, `docs/startup-runtime.md`, `tests/startup_null_texture_view_check.cpp`), clean-room and title-neutral. - Exercises both `x2w_local::adapt_null_view` overloads (UAV slot 19 and RTV slot 20) via a fake `ID3D12Device` vtable 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-fallback` negative control. ### Local verification - Linux checks (`git diff --check`, `docs_links_check.py`, `bidi_controls_check.py`): PASS - Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP): - Debug (`--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`) - Release `/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`) - Mutation check on Windows Server 2025 (`--patch` mutating `src/startup_stubs/null_texture_view.h:13` to return `true` without querying `DXGI_FORMAT_R8G8B8A8_UNORM`): `startup_null_texture_view` failed with `8 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.