The queue proxy's PresentX slot is past the PC chain, so nothing recorded
a present: a --trace-d3d12 run of a frame loop could not say how many
frames were presented, or whether one was refused. XboxPresentation::PresentX
now writes one line per call through d3d12_trace::result (ok or failed).
xbox_present_test captures the trace around a blank present and a refused
three-plane call and checks for exactly those two lines.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Any non-empty value other than "0" lifts the frame-event cap: a
WaitFrameEventX hands its token out at once (no vblank grid, no latency
throttle) and PresentX presents unsynced, so the frame rate is whatever
the title renders. Registration and suspension keep their errors, an
uncapped frame's statistics report its present time, and the flag
survives suspend/resume. frame_pacer_test covers the grid's removal and
restoration.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Tone map: identity up to 0.8 of SDR white, extended Reinhard shoulder above it, continuous in value and slope, content
peak maps to 1.0 (SDR-range content is no longer darkened).
- The Windows SDR white level is read by a background thread (about once a second, only while HDR10 is in use);
PresentX reads an atomic. A failed query keeps the last good value; QueryDisplayConfig retries on
ERROR_INSUFFICIENT_BUFFER.
- LEONIDA_SDR_EOTF is case-insensitive, unknown or too long values are logged; setters are atomics; <cwchar> for wcscmp.
- Tests: eight-step HDR10 ramp with hand-calculated bytes, curve properties (monotonic, identity below the knee, peak 1,
slope continuity), HDR10 plane 1 over SDR plane 0 on HDR10 and SDR outputs, hand-calculated 50% overlay bytes, query cost.
- Docs 4.5: shoulder description, query cost, sources marked (KWin claim unverified, vkd3d-proton file partly read, the
measured 80 nits only covers the SDR fallback path).
- present_compose.inc rebuilt with glslc 2026.4 (reproducible, spirv-val clean).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Compose pass decodes every texel to linear (premultiplied) before filtering, converts the plane to the output's linear
working space (Rec.2020 nits for HDR10, Rec.709 relative to SDR white for SDR), blends there and encodes once.
- SDR EOTF is piecewise sRGB by default (community-sourced Windows behaviour), gamma 2.2 by
XboxPresentation::set_sdr_eotf or LEONIDA_SDR_EOTF=gamma22.
- SDR white: set_sdr_white_nits override, else DISPLAYCONFIG_SDR_WHITE_LEVEL of the window's output while HDR10 is
active, else 203 nits (BT.2408).
- HDR10 on an SDR output: extended Reinhard on luminance (white point at the content peak, default 1000 nits) instead of a
hard clip.
- HDR metadata stays unsent; docs section 4.5 documents the decisions and cites the sources.
- CPU reference model and xbox_present_test updated (linear model, EOTF option, 50% overlay, tone map, white level query).
- present_compose.inc rebuilt with glslc 2026.4 (byte-reproducible, spirv-val clean).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Re-prepare the compose target after the acquire/out-of-date retry and check the extent in
record_planes; xbox_present_test resizes the window between composed presents.
- XboxPresentPlaneParameters follows the public field order exactly (adds ExtendedDescCount,
pExtendedDescs); implausible placement / unknown filter / extended descs are ignored and
logged once, not refused.
- Plane 1 is composed only with our overlay flag (SDR/SDR no longer blends by default).
- present_planes rejects a non-positive or NaN SDR white level.
- ResourceCount != 1 is refused with DXGI_ERROR_UNSUPPORTED before either path (found by Flyander).
- Docs: PQ-space filtering, HDR10 swapchain verified on RTX 5080 by JavierBlanco23.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plain single plane keeps the old blit. A plane with pDestPlacementBase, a point/linear
ScaleFilter, the HDR10 colour space, or a second overlay plane goes through
VulkanPresenter::present_planes: a compute pass (present_compose.comp, SPIR-V embedded)
into an RGBA16F image that is copied to the swapchain. HDR10 uses an ST.2084 swapchain
when the surface lists one, else is clipped to SDR. An SDR plane 1 next to an HDR10 plane 0
is the GameDVR copy (public HDR sample) unless flagged an overlay. The layouts, flag values
and alpha convention are ours; xbox_present_test checks every case against a CPU model.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- find_tear_mode rejects a mode whose surface caps lack the swapchain's image usage or extent.
- present_timing: a repeated or stale token is never late.
- percent_scanned is measured at commit, so it agrees with the display time.
- The "no effect" log distinguishes the kill switch from a missing extension or mode.
- LEONIDA_PRESENT_NO_TEAR is read with _dupenv_s: any non-empty value but "0" disables.
- xbox_present_test: the real-time comment is back where it belongs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A frame presented after the vblank it was due at is flipped at once (IMMEDIATE, else
FIFO_RELAXED) when the scan would be within the threshold percentage of the screen,
instead of waiting a whole interval. The decision is the pure
leonida::decide_present_sync(late_us, interval_us, threshold); FramePacer reports the
lateness against the vblank after the token's origin and records the tear in
GetFrameStatisticsX (PercentScanned) and immediate_presents().
VulkanPresenter creates a vsync swapchain with FIFO plus the tear mode when the surface
lists it as compatible (VkSurfacePresentModeCompatibilityKHR) and chains
VkSwapchainPresentModeInfoKHR on a tearing present. The device enables the KHR (else EXT)
extension, its feature and the matching instance extensions only where present; without
them the threshold is ignored and logged once, as before. LEONIDA_PRESENT_NO_TEAR=1 turns
it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xbox_present_test presents with null, repeated and stale tokens (the present
happens) and refuses never-issued ones, and presents MSAA, integer and BC sources.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Provisional struct layouts and constants of ours; real slots unmeasured (TODO
table in the header). The test reads the swapchain image back on a Vulkan
device and runs the frame events on a fake clock, then 30 frames in real time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>