runtime: check the device creation IID inventory #1482

Merged
Asimmimx merged 1 commit from upstream-pr/1489 into main 2026-11-24 13:29:40 +00:00
Asimmimx commented 2026-11-24 12:50:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T12:50:03Z.


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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582166708 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1489). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T12:50:03Z. --- ## 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).
upstream-sync closed this pull request 2026-11-24 14:02:54 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1482
No description provided.