[PR #402] [MERGED] d3d12_xs: add multi-event FramePacer TOKEN_ON_TIMEOUT and wire XboxPresentation to device/queue slots (RT-XS-FRAME-PACING-PRESENTX) #453

Closed
opened 2026-11-26 20:17:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/402
Author: @Andretuta
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: feat/xs-frame-pacing-presentx


📝 Commits (4)

  • ddafa07 d3d12_xs: multi-event FramePacer TOKEN_ON_TIMEOUT and XboxPresentation proxy wiring
  • 7aa5d60 Merge remote-tracking branch 'ubiq/main' into feat/xs-frame-pacing-presentx
  • 2a3e7a2 d3d12_xs: route presentation slots safely, hold the handler across calls
  • d743662 docs: document the presentation slot routes and their env variables

📊 Changes

8 files changed (+468 additions, -72 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+1 -0)
📝 runtime/shims/d3d12_xs_device.cpp (+146 -25)
📝 runtime/shims/d3d12_xs_device.h (+18 -0)
📝 runtime/shims/xbox_present.cpp (+36 -0)
📝 runtime/shims/xbox_present.h (+10 -0)
📝 runtime/src/frame_pacer.h (+80 -46)
📝 runtime/test/frame_pacer_test.cpp (+41 -0)
📝 runtime/test/xs_proxy_mock_test.cpp (+136 -1)

📄 Description

Claimed in the coordination issue as: RT-XS-FRAME-PACING-PRESENTX (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121796272)

What and why

Extends FramePacer and adds the seam that will connect the Xbox device/queue proxies to XboxPresentation:

  • runtime/src/frame_pacer.h: vblank (1) and flip (2) frame events next to origin (0), each with its own offset, and a token-on-timeout wait flag (bit 2) that issues a consecutive token and returns S_FALSE when a finite origin wait times out. These values are provisional definitions of ours; the console constants are unmeasured.
  • runtime/shims/d3d12_xs_device.{h,cpp}: PresentationHandler + set_presentation_handler(device, handler) keep the device proxy free of Vulkan headers. With a handler attached, device slots 78-81 (SetFrameIntervalX, ScheduleFrameEventX, WaitFrameEventX, GetFrameStatisticsX) and the queue's PresentX go to it; the handler is called with its lock held shared, so a detach cannot destroy the presenter mid-call.
    • PresentX defaults to queue slot 30 (XCL's older layout; 32 is the newer one, LEONIDA_XS_PRESENT_X_SLOT). SuspendX/ResumeX slots are unmeasured, so they are routed only when LEONIDA_XS_SUSPEND_X_SLOT / LEONIDA_XS_RESUME_X_SLOT are set; two routes on one slot are refused with a log.
    • GetFrameStatisticsX is a route like 78-80 (LEONIDA_XS_FRAME_STATISTICS_SLOT, default 81). Without a presenter it answers S_FALSE with a zero count instead of reaching PC slot 81 (ID3D12Device13::OpenExistingHeapFromAddress1).
    • One env_slot() parser serves device and queue slots.
  • runtime/shims/xbox_present.{h,cpp}: attach_xbox_presentation / detach_xbox_presentation. Not called by gta6rt yet: the runtime creates no XboxPresentation (only d3d12_boot_movie_test and xbox_present_test do); this is the seam the presenter will use.
  • docs/d3d12_vulkan.md: documents slot 81, the queue routes and their variables.

No longer depends on #359 or #360: it merges with current main and with both on its own.

Tested

  • clang 23 / mingw x64: xs_proxy_mock_test (all checks but the pre-existing kLong allocation-injection ones, which also fail on main under mingw), --env-slots, --env-slots-invalid, frame_pacer_test; docs tests including test_docs_env_vars.

GPUs tested: n/a (CPU-only mock clock and synthetic COM proxy tests)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/402 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `feat/xs-frame-pacing-presentx` --- ### 📝 Commits (4) - [`ddafa07`](https://github.com/ubiquitarianism/leonida/commit/ddafa07b463c5405eeb1c31cf5e42dca5f8a6be0) d3d12_xs: multi-event FramePacer TOKEN_ON_TIMEOUT and XboxPresentation proxy wiring - [`7aa5d60`](https://github.com/ubiquitarianism/leonida/commit/7aa5d60ae39d565780c540335cb1f91f62321220) Merge remote-tracking branch 'ubiq/main' into feat/xs-frame-pacing-presentx - [`2a3e7a2`](https://github.com/ubiquitarianism/leonida/commit/2a3e7a23ea7f27594d12153186b8e04446a686ae) d3d12_xs: route presentation slots safely, hold the handler across calls - [`d743662`](https://github.com/ubiquitarianism/leonida/commit/d743662615cba6c69e125d6773fcc38f9856760c) docs: document the presentation slot routes and their env variables ### 📊 Changes **8 files changed** (+468 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+1 -0) 📝 `runtime/shims/d3d12_xs_device.cpp` (+146 -25) 📝 `runtime/shims/d3d12_xs_device.h` (+18 -0) 📝 `runtime/shims/xbox_present.cpp` (+36 -0) 📝 `runtime/shims/xbox_present.h` (+10 -0) 📝 `runtime/src/frame_pacer.h` (+80 -46) 📝 `runtime/test/frame_pacer_test.cpp` (+41 -0) 📝 `runtime/test/xs_proxy_mock_test.cpp` (+136 -1) </details> ### 📄 Description Claimed in the coordination issue as: `RT-XS-FRAME-PACING-PRESENTX` (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121796272) ### What and why Extends `FramePacer` and adds the seam that will connect the Xbox device/queue proxies to `XboxPresentation`: - **`runtime/src/frame_pacer.h`:** vblank (1) and flip (2) frame events next to origin (0), each with its own offset, and a token-on-timeout wait flag (bit 2) that issues a consecutive token and returns `S_FALSE` when a finite origin wait times out. These values are provisional definitions of ours; the console constants are unmeasured. - **`runtime/shims/d3d12_xs_device.{h,cpp}`:** `PresentationHandler` + `set_presentation_handler(device, handler)` keep the device proxy free of Vulkan headers. With a handler attached, device slots 78-81 (`SetFrameIntervalX`, `ScheduleFrameEventX`, `WaitFrameEventX`, `GetFrameStatisticsX`) and the queue's `PresentX` go to it; the handler is called with its lock held shared, so a detach cannot destroy the presenter mid-call. - `PresentX` defaults to queue slot 30 (XCL's older layout; 32 is the newer one, `LEONIDA_XS_PRESENT_X_SLOT`). `SuspendX`/`ResumeX` slots are unmeasured, so they are routed only when `LEONIDA_XS_SUSPEND_X_SLOT` / `LEONIDA_XS_RESUME_X_SLOT` are set; two routes on one slot are refused with a log. - `GetFrameStatisticsX` is a route like 78-80 (`LEONIDA_XS_FRAME_STATISTICS_SLOT`, default 81). Without a presenter it answers `S_FALSE` with a zero count instead of reaching PC slot 81 (`ID3D12Device13::OpenExistingHeapFromAddress1`). - One `env_slot()` parser serves device and queue slots. - **`runtime/shims/xbox_present.{h,cpp}`:** `attach_xbox_presentation` / `detach_xbox_presentation`. Not called by `gta6rt` yet: the runtime creates no `XboxPresentation` (only `d3d12_boot_movie_test` and `xbox_present_test` do); this is the seam the presenter will use. - **`docs/d3d12_vulkan.md`:** documents slot 81, the queue routes and their variables. No longer depends on #359 or #360: it merges with current `main` and with both on its own. ### Tested - clang 23 / mingw x64: `xs_proxy_mock_test` (all checks but the pre-existing `kLong` allocation-injection ones, which also fail on `main` under mingw), `--env-slots`, `--env-slots-invalid`, `frame_pacer_test`; docs tests including `test_docs_env_vars`. GPUs tested: n/a (CPU-only mock clock and synthetic COM proxy tests) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:56 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#453
No description provided.