1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-28 02:19:26 +01:00

[dxvk] Clear entire allocated memory region when initializing buffers

This commit is contained in:
Philip Rebohle 2025-03-23 16:54:52 +01:00 committed by Philip Rebohle
parent f17188395b
commit f7ae4549d4

View File

@ -1034,6 +1034,16 @@ namespace dxvk {
const Rc<DxvkBuffer>& buffer) {
auto dstSlice = buffer->getSliceHandle();
// If the buffer is suballocated, clear the entire allocated
// region, which is guaranteed to have a nicely aligned size
if (!buffer->storage()->flags().test(DxvkAllocationFlag::OwnsBuffer)) {
auto bufferInfo = buffer->storage()->getBufferInfo();
dstSlice.handle = bufferInfo.buffer;
dstSlice.offset = bufferInfo.offset;
dstSlice.length = bufferInfo.size;
}
// Buffer size may be misaligned, in which case we have
// to use a plain buffer copy to fill the last few bytes.
constexpr VkDeviceSize MinCopyAndFillSize = 1u << 20;