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 <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-11-29 15:58:41 +02:00
parent 74dd9598aa
commit ea855c888d

View File

@@ -290,6 +290,16 @@ void CompositionNode::updateAreUniformsInUse(bool force)
if (force || m_InUseCheckNeeded) { if (force || m_InUseCheckNeeded) {
const QString matchTemplate("\\b%1\\b"); const QString matchTemplate("\\b%1\\b");
const QList<Uniform *> uniList = uniforms(); const QList<Uniform *> 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) { for (int i = 0; i < uniList.size(); ++i) {
Uniform *u = uniList[i]; Uniform *u = uniList[i];
QString pattern = matchTemplate.arg(QRegularExpression::escape(u->name())); QString pattern = matchTemplate.arg(QRegularExpression::escape(u->name()));
@@ -298,6 +308,8 @@ void CompositionNode::updateAreUniformsInUse(bool force)
found = regex.match(m_fragmentCode).hasMatch(); found = regex.match(m_fragmentCode).hasMatch();
if (!found) if (!found)
found = regex.match(m_vertexCode).hasMatch(); found = regex.match(m_vertexCode).hasMatch();
if (!found && !customValues.isEmpty())
found = regex.match(customValues).hasMatch();
m_uniformsModel.setData(m_uniformsModel.index(i), found, m_uniformsModel.setData(m_uniformsModel.index(i), found,
EffectComposerUniformsModel::IsInUse); EffectComposerUniformsModel::IsInUse);
} }