From 84e87fd38e7cff31b88abc52d774299890545b92 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 20 May 2020 15:40:33 +0200 Subject: Don't detach from atlas when using qt_SubRect_foo Fixes: QTBUG-84299 Change-Id: Ib1c73ae5e7f5df8d4390d33ce0e61c06b052cd59 Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/qsgrhishadereffectnode.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/quick/scenegraph/qsgrhishadereffectnode.cpp') diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp index 5d3b158de8..0508ae9c7a 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp +++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp @@ -62,6 +62,7 @@ void QSGRhiShaderLinker::reset(const QShader &vs, const QShader &fs) m_constants.clear(); m_samplers.clear(); m_samplerNameMap.clear(); + m_subRectBindings.clear(); } void QSGRhiShaderLinker::feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet *dirtyIndices) @@ -140,7 +141,9 @@ void QSGRhiShaderLinker::linkTextureSubRects() const QByteArray name = c.value.toByteArray(); if (!m_samplerNameMap.contains(name)) qWarning("ShaderEffect: qt_SubRect_%s refers to unknown source texture", name.constData()); - c.value = m_samplerNameMap[name]; + const int binding = m_samplerNameMap[name]; + c.value = binding; + m_subRectBindings.insert(binding); } } } @@ -394,7 +397,8 @@ void QSGRhiShaderEffectMaterialShader::updateSampledImage(RenderState &state, in if (tp) { if (QSGTexture *t = tp->texture()) { t->commitTextureOperations(state.rhi(), state.resourceUpdateBatch()); - if (t->isAtlasTexture() && !mat->m_geometryUsesTextureSubRect) { + + if (t->isAtlasTexture() && !mat->m_geometryUsesTextureSubRect && !mat->usesSubRectUniform(binding)) { // Why the hassle with the batch: while removedFromAtlas() is // able to operate with its own resource update batch (which is // then committed immediately), that approach is wrong when the -- cgit v1.2.3