diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 8b10e889..2dd68fad 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -260,19 +260,32 @@ namespace dxvk { uint32_t value) { this->spillRenderPass(); - if (length == buffer->info().size) - length = align(length, 4); - + length = align(length, sizeof(uint32_t)); auto slice = buffer->getSliceHandle(offset, length); if (m_barriers.isBufferDirty(slice, DxvkAccess::Write)) m_barriers.recordCommands(m_cmd); - m_cmd->cmdFillBuffer( - slice.handle, - slice.offset, - slice.length, - value); + constexpr VkDeviceSize updateThreshold = 256; + + if (length <= updateThreshold * sizeof(uint32_t)) { + std::array data; + + for (uint32_t i = 0; i < length / sizeof(uint32_t); i++) + data[i] = value; + + m_cmd->cmdUpdateBuffer( + slice.handle, + slice.offset, + slice.length, + data.data()); + } else { + m_cmd->cmdFillBuffer( + slice.handle, + slice.offset, + slice.length, + value); + } m_barriers.accessBuffer(slice, VK_PIPELINE_STAGE_TRANSFER_BIT,