From fd439c3e544fad7a121152a7c58d10e15d5246d6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 28 Sep 2024 22:45:15 +0200 Subject: [PATCH] [dxvk] Ensure image compatibility for packed depth-stencil copies --- src/dxvk/dxvk_context.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 9662b4e3..b38be153 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -723,6 +723,14 @@ namespace dxvk { this->invalidateState(); + DxvkImageUsageInfo usageInfo = { }; + usageInfo.usage = VK_IMAGE_USAGE_SAMPLED_BIT; + + if (!ensureImageCompatibility(srcImage, usageInfo)) { + Logger::err(str::format("DxvkContext: copyDepthStencilImageToPackedBuffer: Unsupported image:" + "\n src format: ", srcImage->info().format)); + } + // Retrieve compute pipeline for the given format auto pipeInfo = m_common->metaPack().getPackPipeline(format); @@ -1005,6 +1013,15 @@ namespace dxvk { this->prepareImage(dstImage, vk::makeSubresourceRange(dstSubresource)); + DxvkImageUsageInfo usageInfo = { }; + usageInfo.usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + + if (!ensureImageCompatibility(dstImage, usageInfo)) { + Logger::err(str::format("DxvkCOntext: copyPackedBufferToDepthStencilImage: Unsupported image:" + "\n dst format: ", dstImage->info().format)); + return; + } + if (m_execBarriers.isBufferDirty(srcBuffer->getSliceHandle(), DxvkAccess::Read) || m_execBarriers.isImageDirty(dstImage, vk::makeSubresourceRange(dstSubresource), DxvkAccess::Write)) m_execBarriers.recordCommands(m_cmd);