runtime: check the device creation IID inventory #1489
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1489
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1489/head"
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?
@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 UTCChange
This adds a device-free check for the D3D12.X device-slot inventory (
src/d3d12x_device_slots.{h,cpp}).D3D12XboxCreateDeviceusesaccepts_creation_iidto accept or refuse the device IID a caller requests, andformat_iidto write the refused IID in its diagnostic.Today's callers request only three IIDs:
__uuidof(ID3D12Device), which is accepted;{7c0e1a10-…}, which differs from every accepted IID in every byte;ID3D12Device3, fromvm_translation_device_*, which must be refused.No test asks for
ID3D12Device1, the IID that the GDK samples request throughIID_GRAPHICS_PPV_ARGS, which the inventory marksdocumented_unimplementedand this path must refuse. No test asks for an IID one byte away fromID3D12Device, or for the null IID either. As a result, a GUID comparison that skipsData3or the lastData4byte would accept a neighbor ofID3D12Device, and acceptingdocumented_unimplementedrows would acceptID3D12Device1. Both left the 26 related tests passing.d3d12x_device_slotscompilessrc/d3d12x_device_slots.cppinto a small executable, with no device and no DLL. It checks:__uuidofvalues ofID3D12Device,ID3D12Device1andID3D12Device3;ID3D12Deviceare not found and not accepted, and the same forGUID{}andIUnknown;format_iidagainst hand-written lowercase strings for those IIDs, the null IID, an all-ffIID and{01234567-89ab-cdef-0123-456789abcdef}, plus the terminating NUL.d3d12x_device_slots_device1_controlruns--mutate device1, which expectsID3D12Device1to 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,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818.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_warpandstartup_{null_views,view_heap,plane_size_device,title_heap_device}_warp.tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpassed.Mutation probe
I applied each mutation to
src/d3d12x_device_slots.{h,cpp}alone, rebuiltd3d12_xs.dll, ran the 26 tests, then reverted. None of this is committed.d3d12x_device_slotssame_guidignoresData4[7]same_guidignoresData3accepts_creation_iidalso acceptsdocumented_unimplementedID3D12Device1accepted)find_creation_iidalso matches vtable rowsformat_iidwith uppercase hexd3d12x_device_negative_warp)format_iidwithData2/Data3swappedID3D12Devicerow corruptedE_NOINTERFACE)ID3D12Device1row corruptedThe vtable-row mutant cannot be seen through
accepts_creation_iid, because those rows areobserved_unimplemented. Only the directfind_creation_iidcheck catches it.Checklist
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.