diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 5a2b62bdb..3e10d1169 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -4560,14 +4560,8 @@ namespace dxvk { case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: if (slot.bufferSlice.defined() && slot.bufferSlice.bufferInfo().usage & storageBufferUsage) { - srcAccess = m_gfxBarriers.getBufferAccess( - slot.bufferSlice.getSliceHandle()); - - m_gfxBarriers.accessBuffer( - slot.bufferSlice.getSliceHandle(), - binding.stages, binding.access, - slot.bufferSlice.bufferInfo().stages, - slot.bufferSlice.bufferInfo().access); + srcAccess = this->checkGfxBufferBarrier(slot.bufferSlice, + binding.stages, binding.access); } break; @@ -4579,14 +4573,8 @@ namespace dxvk { case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: if (slot.bufferView != nullptr && slot.bufferView->bufferInfo().usage & storageBufferUsage) { - srcAccess = m_gfxBarriers.getBufferAccess( - slot.bufferView->getSliceHandle()); - - m_gfxBarriers.accessBuffer( - slot.bufferView->getSliceHandle(), - binding.stages, binding.access, - slot.bufferView->bufferInfo().stages, - slot.bufferView->bufferInfo().access); + srcAccess = this->checkGfxBufferBarrier(slot.bufferView->slice(), + binding.stages, binding.access); } break; @@ -4638,6 +4626,22 @@ namespace dxvk { } + DxvkAccessFlags DxvkContext::checkGfxBufferBarrier( + const DxvkBufferSlice& slice, + VkPipelineStageFlags stages, + VkAccessFlags access) { + auto srcAccess = m_gfxBarriers.getBufferAccess(slice.getSliceHandle()); + + m_gfxBarriers.accessBuffer( + slice.getSliceHandle(), + stages, access, + slice.bufferInfo().stages, + slice.bufferInfo().access); + + return srcAccess; + } + + void DxvkContext::emitMemoryBarrier( VkDependencyFlags flags, VkPipelineStageFlags srcStages, diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index af4d2e602..20abc98e7 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -1185,6 +1185,11 @@ namespace dxvk { void commitGraphicsBarriers(); + DxvkAccessFlags checkGfxBufferBarrier( + const DxvkBufferSlice& slice, + VkPipelineStageFlags stages, + VkAccessFlags access); + void emitMemoryBarrier( VkDependencyFlags flags, VkPipelineStageFlags srcStages,