mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #615] [MERGED] runtime: flush COMPUTE_SHADER_BIT to HOST on XDXR postbuild readbacks (VK-XDXR-POSTBUILD-READBACK-STAGE) #656
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#656
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/615
Author: @tahffo68hk-hash
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/vk-xdxr-postbuild-readback-stage📝 Commits (1)
dfadf4cruntime: flush COMPUTE_SHADER_BIT to HOST on XDXR postbuild readbacks (VK-XDXR-POSTBUILD-READBACK-STAGE)📊 Changes
4 files changed (+247 additions, -1 deletions)
View changed files
📝
runtime/CMakeLists.txt(+10 -0)📝
runtime/src/vulkan_replay.h(+5 -0)📝
runtime/test/replay_readback_stages_test.cpp(+55 -1)➕
runtime/test/vk_xdxr_postbuild_readback_test.cpp(+177 -0)📄 Description
Summary
In \prepare()\ (
untime/src/vulkan_replay.h), the KHR \AccelerationStructurePostbuild\ path marks \out.wrote_readback = true\ and \out.readback_src_stages |= VK_PIPELINE_STAGE_2_TRANSFER_BIT\ so \VulkanQueue::execute_now()\ emits a host-visibility barrier when \dest_va\ targets a host-readable readback buffer.
However, the XDXR \AccelerationStructurePostbuild\ path — where \XdxrBuilder::record_postbuild()\ dispatches a compute shader writing compacted/current acceleration-structure sizes to \dest_va\ — omitted setting \out.wrote_readback = true\ and \out.readback_src_stages |= VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT. As a result, a submission ending with XDXR \EmitRaytracingAccelerationStructurePostbuildInfo\ into a \READBACK\ buffer emitted no \COMPUTE_SHADER_BIT -> HOST_BIT\ flush barrier.
Fix
untime/src/vulkan_replay.h\ (\prepare()), set \out.wrote_readback = true\ and \out.readback_src_stages |= VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT\ on the XDXR \AccelerationStructurePostbuild\ path when !info->sources.empty().
Verification
eplay_readback_stages_test):
eplay_readback_stages: depth24, rgb96, copy, UAV-clear and XDXR postbuild readback stages exact)
Claimed on #14. (AI-assisted)
中文翻译
摘要
在
untime/src/vulkan_replay.h\ 的 \prepare()\ 中,KHR \AccelerationStructurePostbuild\ 路径会设置 \out.wrote_readback = true\ 和 \out.readback_src_stages |= VK_PIPELINE_STAGE_2_TRANSFER_BIT\,使 \VulkanQueue::execute_now()\ 在 \dest_va\ 指向主机可读回读缓冲区时发出主机可见性屏障。
但 XDXR \AccelerationStructurePostbuild\ 路径(通过计算着色器将压缩/当前加速结构大小写入 \dest_va\)漏掉了 \out.wrote_readback = true\ 和 \out.readback_src_stages |= VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT\,导致仅含 XDXR postbuild 写入 \READBACK\ 缓冲区的提交缺失 \COMPUTE_SHADER_BIT -> HOST_BIT\ 刷新屏障。
修复
untime/src/vulkan_replay.h\ 的 XDXR \AccelerationStructurePostbuild\ 路径中(!info->sources.empty()\ 时),设置 \out.wrote_readback = true\ 与 \out.readback_src_stages |= VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT\。
验证
eplay_readback_stages_test\):修复前失败,修复后通过。
已在 #14 认领。(AI 辅助)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.