From 542febcf59af40694015de08fbbd1534adc2c470 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Fri, 21 Apr 2023 08:44:03 -0700 Subject: [PATCH] dzn: Handle opaque BC1 Part-of: --- src/microsoft/vulkan/dzn_image.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/microsoft/vulkan/dzn_image.c b/src/microsoft/vulkan/dzn_image.c index 1458e53..3f91fea 100644 --- a/src/microsoft/vulkan/dzn_image.c +++ b/src/microsoft/vulkan/dzn_image.c @@ -1061,6 +1061,13 @@ dzn_image_view_prepare_srv_desc(struct dzn_image_view *iview) else if (swz[i] == D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1) swz[i] = D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0; } + } else if (iview->vk.view_format == VK_FORMAT_BC1_RGB_SRGB_BLOCK || + iview->vk.view_format == VK_FORMAT_BC1_RGB_UNORM_BLOCK) { + /* D3D has no opaque version of these; force alpha to 1 */ + for (uint32_t i = 0; i < ARRAY_SIZE(swz); i++) { + if (swz[i] == D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3) + swz[i] = D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1; + } } iview->srv_desc.Shader4ComponentMapping = -- 2.7.4