mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:50:51 +01:00
[PR #1738] runtime: keep present dump capture buffer across splash handoff #1752
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#1752
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/1738
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/present-dump-splash-handoff📝 Commits (1)
336e4edruntime: keep present dump capture buffer across splash handoff📊 Changes
5 files changed (+275 additions, -19 deletions)
View changed files
📝
runtime/CMakeLists.txt(+13 -1)📝
runtime/src/present_dump.h(+22 -1)📝
runtime/src/vulkan_present.h(+21 -3)➕
runtime/test/present_dump_test.cpp(+172 -0)📝
runtime/test/vk_present_dump_test.cpp(+47 -14)📄 Description
Item ID:
RT-PRESENT-DUMP-SPLASH-HANDOFFClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7159613942
Addresses finding: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7157589788 (
LEONIDA_PRESENT_DUMPaccess violation inucrtbase.dllwhen the splash hands off to the first title frame)Root cause
VulkanPresenter::present_splash()(runtime/src/vulkan_present_splash.h:16) setssplash_capture_only_ = enable_capture()whencapture_was false. On the first non-black title frame (show_title == true),VulkanPresenter::submit_now()(runtime/src/vulkan_present.h:648-655) unconditionally calledrelease_capture()whiledump_.enabled()was still true, settingcapture_ptr_ = nullptrwhile leavingcapture_size_non-zero.On the next
dump_.due(shown - 1)frame (including the handoff frame itself if it falls on the interval, or the first post-handoff interval frame such as frame 150 at,30or 300 at,150),dump_.save(..., capture_ptr_, size_t(capture_size_))passed(nullptr, nullptr + capture_size_)tostd::vector<std::uint8_t>, crashing with an access violation reading address0insideucrtbase.dll(memcpy).In addition, when
!dump_.enabled(),release_capture()ran afterfinish_startup_frame()had waited only on the current ring slot'sframe.donefence, without waiting on the other in-flight slot inframes_.Changes
runtime/src/present_dump.h:should_release_capture_after_splash(bool splash_capture_only, bool dump_enabled)(splash_capture_only && !dump_enabled).valid_frame_buffer(extent, format, src, size, &needed).PresentDump::save()to validate viavalid_frame_buffer()before copyingsrc .. src + needed, disabling cleanly instead of dereferencing null or reading pastsize.runtime/src/vulkan_present.h:capture_buffer_/capture_ptr_alive across splash handoff whendump_.enabled()is true (still clearingsplash_capture_only_andcapture_so only due dump frames copy viafinish_image()).!dump_.enabled()), wait on allframes_fences before callingrelease_capture().capture_size_ = 0inrelease_capture()and onvkCreateBufferfailure, and guard!capture_ptr_ || !capture_size_beforedump_.save().runtime/test/present_dump_test.cpp&runtime/CMakeLists.txt:present_dump_testcoveringshould_release_capture_after_splash,valid_frame_bufferedge/overflow cases, andPresentDump::save()valid PNG + null/truncated/overflow/invalid-format guards.runtime/test/vk_present_dump_test.cpp&runtime/CMakeLists.txt:--splashmode (vk_present_dump_splash) exercisingpresent_splash()->present_blank()-> non-black title handoffpresent()on a due frame ->present_blank()->present_planes(), checkingvalidation_errors() == 0and all 3 PNG outputs.Verification
runtime/test/present_dump_test.cppwithclang++ -std=c++20 -Wall -Wextra -Werror -O1 -g -fsanitize=address,undefinedagainst a temporary localVkFormat/VkExtent2Dstub (not committed): PASS.main:runtime/src/present_dump.hpassing(nullptr, 16)toPresentDump::save(): reproduced UBSan null-pointer arithmetic + ASan SEGV reading0x0(exit 134).python3 -I scripts/check_no_game_data.py runtime/src/present_dump.h runtime/src/vulkan_present.h runtime/test/present_dump_test.cpp runtime/test/vk_present_dump_test.cpp runtime/CMakeLists.txt: PASS.python3 -I tests/test_text_write_line_endings.py: 3/3 OK.runtime/src/vulkan_present.handruntime/test/vk_present_dump_test.cpp(vk_present_dump_splash) are Win32/Vulkan and were not compiled or executed on macOS; they require Windows CI / a Vulkan GPU run.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.