runtime: keep present dump capture buffer across splash handoff #1738
Closed
IlyassRS3 wants to merge 1 commit from
upstream-pr/1738 into main
pull from: upstream-pr/1738
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Reference
ProjectLeonida/mandy!1738
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1738"
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?
Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T10:28:29Z.
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.Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T10:28:45Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T10:34:33Z.
Review: COMMENTED
Independent native Windows A/B at
336e4edeagainst merge base57ba40bd. I built the same PRvk_present_dump_testharness against both runtime trees and ran it through a real Vulkan swapchain. With--splash, the base wrote the splash PNG and then exited with0xC0000005. The PR exited 0 and its PNG checks passed for all three captures, including the handoff. The standard,--default, and--invalidVulkan cases and the CPUpresent_dump_testalso passed on the PR.AI-assisted testing. Synthetic textures only on one local Windows Vulkan setup.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T10:55:55Z.
Review: APPROVED
### Clean-Room & Technical Verification
main(bcaa13dad) is 100% clean with zero merge conflicts.check_no_game_data.pyclean).VulkanPresenter::submit_now()previously unconditionally calledrelease_capture()upon the first non-black title frame whensplash_capture_only_was set, leavingcapture_ptr_ = nullptrwhilecapture_size_remained non-zero. Subsequent frame dumps dereferenced null intostd::vector, triggering an access violation inucrtbase.dll.should_release_capture_after_splash(splash_capture_only, dump_.enabled()), ensuringcapture_buffer_andcapture_ptr_remain valid across splash dismissal wheneverLEONIDA_PRESENT_DUMPis active.valid_frame_buffer().present_dump_testand Vulkan lifecycle testvk_present_dump_test --splash.LGTM! Approved.
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T18:49:00Z.
Tested on Windows with a GPU, since the PR says the Vulkan parts were not compiled or run. @kevincommits found the same crash today (item 1 of https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7225370093), and this PR already fixes it. I withdrew my claim on that item in favour of this one. Thanks @IlyassRS3.
Setup: profile M, NVIDIA GeForce RTX 4070 SUPER, 12 GB, driver 621.01, Windows 11. This branch was merged locally onto current
main(43a9d562d) with no conflicts; nothing was pushed.vk_present_dump_test --splashwithLEONIDA_VK_VALIDATION=1: passes 3/3 runs. It writespresent_000001/3/5.png, with 0 validation errors.src/present_dump.handsrc/vulkan_present.hreverted tomain: SIGSEGV on all 3 runs, right after frame 1 is dumped. So the new test reproduces the crash, and the fix removes it.ctest -R "present|splash": 13/14 pass. These includevk_present_dump,_default,_invalid,_splash,present_dump,vk_presenter_sync,vk_presenter_sparse_capture,d3d12_present,xs_present_lazyandpackage_splash. The failure isxbox_present, which also fails onmainunchanged on this machine.One small gap, which kevincommits also pointed out and which could go here or in a follow-up: in
recreate(),if (capture_ && stride != 4) return false;returns afterswapchain_/extent_/format_already describe the new swapchain, but the capture buffer still has the old extent's size.release_capture()before thatreturn falsewould leave nothing stale behind. Today the presenter stops after a failed recreate, andvalid_frame_buffer()insave()refuses a too-small buffer, so I don't see a crash from it. It would only be for consistency.The branch shows as mergeable. A merge from
mainwould refresh its CI.AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:00:07Z.
Windows 11 + MSVC
19.44+ RTX 3090 Verification — PASS (336e4edec8)Verified
336e4edec8merged ontoorigin/main(e66c65b950/16f5053047,0conflicts, plus a 5-way combined merge alongside#1146,#988,#955, and#2544) on native Windows 11 (10.0.26200.9974) with MSVC19.44.35228, NVIDIA GeForce RTX 3090, andVK_LAYER_KHRONOS_validation1.4.363.1.Checks Run
vk_present_dump_test --splashagainstorigin/mainheaders on NVIDIA GeForce RTX 3090):#1738'svk_present_dump_test.cppagainst unpatchedorigin/mainruntime/src/vulkan_present.handruntime/src/present_dump.hand ran--splash: crashed with0xc0000005(STATUS_ACCESS_VIOLATION) after dumping frame 1 (present_000001.png), when frame 3's launch-splash dismissal freedcapture_buffer_(capture_ptr_ == nullptr) whileLEONIDA_PRESENT_DUMPremained active.#1738 + origin/main):present_dump_test.exe(/W4 /WX, CPU unit suite): compiled with0warnings under/W4 /WXand passed (rc=0), verifyingshould_release_capture_after_splash, overflow-safevalid_frame_buffer,needed-bounded byte slicing, and null/short/overflow disable guards.vk_present_dump_test.exeacross all 4 CTest modes on NVIDIA GeForce RTX 3090 (LEONIDA_VK_VALIDATION=1):vk_present_dump_test(interval2):rc=0,0VUID-errors.vk_present_dump_test --default(interval60):rc=0,0VUID-errors.vk_present_dump_test --invalid(interval0):rc=0,0VUID-errors.vk_present_dump_test --splash(blue splash frame 1 -> orange handoff frame 3 -> composed orange/black frame 5):rc=0, all 3 PNGs verified pixel-for-pixel,0VUID-errors.tests/test_ctest_registration.pyandtests/test_ci_registration.pypassed (rc=0).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T09:02:59Z.
RUN #1738 | head
336e4edec8, merged cleanly with main54b2a81e95(local merge, not pushed)Commands (from the repository root, in a worktree):
Green (merged tree, GPU tests one at a time):
present_dump,vk_present_dump,vk_present_dump_default,vk_present_dump_invalid,vk_present_dump_splash(new),vk_presenter_sync,vk_presenter_sparse_capturepass.d3d12_boot_movieis skipped (reports skip).xbox_presentfails (present failed (VkResult -11), 4 of 4 runs), and it fails the same way on plain main54b2a81e9(rebuilt and run there), so it is pre-existing and not caused by this pull request.Red, three ways, each with the PR's tests kept and only the non-test source changed:
runtime/src/present_dump.handruntime/src/vulkan_present.hreverted to main:present_dump_testdoes not build (new APIshould_release_capture_after_splashmissing, build failure only), andvk_present_dump_splashbuilds and crashes (SegFault). This is the crash the pull request describes.PresentDump::save()removed (the new helpers stay):present_dumpcrashes (SegFault).vulkan_present.hreverted (PR'spresent_dump.hkept):vk_present_dump_splashfails, with the dump disabled ("buffer is missing or smaller than the frame") and the third PNG missing; the other threevk_present_dump*tests still pass.Link: no new imports vs main (gta6rt.exe, 723 DLL!symbol entries, same list as the baseline built from main).
Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:37:51Z.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed