mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #418] [MERGED] vulkan_replay: validate backing buffer_offset alignment in buffer UAV clear (VK-UAV-CLEAR-ALIGN) #469
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#469
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/418
Author: @tahffo68hk-hash
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/vk-uav-clear-align📝 Commits (1)
c9099b0vulkan_replay: validate backing buffer_offset alignment in prepare_buffer_uav_clear (VK-UAV-CLEAR-ALIGN)📊 Changes
2 files changed (+13 additions, -0 deletions)
View changed files
📝
runtime/src/vulkan_replay.h(+1 -0)📝
runtime/test/replay_uav_clear_offset_test.cpp(+12 -0)📄 Description
Claimed in the coordination issue as:
VK-UAV-CLEAR-ALIGNProblem
prepare_buffer_uav_clear()inruntime/src/vulkan_replay.hcheckedoffset % std::min(e, 4u)before addingp.binding.buffer_offset. When a sub-allocated buffer has a misalignedbuffer_offset:e > 4, e.g.,R32G32B32A32_UINT),emit_buffer_fill()calledvkCmdUpdateBufferwithdstOffset % 4 != 0, violatingVUID-vkCmdUpdateBuffer-dstOffset-00032.e == 2ore == 4),emit_buffer_fill()filled 4-byte-aligned words with an unrotated pattern, byte-swapping/rotating every cleared element.(Compare
prepare_texture_copy(), which explicitly checksbacking_offset % alignmentafter addingbuffer.buffer_offset.)Fix
prepare_buffer_uav_clear(), checkif (offset % std::min(e, 4u)) return ReplayResult::unsupported;after addingp.binding.buffer_offset, while still allowing oddbuffer_offsetfor 1-byte (R8_*) elements.runtime/test/replay_uav_clear_offset_test.cppcovering misalignedbuffer_offsetfor 16-byte, 4-byte, 2-byte, and 1-byte UAV clears.Verification
-DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF) on Windows 11.ctest -R "^replay_uav_clear_offset$" --output-on-failure-> 1/1 PASS (no game files).中文翻译
在协调帖 #14 中认领的 ID:
VK-UAV-CLEAR-ALIGN问题描述
runtime/src/vulkan_replay.h的prepare_buffer_uav_clear()仅在叠加p.binding.buffer_offset之前检查offset % std::min(e, 4u)。当子分配缓冲区的buffer_offset未对齐时:e > 4)会以未 4 字节对齐的dstOffset调用vkCmdUpdateBuffer,违反VUID-vkCmdUpdateBuffer-dstOffset-00032;修复方案
p.binding.buffer_offset后检查offset % std::min(e, 4u),未对齐时返回ReplayResult::unsupported(同时保留 1 字节R8_*元素的合法性)。runtime/test/replay_uav_clear_offset_test.cpp中补充 16/4/2/1 字节元素的回归测试。验证结果
ctest -R "^replay_uav_clear_offset$"(无游戏文件)。🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.