From c9f6e65b9b74ca7f0a2eb2459ed0977ad019caaf Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 9 Dec 2024 14:11:11 +0100 Subject: [PATCH] [dxgi] Use VK_FORMAT_A8_UNORM if supported --- src/dxgi/dxgi_format.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/dxgi/dxgi_format.cpp b/src/dxgi/dxgi_format.cpp index 306f773ec64..d320f7e17e4 100644 --- a/src/dxgi/dxgi_format.cpp +++ b/src/dxgi/dxgi_format.cpp @@ -318,12 +318,10 @@ namespace dxvk { VK_FORMAT_R8_UINT, VK_IMAGE_ASPECT_COLOR_BIT }, // DXGI_FORMAT_A8_UNORM - { VK_FORMAT_R8_UNORM, + { VK_FORMAT_A8_UNORM_KHR, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, - VK_IMAGE_ASPECT_COLOR_BIT, 0, - { VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO, - VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_R }}, + VK_IMAGE_ASPECT_COLOR_BIT }, // DXGI_FORMAT_R1_UNORM { }, // Unsupported // DXGI_FORMAT_R9G9B9E5_SHAREDEXP @@ -860,6 +858,16 @@ namespace dxvk { RemapDepthFormat(DXGI_FORMAT_X24_TYPELESS_G8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT); RemapDepthFormat(DXGI_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT); } + + if (!CheckImageFormatSupport(device, VK_FORMAT_A8_UNORM_KHR, + VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT | + VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT | + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) { + Logger::info("DXGI: VK_FORMAT_A8_UNORM_KHR -> VK_FORMAT_R8_UNORM"); + RemapColorFormat(DXGI_FORMAT_A8_UNORM, VK_FORMAT_R8_UNORM, { + VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_ZERO, + VK_COMPONENT_SWIZZLE_ZERO, VK_COMPONENT_SWIZZLE_R }); + } }