fix unmodified copy

This commit is contained in:
UjinT34 2026-04-28 21:57:46 +03:00
parent f71905e13b
commit b08eefd4e2
3 changed files with 11 additions and 6 deletions

View file

@ -539,6 +539,8 @@ std::vector<SP<IValue>> Values::getConfigValues() {
{.min = 0, .max = 2, .map = OptionMap{{"disable", 0}, {"enable", 1}, {"auto", 2}}}),
MS<Int>("render:non_shader_cm_interop", "non_shader_cm interaction with ctm proto (hyprsunset and similar).", 2,
{.min = 0, .max = 2, .map = OptionMap{{"disable", 0}, {"enable", 1}, {"auto", 2}}}),
MS<Int>("render:fp16_sdr_tf", "Internal workbuffer transfer function for fp16 in SDR mode", 0,
{.min = 0, .max = 2, .map = OptionMap{{"default", 0}, {"linear", 1}, {"monitor", 2}}}),
/*
* cursor:

View file

@ -2550,6 +2550,8 @@ bool CMonitor::useFP16() {
}
PImageDescription CMonitor::workBufferImageDescription() {
static const auto PFP16TF = CConfigValue<Hyprlang::INT>("render:fp16_sdr_tf");
if (!useFP16())
return m_imageDescription;
@ -2561,19 +2563,20 @@ PImageDescription CMonitor::workBufferImageDescription() {
const auto& cached = m_cachedInternalDescription->value();
// HDR
if (isHDRLikeTF || value.windowsScRGB) {
if (cached.primariesNamed != NColorManagement::CM_PRIMARIES_SRGB || cached.luminances != value.luminances)
if (isHDRLikeTF || value.windowsScRGB || *PFP16TF != 2) {
if (cached.transferFunction != LINEAR_IMAGE_DESCRIPTION->value().transferFunction || cached.luminances != value.luminances)
m_cachedInternalDescription = LINEAR_IMAGE_DESCRIPTION->with(value.luminances);
return m_cachedInternalDescription;
}
// SDR
if (cached.primariesNamed != NColorManagement::CM_PRIMARIES_BT2020 || cached.transferFunction != chooseTF(m_sdrEotf))
if (cached.transferFunction != chooseTF(m_sdrEotf))
m_cachedInternalDescription = CImageDescription::from(SImageDescription{
.transferFunction = chooseTF(m_sdrEotf),
.primariesNameSet = true,
.primariesNamed = NColorManagement::CM_PRIMARIES_BT2020,
.primaries = NColorPrimaries::BT2020,
// render:keep_unmodified_copy and other conditions that trigger MRT for screen sharing expect a work buffer with sRGB primaries
.primariesNamed = NColorManagement::CM_PRIMARIES_SRGB,
.primaries = NColorPrimaries::BT709,
});
return m_cachedInternalDescription;

View file

@ -415,7 +415,7 @@ class CMonitor {
// Resources
UP<Monitor::CMonitorResources> m_resources;
// cached should contain one of predefined descriptions: BT2020 primaries with variable TF and SDR luminances or SRGB primaries with linear TF and variable luminances.
// cached should contain one of predefined descriptions for FP16: sRGB primaries with either linear TF by default and in HDR mode or monitor's TF in SDR with render:fp16_sdr_tf = 2
// avoids lookup for an id when ::from is used
NColorManagement::PImageDescription m_cachedInternalDescription = NColorManagement::CImageDescription::from(NColorManagement::SImageDescription{});