mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[dxvk] Use out-of-order transfer helper in copyBuffer
This commit is contained in:
parent
c02b5ed10b
commit
cf2c81f5ef
@ -388,25 +388,20 @@ namespace dxvk {
|
|||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const Rc<DxvkBuffer>& srcBuffer,
|
||||||
VkDeviceSize srcOffset,
|
VkDeviceSize srcOffset,
|
||||||
VkDeviceSize numBytes) {
|
VkDeviceSize numBytes) {
|
||||||
// When overwriting small buffers, we can allocate a new slice in order to
|
DxvkCmdBuffer cmdBuffer = DxvkCmdBuffer::InitBuffer;
|
||||||
// avoid suspending the current render pass or inserting barriers. The source
|
|
||||||
// buffer must be read-only since otherwise we cannot schedule the copy early.
|
|
||||||
bool srcIsReadOnly = !(srcBuffer->info().access & vk::AccessWriteMask);
|
|
||||||
bool replaceBuffer = srcIsReadOnly && this->tryInvalidateDeviceLocalBuffer(dstBuffer, numBytes);
|
|
||||||
|
|
||||||
auto srcSlice = srcBuffer->getSliceHandle(srcOffset, numBytes);
|
if (!prepareOutOfOrderTransfer(srcBuffer, srcOffset, numBytes, DxvkAccess::Read)
|
||||||
auto dstSlice = dstBuffer->getSliceHandle(dstOffset, numBytes);
|
|| !prepareOutOfOrderTransfer(dstBuffer, dstOffset, numBytes, DxvkAccess::Write)) {
|
||||||
|
|
||||||
if (!replaceBuffer) {
|
|
||||||
this->spillRenderPass(true);
|
this->spillRenderPass(true);
|
||||||
|
|
||||||
flushPendingAccesses(*srcBuffer, srcOffset, numBytes, DxvkAccess::Read);
|
flushPendingAccesses(*srcBuffer, srcOffset, numBytes, DxvkAccess::Read);
|
||||||
flushPendingAccesses(*dstBuffer, dstOffset, numBytes, DxvkAccess::Write);
|
flushPendingAccesses(*dstBuffer, dstOffset, numBytes, DxvkAccess::Write);
|
||||||
|
|
||||||
|
cmdBuffer = DxvkCmdBuffer::ExecBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
DxvkCmdBuffer cmdBuffer = replaceBuffer
|
auto srcSlice = srcBuffer->getSliceHandle(srcOffset, numBytes);
|
||||||
? DxvkCmdBuffer::InitBuffer
|
auto dstSlice = dstBuffer->getSliceHandle(dstOffset, numBytes);
|
||||||
: DxvkCmdBuffer::ExecBuffer;
|
|
||||||
|
|
||||||
VkBufferCopy2 copyRegion = { VK_STRUCTURE_TYPE_BUFFER_COPY_2 };
|
VkBufferCopy2 copyRegion = { VK_STRUCTURE_TYPE_BUFFER_COPY_2 };
|
||||||
copyRegion.srcOffset = srcSlice.offset;
|
copyRegion.srcOffset = srcSlice.offset;
|
||||||
|
Loading…
Reference in New Issue
Block a user