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 offset,
|
||||||
VkDeviceSize length,
|
VkDeviceSize length,
|
||||||
uint32_t value) {
|
uint32_t value) {
|
||||||
this->spillRenderPass(true);
|
bool replaceBuffer = this->tryInvalidateDeviceLocalBuffer(buffer, length);
|
||||||
|
auto bufferSlice = buffer->getSliceHandle(offset, align(length, sizeof(uint32_t)));
|
||||||
length = align(length, sizeof(uint32_t));
|
|
||||||
auto slice = buffer->getSliceHandle(offset, length);
|
|
||||||
|
|
||||||
if (m_execBarriers.isBufferDirty(slice, DxvkAccess::Write))
|
if (!replaceBuffer) {
|
||||||
m_execBarriers.recordCommands(m_cmd);
|
this->spillRenderPass(true);
|
||||||
|
|
||||||
m_cmd->cmdFillBuffer(DxvkCmdBuffer::ExecBuffer,
|
if (m_execBarriers.isBufferDirty(bufferSlice, DxvkAccess::Write))
|
||||||
slice.handle, slice.offset, slice.length, value);
|
m_execBarriers.recordCommands(m_cmd);
|
||||||
|
}
|
||||||
m_execBarriers.accessBuffer(slice,
|
|
||||||
|
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_PIPELINE_STAGE_TRANSFER_BIT,
|
||||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||||
buffer->info().stages,
|
buffer->info().stages,
|
||||||
buffer->info().access);
|
buffer->info().access);
|
||||||
|
|
||||||
m_cmd->trackResource<DxvkAccess::Write>(buffer);
|
m_cmd->trackResource<DxvkAccess::Write>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user