mirror of
https://github.com/love2d/love.git
synced 2026-08-21 05:00:08 +02:00
vulkan: use sRGB backbuffer format when gamma-correct rendering is on
This commit is contained in:
@@ -1858,6 +1858,15 @@ void Graphics::createSwapChain()
|
|||||||
|
|
||||||
VkSurfaceFormatKHR Graphics::chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR> &availableFormats)
|
VkSurfaceFormatKHR Graphics::chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR> &availableFormats)
|
||||||
{
|
{
|
||||||
|
// TODO: turn off GammaCorrect if a sRGB format can't be found?
|
||||||
|
if (isGammaCorrect())
|
||||||
|
{
|
||||||
|
for (const auto& availableFormat : availableFormats)
|
||||||
|
// fixme: what if this format and colorspace is not available?
|
||||||
|
if (availableFormat.format == VK_FORMAT_B8G8R8A8_SRGB && availableFormat.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
|
||||||
|
return availableFormat;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto &availableFormat : availableFormats)
|
for (const auto &availableFormat : availableFormats)
|
||||||
// fixme: what if this format and colorspace is not available?
|
// fixme: what if this format and colorspace is not available?
|
||||||
if (availableFormat.format == VK_FORMAT_B8G8R8A8_UNORM && availableFormat.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
|
if (availableFormat.format == VK_FORMAT_B8G8R8A8_UNORM && availableFormat.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
|
||||||
|
|||||||
Reference in New Issue
Block a user