From 2864a5e474a2b4ef46ba058106885e36f2ebbfb8 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 12 Oct 2024 09:44:22 +0200 Subject: [PATCH] [dxvk] Use new barrier helpers in clearImageViewCs And ensure we're in GENERAL layout. We generally (pun intended) should be, but there may be a universe where that is not the case. --- src/dxvk/dxvk_context.cpp | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index b73e8c6b..dc7f9fe0 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -3415,17 +3415,17 @@ namespace dxvk { VkClearValue value) { this->spillRenderPass(false); this->invalidateState(); - - if (m_execBarriers.isImageDirty( - imageView->image(), - imageView->imageSubresources(), - DxvkAccess::Write)) - m_execBarriers.recordCommands(m_cmd); - + + flushPendingAccesses(*imageView->image(), imageView->imageSubresources(), DxvkAccess::Write); + + addImageLayoutTransition(*imageView->image(), imageView->imageSubresources(), + VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_WRITE_BIT, + imageView->image()->isFullSubresource(vk::pickSubresourceLayers(imageView->imageSubresources(), 0), extent)); + // Query pipeline objects to use for this clear operation DxvkMetaClearPipeline pipeInfo = m_common->metaClear().getClearImagePipeline( imageView->type(), lookupFormatInfo(imageView->info().format)->flags); - + // Create a descriptor set pointing to the view VkDescriptorSet descriptorSet = m_descriptorPool->alloc(pipeInfo.dsetLayout); @@ -3467,17 +3467,12 @@ namespace dxvk { 0, sizeof(pushArgs), &pushArgs); m_cmd->cmdDispatch(DxvkCmdBuffer::ExecBuffer, workgroups.width, workgroups.height, workgroups.depth); - - m_execBarriers.accessImage( - imageView->image(), - imageView->imageSubresources(), - imageView->image()->info().layout, - VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - VK_ACCESS_SHADER_WRITE_BIT, - imageView->image()->info().layout, - imageView->image()->info().stages, - imageView->image()->info().access); - + + accessImage(DxvkCmdBuffer::ExecBuffer, + *imageView->image(), imageView->imageSubresources(), + VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, + VK_ACCESS_2_SHADER_WRITE_BIT); + m_cmd->trackResource(imageView->image()); }