From e918104ef38f2c16a7b8126cd18e65935d5be229 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 26 Oct 2019 03:51:54 +0200 Subject: [PATCH] [dxvk] Introduce checkGfxImageBarrier --- src/dxvk/dxvk_context.cpp | 35 +++++++++++++++++++++++------------ src/dxvk/dxvk_context.h | 5 +++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 3e10d1169..ca4b487bd 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -4587,18 +4587,8 @@ namespace dxvk { case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: if (slot.imageView != nullptr && slot.imageView->imageInfo().usage & storageImageUsage) { - srcAccess = m_gfxBarriers.getImageAccess( - slot.imageView->image(), - slot.imageView->imageSubresources()); - - m_gfxBarriers.accessImage( - slot.imageView->image(), - slot.imageView->imageSubresources(), - slot.imageView->imageInfo().layout, - binding.stages, binding.access, - slot.imageView->imageInfo().layout, - slot.imageView->imageInfo().stages, - slot.imageView->imageInfo().access); + srcAccess = this->checkGfxImageBarrier(slot.imageView, + binding.stages, binding.access); } break; @@ -4642,6 +4632,27 @@ namespace dxvk { } + DxvkAccessFlags DxvkContext::checkGfxImageBarrier( + const Rc& imageView, + VkPipelineStageFlags stages, + VkAccessFlags access) { + auto srcAccess = m_gfxBarriers.getImageAccess( + imageView->image(), + imageView->imageSubresources()); + + m_gfxBarriers.accessImage( + imageView->image(), + imageView->imageSubresources(), + imageView->imageInfo().layout, + stages, access, + imageView->imageInfo().layout, + imageView->imageInfo().stages, + imageView->imageInfo().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 20abc98e7..f6012bf2b 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -1190,6 +1190,11 @@ namespace dxvk { VkPipelineStageFlags stages, VkAccessFlags access); + DxvkAccessFlags checkGfxImageBarrier( + const Rc& imageView, + VkPipelineStageFlags stages, + VkAccessFlags access); + void emitMemoryBarrier( VkDependencyFlags flags, VkPipelineStageFlags srcStages,