mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Invalidate buffer in clearBuffer if possible
This commit is contained in:
parent
4c0df63e2d
commit
1b196c24a4
@ -329,23 +329,44 @@ namespace dxvk {
|
||||
VkDeviceSize offset,
|
||||
VkDeviceSize length,
|
||||
uint32_t value) {
|
||||
this->spillRenderPass(true);
|
||||
|
||||
length = align(length, sizeof(uint32_t));
|
||||
auto slice = buffer->getSliceHandle(offset, length);
|
||||
bool replaceBuffer = this->tryInvalidateDeviceLocalBuffer(buffer, length);
|
||||
auto bufferSlice = buffer->getSliceHandle(offset, align(length, sizeof(uint32_t)));
|
||||
|
||||
if (m_execBarriers.isBufferDirty(slice, DxvkAccess::Write))
|
||||
m_execBarriers.recordCommands(m_cmd);
|
||||
if (!replaceBuffer) {
|
||||
this->spillRenderPass(true);
|
||||
|
||||
m_cmd->cmdFillBuffer(DxvkCmdBuffer::ExecBuffer,
|
||||
slice.handle, slice.offset, slice.length, value);
|
||||
|
||||
m_execBarriers.accessBuffer(slice,
|
||||
if (m_execBarriers.isBufferDirty(bufferSlice, DxvkAccess::Write))
|
||||
m_execBarriers.recordCommands(m_cmd);
|
||||
}
|
||||
|
||||
DxvkCmdBuffer cmdBuffer = replaceBuffer
|
||||
? DxvkCmdBuffer::InitBuffer
|
||||
: DxvkCmdBuffer::ExecBuffer;
|
||||
|
||||
if (length > sizeof(value)) {
|
||||
m_cmd->cmdFillBuffer(cmdBuffer,
|
||||
bufferSlice.handle,
|
||||
bufferSlice.offset,
|
||||
bufferSlice.length,
|
||||
value);
|
||||
} else {
|
||||
m_cmd->cmdUpdateBuffer(cmdBuffer,
|
||||
bufferSlice.handle,
|
||||
bufferSlice.offset,
|
||||
bufferSlice.length,
|
||||
&value);
|
||||
}
|
||||
|
||||
auto& barriers = replaceBuffer
|
||||
? m_initBarriers
|
||||
: m_execBarriers;
|
||||
|
||||
barriers.accessBuffer(bufferSlice,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
buffer->info().stages,
|
||||
buffer->info().access);
|
||||
|
||||
|
||||
m_cmd->trackResource<DxvkAccess::Write>(buffer);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user