aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-09-16 14:43:00 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-09-20 14:30:45 +0200
commite70e2f7d98f7763463413bfd6d2f9300e48087b4 (patch)
treed407b368427a892d586828a6c7dd6a82fcec8b4a
parent341604be545b0fe43b18f3822e9c9da918f5f675 (diff)
Reinitialize shader data structure when effect changes
Shaders might not all have the same number of uniforms and locations, so reinitialize the array when the effect changes. Change-Id: I16b4f6b865ebe7b74c2960a1e88b8f12b83ee2b3 Done-with: Matt Galloway Fixes: QTBUG-55204 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/quick/items/qquickopenglshadereffectnode.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/items/qquickopenglshadereffectnode.cpp b/src/quick/items/qquickopenglshadereffectnode.cpp
index 7bbed42a6f..9222cabf49 100644
--- a/src/quick/items/qquickopenglshadereffectnode.cpp
+++ b/src/quick/items/qquickopenglshadereffectnode.cpp
@@ -120,10 +120,13 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri
: QQuickShaderEffect::Error);
}
+ if (newEffect != oldEffect)
+ m_initialized = false;
+
int textureProviderIndex = 0;
if (!m_initialized) {
for (int shaderType = 0; shaderType < QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
- Q_ASSERT(m_uniformLocs[shaderType].isEmpty());
+ m_uniformLocs[shaderType].clear();
m_uniformLocs[shaderType].reserve(material->uniforms[shaderType].size());
for (int i = 0; i < material->uniforms[shaderType].size(); ++i) {
const UniformData &d = material->uniforms[shaderType].at(i);