runtime: check the device creation IID inventory #1489

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

@⁠Asimmimx on GitHub · 2026-11-24 12:50 UTC · original
Asimmimx:runtime/device-slots-check → main · +102 −0 · 3 files · 1 commits · merged 2026-11-24 13:29 UTC

Change

This adds a device-free check for the D3D12.X device-slot inventory (src/d3d12x_device_slots.{h,cpp}). D3D12XboxCreateDevice uses accepts_creation_iid to accept or refuse the device IID a caller requests, and format_iid to write the refused IID in its diagnostic.

Today's callers request only three IIDs:

  • __uuidof(ID3D12Device), which is accepted;
  • the fixture GUID {7c0e1a10-…}, which differs from every accepted IID in every byte;
  • ID3D12Device3, from vm_translation_device_*, which must be refused.

No test asks for ID3D12Device1, the IID that the GDK samples request through IID_GRAPHICS_PPV_ARGS, which the inventory marks documented_unimplemented and this path must refuse. No test asks for an IID one byte away from ID3D12Device, or for the null IID either. As a result, a GUID comparison that skips Data3 or the last Data4 byte would accept a neighbor of ID3D12Device, and accepting documented_unimplemented rows would accept ID3D12Device1. Both left the 26 related tests passing.

d3d12x_device_slots compiles src/d3d12x_device_slots.cpp into a small executable, with no device and no DLL. It checks:

  • the row name, kind, state, index and acceptance for the SDK __uuidof values of ID3D12Device, ID3D12Device1 and ID3D12Device3;
  • that all 16 single-byte neighbors of ID3D12Device are not found and not accepted, and the same for GUID{} and IUnknown;
  • format_iid against hand-written lowercase strings for those IIDs, the null IID, an all-ff IID and {01234567-89ab-cdef-0123-456789abcdef}, plus the terminating NUL.

d3d12x_device_slots_device1_control runs --mutate device1, which expects ID3D12Device1 to be accepted, and must fail (WILL_FAIL).

The change is test, CMake and docs/experiments.md (the "D3D12XboxCreateDevice slot inventory and fixture" section) only.

Verification

Commit 93672b99 (main) plus this change, dev preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818.

ctest --preset dev --no-tests=error -R '^(d3d12x_device_slots.*|d3d12x_device_.*_warp)$' -V
d3d12x_device_slots ................... Passed
d3d12x_device_slots_device1_control ... Passed   (FAIL ID3D12Device1: accepted=0, expected 1, as the control intends)
d3d12x_device_create_warp / d3d12x_device_negative_warp / d3d12x_device_struct_return_warp  Passed

The 26 related tests passed on the unmodified source, with no skips. They are the 15 non-hardware ^(d3d12x_|d3d12_xs_shim_) tests, vm_translation_*_warp, vm_translation_shared_range, xmem_page_runs_device_warp and startup_{null_views,view_heap,plane_size_device,title_heap_device}_warp. tests/docs_links_check.py, tests/bidi_controls_check.py and git diff --check passed.

Mutation probe

I applied each mutation to src/d3d12x_device_slots.{h,cpp} alone, rebuilt d3d12_xs.dll, ran the 26 tests, then reverted. None of this is committed.

Mutant Existing 26 d3d12x_device_slots
same_guid ignores Data4[7] survived fails (byte 15 neighbor)
same_guid ignores Data3 survived fails (byte 6 and 7 neighbors)
accepts_creation_iid also accepts documented_unimplemented survived fails (ID3D12Device1 accepted)
find_creation_iid also matches vtable rows survived fails (null IID found)
format_iid with uppercase hex killed (d3d12x_device_negative_warp) fails
format_iid with Data2/Data3 swapped killed (same) fails
last byte of the ID3D12Device row corrupted killed (9 WARP tests, E_NOINTERFACE) fails
last byte of the ID3D12Device1 row corrupted survived fails (row not found)

The vtable-row mutant cannot be seen through accepts_creation_iid, because those rows are observed_unimplemented. Only the direct find_creation_iid check catches it.

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 12:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1489) `Asimmimx:runtime/device-slots-check` → `main` · +102 −0 · 3 files · 1 commits · merged 2026-11-24 13:29 UTC ## Change This adds a device-free check for the D3D12.X device-slot inventory (`src/d3d12x_device_slots.{h,cpp}`). `D3D12XboxCreateDevice` uses `accepts_creation_iid` to accept or refuse the device IID a caller requests, and `format_iid` to write the refused IID in its diagnostic. Today's callers request only three IIDs: - `__uuidof(ID3D12Device)`, which is accepted; - the fixture GUID `{7c0e1a10-…}`, which differs from every accepted IID in every byte; - `ID3D12Device3`, from `vm_translation_device_*`, which must be refused. No test asks for `ID3D12Device1`, the IID that the GDK samples request through `IID_GRAPHICS_PPV_ARGS`, which the inventory marks `documented_unimplemented` and this path must refuse. No test asks for an IID one byte away from `ID3D12Device`, or for the null IID either. As a result, a GUID comparison that skips `Data3` or the last `Data4` byte would accept a neighbor of `ID3D12Device`, and accepting `documented_unimplemented` rows would accept `ID3D12Device1`. Both left the 26 related tests passing. `d3d12x_device_slots` compiles `src/d3d12x_device_slots.cpp` into a small executable, with no device and no DLL. It checks: - the row name, kind, state, index and acceptance for the SDK `__uuidof` values of `ID3D12Device`, `ID3D12Device1` and `ID3D12Device3`; - that all 16 single-byte neighbors of `ID3D12Device` are not found and not accepted, and the same for `GUID{}` and `IUnknown`; - `format_iid` against hand-written lowercase strings for those IIDs, the null IID, an all-`ff` IID and `{01234567-89ab-cdef-0123-456789abcdef}`, plus the terminating NUL. `d3d12x_device_slots_device1_control` runs `--mutate device1`, which expects `ID3D12Device1` to be accepted, and must fail (`WILL_FAIL`). The change is test, CMake and `docs/experiments.md` (the "D3D12XboxCreateDevice slot inventory and fixture" section) only. ## Verification Commit `93672b99` (`main`) plus this change, `dev` preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818. ```powershell ctest --preset dev --no-tests=error -R '^(d3d12x_device_slots.*|d3d12x_device_.*_warp)$' -V ``` ```text d3d12x_device_slots ................... Passed d3d12x_device_slots_device1_control ... Passed (FAIL ID3D12Device1: accepted=0, expected 1, as the control intends) d3d12x_device_create_warp / d3d12x_device_negative_warp / d3d12x_device_struct_return_warp Passed ``` The 26 related tests passed on the unmodified source, with no skips. They are the 15 non-hardware `^(d3d12x_|d3d12_xs_shim_)` tests, `vm_translation_*_warp`, `vm_translation_shared_range`, `xmem_page_runs_device_warp` and `startup_{null_views,view_heap,plane_size_device,title_heap_device}_warp`. `tests/docs_links_check.py`, `tests/bidi_controls_check.py` and `git diff --check` passed. ## Mutation probe I applied each mutation to `src/d3d12x_device_slots.{h,cpp}` alone, rebuilt `d3d12_xs.dll`, ran the 26 tests, then reverted. None of this is committed. | Mutant | Existing 26 | `d3d12x_device_slots` | |---|---|---| | `same_guid` ignores `Data4[7]` | survived | fails (byte 15 neighbor) | | `same_guid` ignores `Data3` | survived | fails (byte 6 and 7 neighbors) | | `accepts_creation_iid` also accepts `documented_unimplemented` | survived | fails (`ID3D12Device1` accepted) | | `find_creation_iid` also matches vtable rows | survived | fails (null IID found) | | `format_iid` with uppercase hex | killed (`d3d12x_device_negative_warp`) | fails | | `format_iid` with `Data2`/`Data3` swapped | killed (same) | fails | | last byte of the `ID3D12Device` row corrupted | killed (9 WARP tests, `E_NOINTERFACE`) | fails | | last byte of the `ID3D12Device1` row corrupted | survived | fails (row not found) | The vtable-row mutant cannot be seen through `accepts_creation_iid`, because those rows are `observed_unimplemented`. Only the direct `find_creation_iid` check catches it. ## 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/d3d12x_device_slots.cpp decides which IIDs D3D12XboxCreateDevice
accepts and prints the GUID text of a refused one. The device fixtures
request only IID_ID3D12Device and the fixture GUID
{7c0e1a10-5f2d-4b7a-9a51-3d9c6b2e8f01}, and vm_translation_device asks
for ID3D12Device3, so no test asks for ID3D12Device1, a near neighbor of
ID3D12Device or the null IID. Single-point mutants (a GUID comparison
that ignores the last Data4 byte or Data3, ID3D12Device1 accepted as
documented, find_creation_iid matching the GUID{} vtable rows, a
corrupted ID3D12Device1 row) all left the 26 WARP and device-free
d3d12x_, d3d12_xs_shim_, vm_translation_ and startup device tests
passing. Uppercase or swapped Data2/Data3 text and a corrupted
ID3D12Device row were already caught.

d3d12x_device_slots compiles the inventory without a device and checks
the rows and acceptance for the SDK __uuidof values of ID3D12Device,
ID3D12Device1 and ID3D12Device3, every IID one byte away from
ID3D12Device, the null IID and IUnknown, and format_iid against
hand-written lowercase text. Each of those mutants now fails it. The
device1 control expects ID3D12Device1 to be accepted and must fail.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:11:13 +00:00
github manually merged commit e706f7312a into gh-pr/1489/base 2026-11-26 23:11:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.