[Help Wanted] Fix real _GAMING_XBOX_SCARLETT d3d12_xs ABI gaps (ID3D12Device8+ proxy escape, IDXGIDevice1 QI, WaitFrameEventX/PresentX ABI) #18

Closed
opened 2026-11-26 19:10:54 +00:00 by github-bot · 0 comments
Owner

@⁠californiaAlmonds on GitHub · 2026-11-22 08:35 UTC · original

Summary

Live bring-up of Microsoft's untouched MIT Xbox-GDK-Samples/Samples/IntroGraphics/SimpleTriangle compiled under /D_GAMING_XBOX_SCARLETT /D_GAMING_XBOX against OpenScarlett exposed 6 concrete d3d12_xs / PLM ABI mismatches that PC-GDK tests do not hit:

  1. DeviceX::QueryInterface silent bypass on ID3D12Device8+:
    • Real _GAMING_XBOX_SCARLETT titles request __uuidof(ID3D12Device8) (and up to ID3D12Device12 in newer GDKs) from D3D12XboxCreateDevice.
    • DeviceX currently wraps through ID3D12Device6 and falls through to host_dev_->QueryInterface(riid, ppvObject) (src/gpu/d3d12_xs/device_x.cpp), returning the raw unwrapped Windows device and immediately releasing/deleting DeviceX on frame 0.
  2. Missing IDXGIDevice1 / IDXGIDevice on DeviceX::QueryInterface:
    • Untouched DeviceResources::RegisterFrameEvents() calls m_d3dDevice.As(&dxgiDevice) -> GetAdapter() -> EnumOutputs(0). Desktop D3D12 does not implement IDXGIDevice1 on ID3D12Device — only Xbox d3d12_xs does.
    • Expose a lightweight IDXGIDevice1 sub-interface returning the active host IDXGIAdapter (with a safe synthetic IDXGIOutput fallback on headless CI runners).
  3. WaitFrameEventX 5-arg vs 4-arg ABI crash:
    • Real GDKX calls WaitFrameEventX(Event, TimeoutMilliseconds, pReserved, Flags, &pOutToken) (5 args).
    • DeviceX::WaitFrameEventX currently takes 4 args, causing Flags = 0 to be dereferenced as pOutToken.
  4. PresentX 3-arg vs 4-arg ABI mismatch:
    • Real GDKX calls ID3D12CommandQueue::PresentX(PlaneCount, pPlaneParameters, pPresentParameters) (3 args), with D3D12XBOX_FRAME_PIPELINE_TOKEN and standard DXGI_COLOR_SPACE_TYPE inside D3D12XBOX_PRESENT_PLANE_PARAMETERS (and supports PlaneCount == 0, pPlaneParameters == nullptr for blank/suspend presents).
  5. GXDK 221000+ D3D12XBOX_CREATE_DEVICE_PARAMETERS & GDKX vtable layout:
    • Align D3D12XBOX_CREATE_DEVICE_PARAMETERS fields with GXDK 221000+ (Version, ProcessDebugFlags, GraphicsCommandQueueRingSizeBytes, DisableGeometryShaderAllocations, DisableTessellationShaderAllocations, DisableDXR, CreateDeviceFlags, AmplificationShaderIndirectArgsBufferSize, AmplificationShaderPayloadBufferSize) instead of reading custom offsets.
    • Ensure Xbox device/queue methods (SetFrameIntervalX, ScheduleFrameEventX, WaitFrameEventX, PresentX, SuspendX, ResumeX) are directly callable via standard GDKX device/queue interfaces.
  6. Missing appnotify.h PLM notification exports:
    • Export RegisterAppStateChangeNotification, UnregisterAppStateChangeNotification, RegisterAppConstrainedChangeNotification, and UnregisterAppConstrainedChangeNotification backed by a thread-safe callback registry.

Key Files

  • src/gpu/d3d12_xs/device_x.h / src/gpu/d3d12_xs/device_x.cpp
  • src/gpu/d3d12_xs/command_queue_x.h / src/gpu/d3d12_xs/command_queue_x.cpp
  • src/shims/d3d12_xs_shim.cpp
  • src/shims/ (PLM appnotify.h exports)

Acceptance Criteria

  • DeviceX::QueryInterface wraps ID3D12Device7–ID3D12Device12 (as supported by host) and never leaks raw host_dev_ for any ID3D12Device* IID.
  • DeviceX::QueryInterface(IID_IDXGIDevice1) returns a working adapter/output path on both desktop GPUs and headless CI.
  • WaitFrameEventX (5-arg), PresentX (3-arg), GXDK 221000+ D3D12XBOX_CREATE_DEVICE_PARAMETERS, and appnotify.h PLM APIs have passing unit tests.
  • Existing ctest --output-on-failure passes with 0 regressions and 0 warnings.

Want to claim this or coordinate before starting? Comment below or drop into our Discord: https://discord.gg/sShMY2fjR

**@⁠californiaAlmonds** on GitHub · 2026-11-22 08:35 UTC · [original](https://github.com/californiaAlmonds/OpenScarlett/issues/18) ## Summary Live bring-up of Microsoft's untouched MIT `Xbox-GDK-Samples/Samples/IntroGraphics/SimpleTriangle` compiled under `/D_GAMING_XBOX_SCARLETT /D_GAMING_XBOX` against OpenScarlett exposed 6 concrete `d3d12_xs` / PLM ABI mismatches that PC-GDK tests do not hit: 1. **`DeviceX::QueryInterface` silent bypass on `ID3D12Device8`+:** - Real `_GAMING_XBOX_SCARLETT` titles request `__uuidof(ID3D12Device8)` (and up to `ID3D12Device12` in newer GDKs) from `D3D12XboxCreateDevice`. - `DeviceX` currently wraps through `ID3D12Device6` and falls through to `host_dev_->QueryInterface(riid, ppvObject)` (`src/gpu/d3d12_xs/device_x.cpp`), returning the raw unwrapped Windows device and immediately releasing/deleting `DeviceX` on frame 0. 2. **Missing `IDXGIDevice1` / `IDXGIDevice` on `DeviceX::QueryInterface`:** - Untouched `DeviceResources::RegisterFrameEvents()` calls `m_d3dDevice.As(&dxgiDevice)` -> `GetAdapter()` -> `EnumOutputs(0)`. Desktop D3D12 does not implement `IDXGIDevice1` on `ID3D12Device` — only Xbox `d3d12_xs` does. - Expose a lightweight `IDXGIDevice1` sub-interface returning the active host `IDXGIAdapter` (with a safe synthetic `IDXGIOutput` fallback on headless CI runners). 3. **`WaitFrameEventX` 5-arg vs 4-arg ABI crash:** - Real GDKX calls `WaitFrameEventX(Event, TimeoutMilliseconds, pReserved, Flags, &pOutToken)` (5 args). - `DeviceX::WaitFrameEventX` currently takes 4 args, causing `Flags = 0` to be dereferenced as `pOutToken`. 4. **`PresentX` 3-arg vs 4-arg ABI mismatch:** - Real GDKX calls `ID3D12CommandQueue::PresentX(PlaneCount, pPlaneParameters, pPresentParameters)` (3 args), with `D3D12XBOX_FRAME_PIPELINE_TOKEN` and standard `DXGI_COLOR_SPACE_TYPE` inside `D3D12XBOX_PRESENT_PLANE_PARAMETERS` (and supports `PlaneCount == 0, pPlaneParameters == nullptr` for blank/suspend presents). 5. **GXDK 221000+ `D3D12XBOX_CREATE_DEVICE_PARAMETERS` & GDKX vtable layout:** - Align `D3D12XBOX_CREATE_DEVICE_PARAMETERS` fields with GXDK 221000+ (`Version`, `ProcessDebugFlags`, `GraphicsCommandQueueRingSizeBytes`, `DisableGeometryShaderAllocations`, `DisableTessellationShaderAllocations`, `DisableDXR`, `CreateDeviceFlags`, `AmplificationShaderIndirectArgsBufferSize`, `AmplificationShaderPayloadBufferSize`) instead of reading custom offsets. - Ensure Xbox device/queue methods (`SetFrameIntervalX`, `ScheduleFrameEventX`, `WaitFrameEventX`, `PresentX`, `SuspendX`, `ResumeX`) are directly callable via standard GDKX device/queue interfaces. 6. **Missing `appnotify.h` PLM notification exports:** - Export `RegisterAppStateChangeNotification`, `UnregisterAppStateChangeNotification`, `RegisterAppConstrainedChangeNotification`, and `UnregisterAppConstrainedChangeNotification` backed by a thread-safe callback registry. ## Key Files - `src/gpu/d3d12_xs/device_x.h` / `src/gpu/d3d12_xs/device_x.cpp` - `src/gpu/d3d12_xs/command_queue_x.h` / `src/gpu/d3d12_xs/command_queue_x.cpp` - `src/shims/d3d12_xs_shim.cpp` - `src/shims/` (PLM `appnotify.h` exports) ## Acceptance Criteria - `DeviceX::QueryInterface` wraps `ID3D12Device7`–`ID3D12Device12` (as supported by host) and never leaks raw `host_dev_` for any `ID3D12Device*` IID. - `DeviceX::QueryInterface(IID_IDXGIDevice1)` returns a working adapter/output path on both desktop GPUs and headless CI. - `WaitFrameEventX` (5-arg), `PresentX` (3-arg), GXDK 221000+ `D3D12XBOX_CREATE_DEVICE_PARAMETERS`, and `appnotify.h` PLM APIs have passing unit tests. - Existing `ctest --output-on-failure` passes with 0 regressions and 0 warnings. --- Want to claim this or coordinate before starting? Comment below or drop into our Discord: https://discord.gg/sShMY2fjR
github-bot 2026-11-26 19:10:54 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:10:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.