mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Improve swap chain format fallback logic
When requesting an unsupported non-SRGB format, we shouldn't fall back to an SRGB format since that will cause Gamma issues.
This commit is contained in:
parent
79d3b203ef
commit
b8468fda43
@ -1,4 +1,5 @@
|
|||||||
#include "dxvk_surface.h"
|
#include "dxvk_surface.h"
|
||||||
|
#include "dxvk_format.h"
|
||||||
|
|
||||||
#include "../util/util_math.h"
|
#include "../util/util_math.h"
|
||||||
|
|
||||||
@ -50,6 +51,18 @@ namespace dxvk {
|
|||||||
return fmt;
|
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
|
// Otherwise, fall back to the first format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user