mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #599] vulkan_replay: do not return early from prepare() on KHR TLAS ARRAY_OF_POINTERS (VK-KHR-TLAS-PREPARE-EARLY-RETURN) #641
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#641
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/599
Author: @tahffo68hk-hash
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/vk-khr-tlas-prepare-early-return📝 Commits (1)
f5f73d9vulkan_replay: do not return early from prepare() on KHR TLAS ARRAY_OF_POINTERS (VK-KHR-TLAS-PREPARE-EARLY-RETURN)📊 Changes
3 files changed (+174 additions, -1 deletions)
View changed files
📝
runtime/CMakeLists.txt(+15 -0)📝
runtime/src/vulkan_replay.h(+2 -1)➕
runtime/test/vk_khr_tlas_prepare_test.cpp(+157 -0)📄 Description
Summary
In
prepare()(runtime/src/vulkan_replay.h), theBuildAccelerationStructurebranch for KHR TLASARRAY_OF_POINTERSbuilds ended with an unconditionalreturn:When
vk.prepare_khr_instances()succeeded (ReplayResult::success),prepare()immediately returned out of the command loop, completely abandoning every subsequent command in the sameCommandList:PreparedLists, or left with stalePreparedentries from previous executions on reusedVulkanQueue::prepared_storage).out.wrote_readback,out.readback_src_stages,plan_statistics_segments(), andplan_occlusion_segments()at the end ofprepare()were all skipped.Fix
vk.prepare_khr_instances()fails:if (const auto r = vk.prepare_khr_instances(*build, p.khr_instances); r != ReplayResult::success) return r;runtime/test/vk_khr_tlas_prepare_test.cpp(registered asvk_khr_tlas_prepareinruntime/CMakeLists.txt) that records a KHR TLASARRAY_OF_POINTERSbuild followed by:CopyBufferRegioninto a host-readable buffer, verifying real GPU execution and exact host readback.CopyBufferRegion, verifyingprepare()still rejects it withReplayResult::invalid_copy.Verification (Real Dual-GPU Hardware)
FAIL runtime/test/vk_khr_tlas_prepare_test.cpp:144: std::memcmp(dst_ptr, expected, sizeof(expected)) == 0(trailing GPU copy silently dropped; readback buffer remained poisoned0x5A).vk_khr_tlas_prepare_test: PASS (trailing GPU copy readback + validation verified)vk_khr_tlas_prepare_test: PASS (trailing GPU copy readback + validation verified)Coordination
VK-KHR-TLAS-PREPARE-EARLY-RETURN(no overlapping open PRs or claims).中文翻译
摘要
runtime/src/vulkan_replay.h中prepare()在处理 KHR TLASARRAY_OF_POINTERS构建时直接执行了return vk.prepare_khr_instances(*build, p.khr_instances);。当 staging 成功返回ReplayResult::success时,prepare()会直接跳出整个命令循环,导致同一命令列表中位于该 TLAS 构建之后的所有命令全部被跳过:VulkanQueue::prepared_时还会残留上一帧的旧数据);plan_statistics_segments()与plan_occlusion_segments()被完全跳过。修复
vk.prepare_khr_instances()返回非ReplayResult::success时提前返回。runtime/test/vk_khr_tlas_prepare_test.cpp(CMake 注册名vk_khr_tlas_prepare),验证 KHR TLASARRAY_OF_POINTERS之后的真实 GPU 拷贝读回与越界拷贝校验。真实双卡 GPU 验证
0x5A,测试失败。PASS (trailing GPU copy readback + validation verified)。PASS (trailing GPU copy readback + validation verified)。协同
VK-KHR-TLAS-PREPARE-EARLY-RETURN。🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.