Henri Verbeet : wined3d: Use an sRGB fallback format for sRGB formats in wined3d_swapchain_vk_select_vk_format().
Alexandre Julliard
julliard at winehq.org
Wed Dec 9 15:38:58 CST 2020
Module: wine
Branch: master
Commit: 6f55c8d1c56ad0901a9a0d3a5216c97925a0c70f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6f55c8d1c56ad0901a9a0d3a5216c97925a0c70f
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Dec 9 15:22:56 2020 +0330
wined3d: Use an sRGB fallback format for sRGB formats in wined3d_swapchain_vk_select_vk_format().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50121
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/swapchain.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index ffffc18aa84..0c5a75ed02d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -635,6 +635,22 @@ done:
return supported;
}
+static VkFormat get_swapchain_fallback_format(VkFormat vk_format)
+{
+ switch (vk_format)
+ {
+ case VK_FORMAT_R8G8B8A8_SRGB:
+ return VK_FORMAT_B8G8R8A8_SRGB;
+ case VK_FORMAT_R8G8B8A8_UNORM:
+ case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
+ case VK_FORMAT_R16G16B16A16_SFLOAT:
+ return VK_FORMAT_B8G8R8A8_UNORM;
+ default:
+ WARN("Unhandled format %#x.\n", vk_format);
+ return VK_FORMAT_UNDEFINED;
+ }
+}
+
static VkFormat wined3d_swapchain_vk_select_vk_format(struct wined3d_swapchain_vk *swapchain_vk,
VkSurfaceKHR vk_surface)
{
@@ -684,7 +700,7 @@ static VkFormat wined3d_swapchain_vk_select_vk_format(struct wined3d_swapchain_v
if (i == format_count)
{
/* Try to create a swapchain with format conversion. */
- vk_format = VK_FORMAT_B8G8R8A8_UNORM;
+ vk_format = get_swapchain_fallback_format(vk_format);
WARN("Failed to find Vulkan swapchain format for %s.\n", debug_d3dformat(desc->backbuffer_format));
for (i = 0; i < format_count; ++i)
{
More information about the wine-cvs
mailing list