From ea855c888ddcccf008bc904d3c1f7996d691f9b1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 29 Nov 2024 15:58:41 +0200 Subject: [PATCH] EffectComposer: Check property usage in customValues of other properties Properties may be used in customValues of other properties instead of being used in shaders, so need to check for those as well to find if property is in use. Fixes: QDS-14236 Change-Id: Ifc272d5fdc02596484dbb0b9d04a1b9e02d4ad7f Reviewed-by: Mahmoud Badri --- src/plugins/effectcomposer/compositionnode.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/effectcomposer/compositionnode.cpp b/src/plugins/effectcomposer/compositionnode.cpp index f460d64b041..eff9bc8fc97 100644 --- a/src/plugins/effectcomposer/compositionnode.cpp +++ b/src/plugins/effectcomposer/compositionnode.cpp @@ -290,6 +290,16 @@ void CompositionNode::updateAreUniformsInUse(bool force) if (force || m_InUseCheckNeeded) { const QString matchTemplate("\\b%1\\b"); const QList uniList = uniforms(); + + // Some of the uniforms may only be used by customValue properties + QString customValues; + for (const Uniform *u : uniList) { + if (!u->customValue().isEmpty()) { + customValues.append(u->customValue()); + customValues.append(' '); + } + } + for (int i = 0; i < uniList.size(); ++i) { Uniform *u = uniList[i]; QString pattern = matchTemplate.arg(QRegularExpression::escape(u->name())); @@ -298,6 +308,8 @@ void CompositionNode::updateAreUniformsInUse(bool force) found = regex.match(m_fragmentCode).hasMatch(); if (!found) found = regex.match(m_vertexCode).hasMatch(); + if (!found && !customValues.isEmpty()) + found = regex.match(customValues).hasMatch(); m_uniformsModel.setData(m_uniformsModel.index(i), found, EffectComposerUniformsModel::IsInUse); }