diff --git a/src/dxvk/dxvk_surface.cpp b/src/dxvk/dxvk_surface.cpp index 630ee6fa0..20dc456be 100644 --- a/src/dxvk/dxvk_surface.cpp +++ b/src/dxvk/dxvk_surface.cpp @@ -1,4 +1,5 @@ #include "dxvk_surface.h" +#include "dxvk_format.h" #include "../util/util_math.h" @@ -50,6 +51,18 @@ namespace dxvk { return fmt; } } + + // If that didn't work, we'll fall back to a format + // which has similar properties to the preferred one + DxvkFormatFlags prefFlags = imageFormatInfo(preferred[0].format)->flags; + + for (auto fmt : m_surfaceFormats) { + auto currFlags = imageFormatInfo(fmt.format)->flags; + + if ((currFlags & DxvkFormatFlag::ColorSpaceSrgb) + == (prefFlags & DxvkFormatFlag::ColorSpaceSrgb)) + return fmt; + } } // Otherwise, fall back to the first format