render/cm: add ICC profile pipeline (#12711)

Adds an ICC profile pipeline, loading via config and applying via 3D LUTs.
This commit is contained in:
Vaxry 2026-03-04 19:50:28 +00:00 committed by GitHub
parent 8271cfc97b
commit 10754745a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 984 additions and 373 deletions

View file

@ -159,9 +159,11 @@ void CScreenshareFrame::renderMonitor() {
const auto PMONITOR = m_session->monitor();
auto TEXTURE = makeShared<CTexture>(PMONITOR->m_output->state->state().buffer);
if (!g_pHyprOpenGL->m_monitorRenderResources.contains(PMONITOR))
return; // wtf?
auto TEXTURE = g_pHyprOpenGL->m_monitorRenderResources[PMONITOR].monitorMirrorFB.getTexture();
const bool IS_CM_AWARE = PROTO::colorManagement && PROTO::colorManagement->isClientCMAware(m_session->m_client);
g_pHyprOpenGL->m_renderData.transformDamage = false;
g_pHyprOpenGL->m_renderData.noSimplify = true;
@ -171,11 +173,7 @@ void CScreenshareFrame::renderMonitor() {
.translate(-m_session->m_captureBox.pos()); // vvvv kinda ass-backwards but that's how I designed the renderer... sigh.
g_pHyprOpenGL->pushMonitorTransformEnabled(true);
g_pHyprOpenGL->setRenderModifEnabled(false);
g_pHyprOpenGL->renderTexture(TEXTURE, monbox,
{
.cmBackToSRGB = !IS_CM_AWARE,
.cmBackToSRGBSource = !IS_CM_AWARE ? PMONITOR : nullptr,
});
g_pHyprOpenGL->renderTexturePrimitive(TEXTURE, monbox);
g_pHyprOpenGL->setRenderModifEnabled(true);
g_pHyprOpenGL->popMonitorTransformEnabled();

View file

@ -156,6 +156,14 @@ void CScreenshareManager::destroyClientSessions(wl_client* client) {
std::erase_if(m_managedSessions, [&](const auto& session) { return !session || session->m_session->m_client == client; });
}
bool CScreenshareManager::isOutputBeingSSd(PHLMONITOR monitor) {
return std::ranges::any_of(m_pendingFrames, [monitor](const auto& f) {
if (!f || !f->m_session)
return false;
return (f->m_session->m_type == SHARE_MONITOR || f->m_session->m_type == SHARE_REGION) && f->m_session->m_monitor == monitor;
});
}
CScreenshareManager::SManagedSession::SManagedSession(UP<CScreenshareSession>&& session) : m_session(std::move(session)) {
;
}

View file

@ -209,6 +209,7 @@ namespace Screenshare {
void destroyClientSessions(wl_client* client);
void onOutputCommit(PHLMONITOR monitor);
bool isOutputBeingSSd(PHLMONITOR monitor);
private:
std::vector<WP<CScreenshareSession>> m_sessions;