mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #1694] vulkan_present: the capture buffer is made of host-cached memory (RT-PRESENT-CAPTURE-CACHED) #1708
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1708
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1694
Author: @DadaCap
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:present-capture-cached📝 Commits (1)
3768be5vulkan_present: the capture buffer is made of host-cached memory (RT-PRESENT-CAPTURE-CACHED)📊 Changes
1 file changed (+11 additions, -4 deletions)
View changed files
📝
runtime/src/vulkan_present.h(+11 -4)📄 Description
Claimed in the coordination issue as: RT-PRESENT-CAPTURE-CACHED (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7157004451)
What and why
VulkanPresenter::make_capture_buffertook the first memory type that is host visible and coherent. On NVIDIA the first such type is uncached (flags0x6on this RTX 5080; the cached one,0xe, comes after it), and a host read of uncached memory is many times slower than of cached memory.That did not matter much while the buffer was read once per capture. Since the launch splash (#939),
finish_startup_framereads the whole buffer on the CPU for every frame the title presents before its first non-black one, with the submit and tracker locks held. On a large window that scan takes over the boot:LEONIDA_STACKSdumps 20 s apart:submit_now->present->PresentX);device-stall: could not sample the submit lock for 15 s; submitted ticket 424, last observed retired ticket 328;The change: choose a host-cached, non-device-local type first and fall back to the first host-visible coherent one, exactly as
probe_read_sourcein the same file already does. One function, 11 lines.Measured
Native Windows 11, RTX 5080 16 GB, NVIDIA 621.24, 64 GB, own 1.0.2.1, MSVC RelWithDebInfo with SDL3. Window client area 3824x1841 when the first frame is presented. Every run: keyboard pad with A every 5 s from 30 s,
LEONIDA_SKIP_INT3=1,LEONIDA_PEEK=0x7446510,0x98f828c, an existing save, shaders frommain's translator.d)main3f81d46acLEONIDA_TITLE_WINDOWS_MB=4096 LEONIDA_ARENA_MB=4096 LEONIDA_DEVICE_FAULT=1main+ #1558 + #1631LEONIDA_ARENA_MB=2048main+ #1558 + #1631,LEONIDA_WINDOW=960x540(no code change, 14 times fewer texels to scan)LEONIDA_ARENA_MB=2048main+ #1558 + #1631 + this changeLEONIDA_ARENA_MB=2048main+ this change only (this branch)So on this machine the first and last rows differ only by this commit. Before #939 (
main3ff2a2adc) the same launcher passed the landing screen every time, which is how I found it.It probably costs time on smaller windows too, in proportion to the texel count: the report on #939 of 182 to 362 PresentX in 51 to 74 s on an RTX 4070 SUPER is a few presents a second. I have not measured another machine.
Tested
runtime/pass on this branch on the same GPU:xbox_present_readback_size,vk_presenter_capture_colour,present_window,xs_present_lazy,vk_present_dump,vk_present_dump_default,vk_present_dump_invalid,vk_presenter_sync,d3d12_present,xbox_present.Not done, not tested
Counters, switch names and addresses of the executable only; no game data. AI-assisted (Claude Code).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.