From 060cd1d87cb96b785b018f78583a73ea5c1e865a Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 24 Jun 2018 17:01:05 +0200 Subject: [PATCH] [d3d11] Do not use MUTABLE_FORMAT_BIT for strictly typed formats This used to cause issues in the past, but apparently we can safely enable this optimization now. Improves performance slightly on RADV. --- src/d3d11/d3d11_texture.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 746e898ea..883b08bda 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -31,12 +31,16 @@ namespace dxvk { DecodeSampleCount(m_desc.SampleDesc.Count, &imageInfo.sampleCount); - // Color formats require MUTABLE_FORMAT_BIT to be set since - // they can be reinterpreted, especially typeless formats. + // Typeless formats need the MUTABLE_FORMAT_BIT to be set + // since they can be reinterpreted. We'll always set this + // for UAV images for integer clear operations to work. + bool mutableFormat = (formatInfo.Aspect == 0) + || (m_desc.BindFlags & D3D11_BIND_UNORDERED_ACCESS); + // Depth-stencil formats are not compatible to each other. VkImageAspectFlags formatAspect = imageFormatInfo(formatInfo.Format)->aspectMask; - if (formatAspect & VK_IMAGE_ASPECT_COLOR_BIT) + if (mutableFormat && (formatAspect & VK_IMAGE_ASPECT_COLOR_BIT)) imageInfo.flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; // Adjust image flags based on the corresponding D3D flags