diff options
| author | Dominick DiMaggio <ddimaggio324@gmail.com> | 2025-10-29 08:53:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-29 12:53:42 +0000 |
| commit | ff50dc36e912b6ad764802d51be838bc7f6ed323 (patch) | |
| tree | a51a09b12e89b9ee3c5ceb2f082c09e49ff146ea /src/render/OpenGL.cpp | |
| parent | ce9787b3f47ce550027274a1aa25e74b6fb1c74a (diff) | |
renderer/cm: allow gamma 2.2 instead of sRGB EOTF (#12094)
Diffstat (limited to 'src/render/OpenGL.cpp')
| -rw-r--r-- | src/render/OpenGL.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index c16cbf15..02da142f 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1552,14 +1552,24 @@ static std::map<std::pair<uint32_t, uint32_t>, std::array<GLfloat, 9>> primaries static bool isSDR2HDR(const NColorManagement::SImageDescription& imageDescription, const NColorManagement::SImageDescription& targetImageDescription) { // might be too strict - return imageDescription.transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_SRGB && + return (imageDescription.transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_SRGB || + imageDescription.transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_GAMMA22) && (targetImageDescription.transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_ST2084_PQ || targetImageDescription.transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_HLG); } void CHyprOpenGLImpl::passCMUniforms(SShader& shader, const NColorManagement::SImageDescription& imageDescription, const NColorManagement::SImageDescription& targetImageDescription, bool modifySDR, float sdrMinLuminance, int sdrMaxLuminance) { - shader.setUniformInt(SHADER_SOURCE_TF, imageDescription.transferFunction); + static auto PSDREOTF = CConfigValue<Hyprlang::INT>("render:cm_sdr_eotf"); + + if (m_renderData.surface.valid() && + ((!m_renderData.surface->m_colorManagement.valid() && *PSDREOTF >= 1) || + (*PSDREOTF == 2 && m_renderData.surface->m_colorManagement.valid() && + imageDescription.transferFunction == NColorManagement::eTransferFunction::CM_TRANSFER_FUNCTION_SRGB))) { + shader.setUniformInt(SHADER_SOURCE_TF, NColorManagement::eTransferFunction::CM_TRANSFER_FUNCTION_GAMMA22); + } else + shader.setUniformInt(SHADER_SOURCE_TF, imageDescription.transferFunction); + shader.setUniformInt(SHADER_TARGET_TF, targetImageDescription.transferFunction); const auto targetPrimaries = targetImageDescription.primariesNameSet || targetImageDescription.primaries == SPCPRimaries{} ? |
