From 7c97e276f270241a1741db0b77d2124af1cc1744 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 1 Sep 2018 15:51:56 +0200 Subject: [PATCH] [dxvk] Fix up component swizzle for render target views Vulkan does not support non-identity swizzles for image views that are used for rendering, but we have to keep the information around in order to support rendering to swizzled image formats. --- src/dxvk/dxvk_image.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dxvk/dxvk_image.cpp b/src/dxvk/dxvk_image.cpp index ed84ce7d8..a7b3da11e 100644 --- a/src/dxvk/dxvk_image.cpp +++ b/src/dxvk/dxvk_image.cpp @@ -193,6 +193,12 @@ namespace dxvk { viewInfo.format = m_info.format; viewInfo.components = m_info.swizzle; viewInfo.subresourceRange = subresourceRange; + + if (m_info.usage == VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { + viewInfo.components = { + VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY }; + } if (m_vkd->vkCreateImageView(m_vkd->device(), &viewInfo, nullptr, &m_views[type]) != VK_SUCCESS) {