diff options
| author | ubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com> | 2026-11-24 08:44:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-24 08:44:42 -0500 |
| commit | 89e0ea9b55d072bdb72a3771c9336b2f2990ba75 (patch) | |
| tree | 4c6b9945e459cd242a1ccf82812c7c0bf7b91aff /runtime/shims/xbox_present.cpp | |
| parent | 05318a387ced91ae07faa464404a6e92c990810c (diff) | |
| parent | d743662615cba6c69e125d6773fcc38f9856760c (diff) | |
Merge pull request #402 from ubiquitarianism/feat/xs-frame-pacing-presentx
d3d12_xs: add multi-event FramePacer TOKEN_ON_TIMEOUT and wire XboxPresentation to device/queue slots (RT-XS-FRAME-PACING-PRESENTX)
Diffstat (limited to 'runtime/shims/xbox_present.cpp')
| -rw-r--r-- | runtime/shims/xbox_present.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/runtime/shims/xbox_present.cpp b/runtime/shims/xbox_present.cpp index dd5f810cf..024b82170 100644 --- a/runtime/shims/xbox_present.cpp +++ b/runtime/shims/xbox_present.cpp | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #include "xbox_present.h" | 1 | #include "xbox_present.h" |
| 2 | 2 | ||
| 3 | #include "d3d12_trace.h" | 3 | #include "d3d12_trace.h" |
| 4 | #include "d3d12_xs_device.h" | ||
| 4 | 5 | ||
| 5 | #include "../src/vulkan_present.h" | 6 | #include "../src/vulkan_present.h" |
| 6 | 7 | ||
| @@ -314,4 +315,39 @@ HRESULT XboxPresentation::ResumeX() { | |||
| 314 | return S_OK; | 315 | return S_OK; |
| 315 | } | 316 | } |
| 316 | 317 | ||
| 318 | bool attach_xbox_presentation(void* device_proxy, XboxPresentation* presentation) { | ||
| 319 | if (!presentation) return rt::d3d12_xs::set_presentation_handler(device_proxy, nullptr); | ||
| 320 | rt::d3d12_xs::PresentationHandler handler{}; | ||
| 321 | handler.context = presentation; | ||
| 322 | handler.set_frame_interval = [](void* ctx, IUnknown* output, UINT interval_us, UINT latency, UINT flags) { | ||
| 323 | return static_cast<XboxPresentation*>(ctx)->SetFrameIntervalX(output, interval_us, latency, flags); | ||
| 324 | }; | ||
| 325 | handler.schedule_frame_event = [](void* ctx, UINT event, UINT offset_us, UINT flags) { | ||
| 326 | return static_cast<XboxPresentation*>(ctx)->ScheduleFrameEventX(event, offset_us, flags); | ||
| 327 | }; | ||
| 328 | handler.wait_frame_event = [](void* ctx, UINT event, DWORD timeout_ms, UINT flags, std::uint64_t* token) { | ||
| 329 | return static_cast<XboxPresentation*>(ctx)->WaitFrameEventX(event, timeout_ms, flags, token); | ||
| 330 | }; | ||
| 331 | handler.get_frame_statistics = [](void* ctx, std::uint64_t token, UINT type_mask, UINT* count, void* out) { | ||
| 332 | return static_cast<XboxPresentation*>(ctx)->GetFrameStatisticsX( | ||
| 333 | token, type_mask, count, static_cast<leonida::FrameStatistic*>(out)); | ||
| 334 | }; | ||
| 335 | handler.present_x = [](void* ctx, UINT plane_count, const void* planes, const void* params) { | ||
| 336 | return static_cast<XboxPresentation*>(ctx)->PresentX( | ||
| 337 | plane_count, static_cast<const XboxPresentPlaneParameters*>(planes), | ||
| 338 | static_cast<const XboxPresentParameters*>(params)); | ||
| 339 | }; | ||
| 340 | handler.suspend_x = [](void* ctx, UINT flags) { | ||
| 341 | return static_cast<XboxPresentation*>(ctx)->SuspendX(flags); | ||
| 342 | }; | ||
| 343 | handler.resume_x = [](void* ctx) { | ||
| 344 | return static_cast<XboxPresentation*>(ctx)->ResumeX(); | ||
| 345 | }; | ||
| 346 | return rt::d3d12_xs::set_presentation_handler(device_proxy, &handler); | ||
| 347 | } | ||
| 348 | |||
| 349 | bool detach_xbox_presentation(void* device_proxy) { | ||
| 350 | return rt::d3d12_xs::set_presentation_handler(device_proxy, nullptr); | ||
| 351 | } | ||
| 352 | |||
| 317 | } // namespace rt::d3d12 | 353 | } // namespace rt::d3d12 |