Commit db30c079 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

dxgi: Validate formats for flip presentation model.

parent a5368182
...@@ -55,6 +55,21 @@ static DXGI_SWAP_EFFECT dxgi_swap_effect_from_wined3d(enum wined3d_swap_effect s ...@@ -55,6 +55,21 @@ static DXGI_SWAP_EFFECT dxgi_swap_effect_from_wined3d(enum wined3d_swap_effect s
} }
} }
static BOOL dxgi_validate_flip_swap_effect_format(DXGI_FORMAT format)
{
switch (format)
{
case DXGI_FORMAT_R16G16B16A16_FLOAT:
case DXGI_FORMAT_R10G10B10A2_UNORM:
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_B8G8R8A8_UNORM:
return TRUE;
default:
WARN("Invalid swapchain format %#x for flip presentation model.\n", format);
return FALSE;
}
}
BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc) BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc)
{ {
unsigned int min_buffer_count; unsigned int min_buffer_count;
...@@ -70,6 +85,9 @@ BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc) ...@@ -70,6 +85,9 @@ BOOL dxgi_validate_swapchain_desc(const DXGI_SWAP_CHAIN_DESC1 *desc)
case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL: case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL:
min_buffer_count = 2; min_buffer_count = 2;
if (!dxgi_validate_flip_swap_effect_format(desc->Format))
return FALSE;
if (desc->SampleDesc.Count != 1 || desc->SampleDesc.Quality) if (desc->SampleDesc.Count != 1 || desc->SampleDesc.Quality)
{ {
WARN("Invalid sample desc %u, %u for swap effect %#x.\n", WARN("Invalid sample desc %u, %u for swap effect %#x.\n",
...@@ -968,9 +986,7 @@ static DXGI_FORMAT dxgi_format_from_vk_format(VkFormat vk_format) ...@@ -968,9 +986,7 @@ static DXGI_FORMAT dxgi_format_from_vk_format(VkFormat vk_format)
{ {
switch (vk_format) switch (vk_format)
{ {
case VK_FORMAT_B8G8R8A8_SRGB: return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
case VK_FORMAT_B8G8R8A8_UNORM: return DXGI_FORMAT_B8G8R8A8_UNORM; case VK_FORMAT_B8G8R8A8_UNORM: return DXGI_FORMAT_B8G8R8A8_UNORM;
case VK_FORMAT_R8G8B8A8_SRGB: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
case VK_FORMAT_R8G8B8A8_UNORM: return DXGI_FORMAT_R8G8B8A8_UNORM; case VK_FORMAT_R8G8B8A8_UNORM: return DXGI_FORMAT_R8G8B8A8_UNORM;
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return DXGI_FORMAT_R10G10B10A2_UNORM; case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return DXGI_FORMAT_R10G10B10A2_UNORM;
default: default:
...@@ -983,7 +999,6 @@ static VkFormat get_swapchain_fallback_format(VkFormat vk_format) ...@@ -983,7 +999,6 @@ static VkFormat get_swapchain_fallback_format(VkFormat vk_format)
{ {
switch (vk_format) switch (vk_format)
{ {
case VK_FORMAT_R8G8B8A8_SRGB: return VK_FORMAT_B8G8R8A8_SRGB;
case VK_FORMAT_R8G8B8A8_UNORM: return VK_FORMAT_B8G8R8A8_UNORM; case VK_FORMAT_R8G8B8A8_UNORM: return VK_FORMAT_B8G8R8A8_UNORM;
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return VK_FORMAT_B8G8R8A8_UNORM; case VK_FORMAT_A2B10G10R10_UNORM_PACK32: return VK_FORMAT_B8G8R8A8_UNORM;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment