EffectComposer: Fix generated code for mipmap effects

Mipmap effects need layer.smooth and layer.mipmap to work correctly.

Fixes: QDS-11793
Change-Id: I8f04ca9f144f51d0032d995c2bafdcb0c95ad73d
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-01-30 14:49:29 +02:00
parent 3ec2cd1f0b
commit e617fc96db
3 changed files with 20 additions and 1 deletions

View File

@@ -618,6 +618,20 @@ R"(
)" )"
}; };
if (m_shaderFeatures.enabled(ShaderFeatures::Mipmap)) {
QString mipmap1{
R"(parent.layer.smooth = true
parent.layer.mipmap = true
%1)"
};
QString mipmap2{
R"(_oldParent.layer.smooth = false
_oldParent.layer.mipmap = false
%2)"
};
parentChanged = parentChanged.arg(mipmap1, mipmap2);
}
parentChanged = parentChanged.arg(m_shaderFeatures.enabled(ShaderFeatures::Source) parentChanged = parentChanged.arg(m_shaderFeatures.enabled(ShaderFeatures::Source)
? QString("source = parent") : QString(), ? QString("source = parent") : QString(),
m_shaderFeatures.enabled(ShaderFeatures::Source) m_shaderFeatures.enabled(ShaderFeatures::Source)

View File

@@ -73,8 +73,12 @@ void ShaderFeatures::checkLine(const QString &line, Features &features)
if (m_gridMeshWidth > 1 || m_gridMeshHeight > 1) if (m_gridMeshWidth > 1 || m_gridMeshHeight > 1)
features.setFlag(GridMesh, true); features.setFlag(GridMesh, true);
} }
if (line.contains("@blursources")) if (line.contains("@blursources"))
features.setFlag(BlurSources, true); features.setFlag(BlurSources, true);
if (line.contains("textureLod("))
features.setFlag(Mipmap, true);
} }
int ShaderFeatures::gridMeshHeight() const int ShaderFeatures::gridMeshHeight() const

View File

@@ -19,7 +19,8 @@ public:
Mouse = 1 << 4, Mouse = 1 << 4,
FragCoord = 1 << 5, FragCoord = 1 << 5,
GridMesh = 1 << 6, GridMesh = 1 << 6,
BlurSources = 1 << 7 BlurSources = 1 << 7,
Mipmap = 1 << 8
}; };
Q_DECLARE_FLAGS(Features, Feature) Q_DECLARE_FLAGS(Features, Feature)