Repository navigation
d3d12_xs: add multi-event FramePacer TOKEN_ON_TIMEOUT and wire XboxPresentation to device/queue slots (RT-XS-FRAME-PACING-PRESENTX) - #402
Merged
Conversation
…n proxy wiring
- Support origin (0), vblank (1), and flip (2) frame events and
frame_wait_flag_token_on_timeout (flag 2, returning S_FALSE with a
fresh consecutive token on timeout) in runtime/src/frame_pacer.h.
- Add a decoupled PresentationHandler interface to d3d12_xs_device.{h,cpp}
routing device slots 78-81 and queue PresentX/SuspendX/ResumeX slots
(default 30/31/32, env-overridable via LEONIDA_XS_*_SLOT).
- Add attach_xbox_presentation / detach_xbox_presentation in
runtime/shims/xbox_present.{h,cpp}.
…esentx # Conflicts: # runtime/test/xs_proxy_mock_test.cpp
- Queue routes: PresentX defaults to slot 30 (XCL's older layout; 32 is the newer one, set with LEONIDA_XS_PRESENT_X_SLOT). SuspendX/ResumeX slots are unmeasured, so they are routed only when their variables are set; two routes on one slot are refused with a log instead of shadowing each other. - One env_slot() parser for device and queue slots (no duplicated copy). - 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). - The presentation handler is called with its lock held shared, so a detach cannot destroy the presenter under an in-flight call. - frame_pacer.h: the new event/flag constants are marked provisional again. - xbox_present.h: attach_xbox_presentation is documented as the seam the presenter will use; gta6rt does not create an XboxPresentation yet. AI-assisted. Tested with 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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LEONIDA_XS_FRAME_STATISTICS_SLOT, LEONIDA_XS_PRESENT_X_SLOT, LEONIDA_XS_SUSPEND_X_SLOT and LEONIDA_XS_RESUME_X_SLOT were read by the code and named in no document (tests/test_docs_env_vars.py failed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
3 of 4 tasks
This was referenced Nov 24, 2026
3 of 4 tasks
This was referenced Nov 24, 2026
demoz53
added a commit
to demoz53/leonida
that referenced
this pull request
Nov 24, 2026
Brings 58 PRs integration did not have (among them ProjectLeonida#359 ProjectLeonida#360 ProjectLeonida#402 ProjectLeonida#497 ProjectLeonida#557 ProjectLeonida#558 ProjectLeonida#560 ProjectLeonida#561 ProjectLeonida#572 ProjectLeonida#573 ProjectLeonida#574 ProjectLeonida#577) and the newer heads of ProjectLeonida#401 and ProjectLeonida#404. 15 files conflicted; resolved by hand: - frame_pacer.h, d3d12_xs_device.h/.cpp: ProjectLeonida#402's pacer (per-event ticks, issue_token_locked) now issues from ProjectLeonida#414's shared FrameTokenSource, so a token from the device-side WaitFrameEventX is one the pacer accepts (towade's ProjectLeonida#14 finding: without it every PresentX is refused). The dead frame_next_token and issued_ counters are dropped. Queue slot 32 stays ProjectLeonida#414's PresentX; ProjectLeonida#402's presentation-handler routes serve slot 30 or LEONIDA_XS_PRESENT_X_SLOT. ProjectLeonida#402's GetFrameStatisticsX route moves into ProjectLeonida#385's route_xbox_device_slot. - acphal.cpp/acphal_test.cpp: upstream's reworked SHAPE allocation and release; the release writes nothing through its first argument, as ProjectLeonida#405 requires; both sides' tests kept. Upstream's ProjectLeonida#401/ProjectLeonida#404 heads remove lifecycle.cpp and the C++ xma2_decoder.cpp (replaced by runtime/xma_decoder), so build_runtime.ps1's cl.exe list drops them and keeps ProjectLeonida#549's and ProjectLeonida#400's files. - vulkan_backend.h, statistics_sum.comp, its SPIR-V header, d3d12_mesh_test, replay_query_edges_test, d3d12_vulkan_device.cpp, docs: ProjectLeonida#577's clipping counter on top of ProjectLeonida#540, which both sides carry; the Timestamps sentence keeps integration's corrected wording (c33ce87). - xs_proxy_mock_test.cpp: both sides' cases; pr_conflict_label.py keeps the guarded reconfigure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
demoz53
added a commit
to demoz53/leonida
that referenced
this pull request
Nov 24, 2026
…32 is ProjectLeonida#414's PresentX ProjectLeonida#402 (from the upstream fold) checks that SuspendX/ResumeX without a route never reach the attached presenter, using queue slot 32 as the unrouted example. On integration, ProjectLeonida#414 serves queue slot 32 as the retail title's measured PresentX, so those two checks (xs_proxy_mock line 2772 and --env-slots line 1591) saw S_OK. towade predicted this pair on ProjectLeonida#14. The checks now use slot 34, unrouted on integration (31 stays refused, 33 is the env mode's SuspendX); slot 32 is not called in the mock, whose PresentX would build a window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as:
RT-XS-FRAME-PACING-PRESENTX(#14 (comment))What and why
Extends
FramePacerand adds the seam that will connect the Xbox device/queue proxies toXboxPresentation: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 returnsS_FALSEwhen 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'sPresentXgo to it; the handler is called with its lock held shared, so a detach cannot destroy the presenter mid-call.PresentXdefaults to queue slot 30 (XCL's older layout; 32 is the newer one,LEONIDA_XS_PRESENT_X_SLOT).SuspendX/ResumeXslots are unmeasured, so they are routed only whenLEONIDA_XS_SUSPEND_X_SLOT/LEONIDA_XS_RESUME_X_SLOTare set; two routes on one slot are refused with a log.GetFrameStatisticsXis a route like 78-80 (LEONIDA_XS_FRAME_STATISTICS_SLOT, default 81). Without a presenter it answersS_FALSEwith a zero count instead of reaching PC slot 81 (ID3D12Device13::OpenExistingHeapFromAddress1).env_slot()parser serves device and queue slots.runtime/shims/xbox_present.{h,cpp}:attach_xbox_presentation/detach_xbox_presentation. Not called bygta6rtyet: the runtime creates noXboxPresentation(onlyd3d12_boot_movie_testandxbox_present_testdo); 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
mainand with both on its own.Tested
xs_proxy_mock_test(all checks but the pre-existingkLongallocation-injection ones, which also fail onmainunder mingw),--env-slots,--env-slots-invalid,frame_pacer_test; docs tests includingtest_docs_env_vars.GPUs tested: n/a (CPU-only mock clock and synthetic COM proxy tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)🤖 Generated with Claude Code