diff options
| author | SweatierKey <53280918+SweatierKey@users.noreply.github.com> | 2026-11-23 20:40:32 +0100 |
|---|---|---|
| committer | SweatierKey <53280918+SweatierKey@users.noreply.github.com> | 2026-11-23 21:01:00 +0100 |
| commit | 86ac5d5ebab5a96551a30a71dc88736e78d178e6 (patch) | |
| tree | 5f51c9b366a458c99421347562cff79ac091c63b /runtime/src | |
| parent | 867d922f09b86583859796a174df89555fb32da8 (diff) | |
runtime: handle Xbox device slot 81 (GetFrameEventsX)
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/d3d12_xs_frame_events.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/runtime/src/d3d12_xs_frame_events.h b/runtime/src/d3d12_xs_frame_events.h new file mode 100644 index 000000000..b4a128fb9 --- /dev/null +++ b/runtime/src/d3d12_xs_frame_events.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | // Portable Xbox Series D3D12 device slot 81 (GetFrameEventsX) ABI model (no Windows or Vulkan dependency). | ||
| 4 | // | ||
| 5 | // Observed call shape (static ABI inspection, offsets and stride only): | ||
| 6 | // HRESULT GetFrameEventsX(uint64_t frameToken, uint32_t flags, uint32_t* pNumEvents, XboxFrameEvent* pEvents) | ||
| 7 | // | ||
| 8 | // Each output event record has stride 0x38 bytes: | ||
| 9 | // +0x00: uint32_t event_type | ||
| 10 | // +0x08: uint8_t status (0 = ok) | ||
| 11 | // +0x18: uint64_t timestamp | ||
| 12 | |||
| 13 | #include <cstddef> | ||
| 14 | #include <cstdint> | ||
| 15 | |||
| 16 | namespace leonida::d3d12_xs { | ||
| 17 | |||
| 18 | // Device slot 81 (GetFrameEventsX) output event record (exact stride 0x38 bytes). | ||
| 19 | struct XboxFrameEvent { | ||
| 20 | std::uint32_t event_type = 0; // +0x00 | ||
| 21 | std::uint32_t reserved0 = 0; // +0x04 | ||
| 22 | std::uint8_t status = 0; // +0x08 (0 = ok) | ||
| 23 | std::uint8_t pad[15] = {}; // +0x09..+0x17 | ||
| 24 | std::uint64_t timestamp = 0; // +0x18 | ||
| 25 | std::uint64_t reserved1[3] = {}; // +0x20..+0x37 | ||
| 26 | }; | ||
| 27 | static_assert(sizeof(XboxFrameEvent) == 0x38); | ||
| 28 | static_assert(offsetof(XboxFrameEvent, event_type) == 0x00); | ||
| 29 | static_assert(offsetof(XboxFrameEvent, status) == 0x08); | ||
| 30 | static_assert(offsetof(XboxFrameEvent, timestamp) == 0x18); | ||
| 31 | |||
| 32 | enum class FrameEventQueryStatus : std::uint32_t { | ||
| 33 | ok = 0, | ||
| 34 | null_count = 1, | ||
| 35 | null_buffer = 2, | ||
| 36 | }; | ||
| 37 | |||
| 38 | // Validates GetFrameEventsX output parameters and reports zero pending frame events. | ||
| 39 | // With no hardware flip-event history yet, reporting *num_events = 0 is cleanly handled by callers. | ||
| 40 | inline FrameEventQueryStatus query_frame_events_empty(std::uint32_t* num_events, XboxFrameEvent* events) { | ||
| 41 | if (!num_events) return FrameEventQueryStatus::null_count; | ||
| 42 | if (*num_events > 0 && !events) return FrameEventQueryStatus::null_buffer; | ||
| 43 | *num_events = 0; | ||
| 44 | return FrameEventQueryStatus::ok; | ||
| 45 | } | ||
| 46 | |||
| 47 | } // namespace leonida::d3d12_xs | ||