diff options
-rw-r--r-- | src/quick/scenegraph/qsgrhishadereffectnode.cpp | 8 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrhishadereffectnode_p.h | 3 |
2 files changed, 9 insertions, 2 deletions
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<int> *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 diff --git a/src/quick/scenegraph/qsgrhishadereffectnode_p.h b/src/quick/scenegraph/qsgrhishadereffectnode_p.h index fb98bbf10e..08f1af9f6e 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode_p.h +++ b/src/quick/scenegraph/qsgrhishadereffectnode_p.h @@ -89,6 +89,7 @@ public: QHash<uint, Constant> m_constants; // offset -> Constant QHash<int, QVariant> m_samplers; // binding -> value (source ref) QHash<QByteArray, int> m_samplerNameMap; // name -> binding + QSet<int> m_subRectBindings; }; QDebug operator<<(QDebug debug, const QSGRhiShaderLinker::Constant &c); @@ -105,6 +106,8 @@ public: void updateTextureProviders(bool layoutChange); + bool usesSubRectUniform(int binding) const { return m_linker.m_subRectBindings.contains(binding); } + static const int MAX_BINDINGS = 32; QSGRhiShaderEffectNode *m_node; |