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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-12-09 15:04:56 +03:30 committed by Alexandre Julliard
parent 97558b6550
commit 6f55c8d1c5
1 changed files with 17 additions and 1 deletions

View File

@ -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)
{