[PR #2106] present: LEONIDA_FPS_CAP ceiling and one intro-splash decode (RT-PRES… #2111

Open
opened 2026-11-26 21:20:05 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2106
Author: @BubsMcgee
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: present-frame-pacer


📝 Commits (1)

  • 6f74724 present: LEONIDA_FPS_CAP ceiling and one intro-splash decode (RT-PRESENT-FPS-CAP)

📊 Changes

6 files changed (+199 additions, -7 deletions)

View changed files

📝 runtime/CMakeLists.txt (+7 -0)
📝 runtime/shims/dxgi_com.cpp (+6 -0)
📝 runtime/shims/package_splash.cpp (+30 -6)
📝 runtime/shims/xbox_present.cpp (+5 -1)
➕ runtime/src/fps_cap.h (+77 -0)
➕ runtime/test/fps_cap_test.cpp (+74 -0)

📄 Description

…ENT-FPS-CAP)

LEONIDA_FPS_CAP= is a present-rate ceiling on top of the title's own frame interval, so the GPU gets idle time between frames instead of being fed every frame the CPU can produce (steadier pacing, lower power). It composes with the console path's FramePacer rather than replacing it: SetFrameIntervalX lengthens a requested interval shorter than the cap, so the vblank grid, latency, tokens and statistics stay consistent. The DXGI swapchain has no such pacer, so its Present waits at the cap (sleep the bulk, spin the last millisecond; a late frame does not accumulate a debt). LEONIDA_PRESENT_UNCAP still wins on the console path.

The intro splash used to decode and Fant-scale the WIC image twice (the GDI paint from the ShowWindow hook and the D3D12 splash texture); the decoded pixels are now cached by client size, so both share one decode, and the cache is cleared when the package is configured again.

Tested: fps_cap_test 16/16 (period, interval clamp, env parsing), existing frame_pacer passes, gta6rt_d3d12_com builds. No GPU or game data needed. AI-assisted.

Claimed in the coordination issue as:

Depends on:

Fixes:

What and why

Tested

GPUs tested:

AI-assisted:

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.

🔄 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/2106 **Author:** [@BubsMcgee](https://github.com/BubsMcgee) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `present-frame-pacer` --- ### 📝 Commits (1) - [`6f74724`](https://github.com/ubiquitarianism/leonida/commit/6f7472406990e5b9bcb3c5970e7e86491a7e153a) present: LEONIDA_FPS_CAP ceiling and one intro-splash decode (RT-PRESENT-FPS-CAP) ### 📊 Changes **6 files changed** (+199 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+7 -0) 📝 `runtime/shims/dxgi_com.cpp` (+6 -0) 📝 `runtime/shims/package_splash.cpp` (+30 -6) 📝 `runtime/shims/xbox_present.cpp` (+5 -1) ➕ `runtime/src/fps_cap.h` (+77 -0) ➕ `runtime/test/fps_cap_test.cpp` (+74 -0) </details> ### 📄 Description …ENT-FPS-CAP) LEONIDA_FPS_CAP=<fps> is a present-rate ceiling on top of the title's own frame interval, so the GPU gets idle time between frames instead of being fed every frame the CPU can produce (steadier pacing, lower power). It composes with the console path's FramePacer rather than replacing it: SetFrameIntervalX lengthens a requested interval shorter than the cap, so the vblank grid, latency, tokens and statistics stay consistent. The DXGI swapchain has no such pacer, so its Present waits at the cap (sleep the bulk, spin the last millisecond; a late frame does not accumulate a debt). LEONIDA_PRESENT_UNCAP still wins on the console path. The intro splash used to decode and Fant-scale the WIC image twice (the GDI paint from the ShowWindow hook and the D3D12 splash texture); the decoded pixels are now cached by client size, so both share one decode, and the cache is cleared when the package is configured again. Tested: fps_cap_test 16/16 (period, interval clamp, env parsing), existing frame_pacer passes, gta6rt_d3d12_com builds. No GPU or game data needed. AI-assisted. Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (the coordination issue's Commands section, AGENTS.md); delete the line if it builds on none and conflicts with none --> Fixes: <!-- #N for each issue this closes (GitHub closes it on merge); delete the line if it closes none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> GPUs tested: <!-- vendor, model, driver and OS of each GPU the GPU tests ran on, or n/a --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2111
No description provided.