diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2025-06-15 13:15:18 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 12:15:18 +0200 |
| commit | c3894d9288e99500df4fc4704bcc614ea8d520ec (patch) | |
| tree | 083ac23210b978f554e3a42aa6fc618e4a861d9e /src/render | |
| parent | 3db3baa19e55a039c1a64a29c8e9aaadea4e5f01 (diff) | |
config/monitor: Add monitor v2 HDR rules (#10623)
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/OpenGL.cpp | 8 | ||||
| -rw-r--r-- | src/render/OpenGL.hpp | 2 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 5 |
3 files changed, 6 insertions, 9 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 7ba4b6b9..659bc1da 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1436,7 +1436,7 @@ void CHyprOpenGLImpl::renderTextureWithDamage(SP<CTexture> tex, const CBox& box, static std::map<std::pair<uint32_t, uint32_t>, std::array<GLfloat, 9>> primariesConversionCache; void CHyprOpenGLImpl::passCMUniforms(const SShader& shader, const NColorManagement::SImageDescription& imageDescription, - const NColorManagement::SImageDescription& targetImageDescription, bool modifySDR) { + const NColorManagement::SImageDescription& targetImageDescription, bool modifySDR, float sdrMinLuminance, int sdrMaxLuminance) { glUniform1i(shader.sourceTF, imageDescription.transferFunction); glUniform1i(shader.targetTF, targetImageDescription.transferFunction); @@ -1450,8 +1450,8 @@ void CHyprOpenGLImpl::passCMUniforms(const SShader& shader, const NColorManageme }; glUniformMatrix4x2fv(shader.targetPrimaries, 1, false, glTargetPrimaries); - glUniform2f(shader.srcTFRange, imageDescription.getTFMinLuminance(), imageDescription.getTFMaxLuminance()); - glUniform2f(shader.dstTFRange, targetImageDescription.getTFMinLuminance(), targetImageDescription.getTFMaxLuminance()); + glUniform2f(shader.srcTFRange, imageDescription.getTFMinLuminance(sdrMinLuminance), imageDescription.getTFMaxLuminance(sdrMaxLuminance)); + glUniform2f(shader.dstTFRange, targetImageDescription.getTFMinLuminance(sdrMinLuminance), targetImageDescription.getTFMaxLuminance(sdrMaxLuminance)); const float maxLuminance = imageDescription.luminances.max > 0 ? imageDescription.luminances.max : imageDescription.luminances.reference; glUniform1f(shader.maxLuminance, maxLuminance * targetImageDescription.luminances.reference / imageDescription.luminances.reference); @@ -1480,7 +1480,7 @@ void CHyprOpenGLImpl::passCMUniforms(const SShader& shader, const NColorManageme } void CHyprOpenGLImpl::passCMUniforms(const SShader& shader, const SImageDescription& imageDescription) { - passCMUniforms(shader, imageDescription, m_renderData.pMonitor->m_imageDescription, true); + passCMUniforms(shader, imageDescription, m_renderData.pMonitor->m_imageDescription, true, m_renderData.pMonitor->m_sdrMinLuminance, m_renderData.pMonitor->m_sdrMaxLuminance); } void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CBox& box, float alpha, const CRegion& damage, int round, float roundingPower, bool discardActive, diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 341ee575..92d9b7d3 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -347,7 +347,7 @@ class CHyprOpenGLImpl { CFramebuffer* blurFramebufferWithDamage(float a, CRegion* damage, CFramebuffer& source); void passCMUniforms(const SShader&, const NColorManagement::SImageDescription& imageDescription, const NColorManagement::SImageDescription& targetImageDescription, - bool modifySDR = false); + bool modifySDR = false, float sdrMinLuminance = -1.0f, int sdrMaxLuminance = -1); void passCMUniforms(const SShader&, const NColorManagement::SImageDescription& imageDescription); void renderTextureInternalWithDamage(SP<CTexture>, const CBox& box, float a, const CRegion& damage, int round = 0, float roundingPower = 2.0f, bool discardOpaque = false, bool noAA = false, bool allowCustomUV = false, bool allowDim = false, GLenum wrapX = GL_CLAMP_TO_EDGE, GLenum wrapY = GL_CLAMP_TO_EDGE); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index ecc46a36..43d4ece5 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1485,10 +1485,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) { static auto PPASS = CConfigValue<Hyprlang::INT>("render:cm_fs_passthrough"); const bool PHDR = pMonitor->m_imageDescription.transferFunction == CM_TRANSFER_FUNCTION_ST2084_PQ; - const bool SUPPORTSPQ = pMonitor->m_output->parsedEDID.hdrMetadata.has_value() ? pMonitor->m_output->parsedEDID.hdrMetadata->supportsPQ : false; - Debug::log(TRACE, "ColorManagement supportsBT2020 {}, supportsPQ {}", pMonitor->m_output->parsedEDID.supportsBT2020, SUPPORTSPQ); - - if (pMonitor->m_output->parsedEDID.supportsBT2020 && SUPPORTSPQ) { + if (pMonitor->supportsHDR()) { // HDR metadata determined by // PPASS = 0 monitor settings // PPASS = 1 |
