Repository navigation
d3d12: continue prepare() past KHR ARRAY_OF_POINTERS TLAS builds - #8138
Open
daviddddddw12 wants to merge 1 commit into
Open
daviddddddw12 wants to merge 1 commit into
daviddddddw12 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in: #7913 (comment)
Depends on: none
Root cause
In
leonida::prepare()(runtime/src/vulkan_replay.h), theBuildAccelerationStructurebranch returned unconditionally onvk.prepare_khr_instances(*build, p.khr_instances)when a KHR TLAS build usedD3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS(instance_pointers && instance_count):return vk.prepare_khr_instances(*build, p.khr_instances);When staging succeeded (
ReplayResult::success),prepare()returned early out of the command loop, leaving every subsequent command in the list unprepared (buffer_copiesempty,wrote_readbackunset, trailingCopyBufferfalling through tovkCmdCopyImageToBuffer(VK_NULL_HANDLE)inemit()with Vulkan validation errors and an access violation) and skipping all post-loop query validation and segment planning (plan_statistics_segments,plan_occlusion_segments).Fix
Only return early from
prepare()whenvk.prepare_khr_instances(...) != ReplayResult::success, so validARRAY_OF_POINTERSTLAS builds continue preparing the rest of the command list and running post-loop checks.Verification (red before / green after)
Tested on Windows 11 Pro (build 26300), MSVC 19.44.35230.0, Vulkan SDK 1.4.363.0, AMD Radeon RX 6700 XT (driver
32.0.21045.29003), no game files.Red on unpatched
origin/main(dde82f27e):replay_khr_tlas_pointers_test.exefailed (RED_CPU_EXIT=1) on all post-TLAS command-preparation, emission, error-propagation, and occlusion-segment planning checks.LEONIDA_RT_AS=khr LEONIDA_VK_VALIDATION=1 d3d12_indirect_rt_test.execrashed (0xC0000005/-1073741819) after Vulkan validation errors (vkCmdCopyImageToBuffer(): srcImage is VK_NULL_HANDLE,dstBuffer is VK_NULL_HANDLE,regionCount must be greater than 0) on theCopyBufferRegionfollowingBuildRaytracingAccelerationStructure(&tlas_ptr_build).Green after fix:
replay_khr_tlas_pointers_test.exe:PASS(replay_khr_tlas_pointers: prepare/emit and query checks continue past KHR ARRAY_OF_POINTERS TLAS)LEONIDA_RT_AS=khr LEONIDA_VK_VALIDATION=1 d3d12_indirect_rt_test.exe:PASS (0 validation errors)onAMD Radeon RX 6700 XT(including[PASS] CopyBufferRegion after ARRAY_OF_POINTERS TLAS build ran (0xcafebabe))LEONIDA_RT_ASunset) +LEONIDA_VK_VALIDATION=1 d3d12_indirect_rt_test.exe:PASS (0 validation errors)onAMD Radeon RX 6700 XTctest --test-dir runtime/build -R ^replay_|^d3d12_indirect_rt|^vk_command_replay --output-on-failure:12/12passed (100% tests passed out of 12)python -I scripts/check_no_game_data.py runtime/src/vulkan_replay.h runtime/CMakeLists.txt runtime/test/replay_khr_tlas_pointers_test.cpp runtime/test/d3d12_indirect_rt_test.cpp:PASSAI-assisted (Antigravity / Gemini 4).