Merge pull request #13207 from OatmealDome/vulkan-hdr-color-space

VKSwapChain: Always use surface formats with a normal sRGB color space if not RGBA16F
This commit is contained in:
OatmealDome 2024-12-16 17:29:19 -05:00 committed by GitHub
commit 01f6810a9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -176,18 +176,20 @@ bool SwapChain::SelectSurfaceFormat()
// because we already apply gamma ourselves, and we might not use sRGB gamma. // because we already apply gamma ourselves, and we might not use sRGB gamma.
// Force using a linear format instead, if this is the case. // Force using a linear format instead, if this is the case.
VkFormat format = VKTexture::GetLinearFormat(surface_format.format); VkFormat format = VKTexture::GetLinearFormat(surface_format.format);
if (format == VK_FORMAT_R8G8B8A8_UNORM) if (surface_format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
surface_format_RGBA8 = &surface_format; {
else if (format == VK_FORMAT_B8G8R8A8_UNORM) if (format == VK_FORMAT_R8G8B8A8_UNORM)
surface_format_BGRA8 = &surface_format; surface_format_RGBA8 = &surface_format;
else if (format == VK_FORMAT_A2B10G10R10_UNORM_PACK32 && else if (format == VK_FORMAT_B8G8R8A8_UNORM)
surface_format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) surface_format_BGRA8 = &surface_format;
surface_format_RGB10_A2 = &surface_format; else if (format == VK_FORMAT_A2B10G10R10_UNORM_PACK32)
surface_format_RGB10_A2 = &surface_format;
}
else if (format == VK_FORMAT_R16G16B16A16_SFLOAT && else if (format == VK_FORMAT_R16G16B16A16_SFLOAT &&
surface_format.colorSpace == VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT) surface_format.colorSpace == VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT)
{
surface_format_RGBA16F_scRGB = &surface_format; surface_format_RGBA16F_scRGB = &surface_format;
else }
continue;
} }
const VkSurfaceFormatKHR* surface_format = nullptr; const VkSurfaceFormatKHR* surface_format = nullptr;