Skip to content

Commit 8cfd896

Browse files
committed
Add ITM TF config option
1 parent 3736065 commit 8cfd896

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/config/ConfigDescriptions.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
15421542
.type = CONFIG_OPTION_CHOICE,
15431543
.data = SConfigOptionDescription::SChoiceData{0, "disable,always,ondemand,ignore"},
15441544
},
1545+
SConfigOptionDescription{
1546+
.value = "render:cm_itm_tf",
1547+
.description = "Default transfer function for displaying untagged SDR surfaces in HDR mode. 0 - sRGB, 1 - Gamma 2.2",
1548+
.type = CONFIG_OPTION_CHOICE,
1549+
.data = SConfigOptionDescription::SChoiceData{0, "srgb,gamma22"},
1550+
},
15451551

15461552
/*
15471553
* cursor:

src/config/ConfigManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ CConfigManager::CConfigManager() {
781781
registerConfigVar("render:cm_auto_hdr", Hyprlang::INT{1});
782782
registerConfigVar("render:new_render_scheduling", Hyprlang::INT{0});
783783
registerConfigVar("render:non_shader_cm", Hyprlang::INT{2});
784+
registerConfigVar("render:cm_itm_tf", Hyprlang::INT{0});
784785

785786
registerConfigVar("ecosystem:no_update_news", Hyprlang::INT{0});
786787
registerConfigVar("ecosystem:no_donation_nag", Hyprlang::INT{0});

src/render/OpenGL.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,10 @@ static bool isSDR2HDR(const NColorManagement::SImageDescription& imageDescriptio
15591559

15601560
void CHyprOpenGLImpl::passCMUniforms(SShader& shader, const NColorManagement::SImageDescription& imageDescription,
15611561
const NColorManagement::SImageDescription& targetImageDescription, bool modifySDR, float sdrMinLuminance, int sdrMaxLuminance) {
1562-
const bool needsSDRmod = modifySDR && isSDR2HDR(imageDescription, targetImageDescription);
1563-
if (needsSDRmod && m_renderData.surface.valid() && !m_renderData.surface->m_colorManagement.valid()) {
1562+
const bool needsSDRmod = modifySDR && isSDR2HDR(imageDescription, targetImageDescription);
1563+
static auto PITMTF = CConfigValue<Hyprlang::INT>("render:cm_itm_tf");
1564+
1565+
if (needsSDRmod && m_renderData.surface.valid() && !m_renderData.surface->m_colorManagement.valid() && *PITMTF == 1) {
15641566
shader.setUniformInt(SHADER_SOURCE_TF, NColorManagement::eTransferFunction::CM_TRANSFER_FUNCTION_GAMMA22);
15651567
} else {
15661568
shader.setUniformInt(SHADER_SOURCE_TF, imageDescription.transferFunction);

0 commit comments

Comments
 (0)