Fix fading node when one textured is atlassed.

source and target were swapped in both the QSGNode::updateState/bind
and in the fragment shader.

When Atlas support was added, the texture position was put the right way
round; which made things backwards so source/target also got swapped
instead of fixed properly.

But this leads a glitch if one texture was in the atlas and one
wasn't (not common)

This puts everything the right way round again.

Reviewed-by: Kai Broulik
This commit is contained in:
David Edmundson 2018-07-10 10:11:47 +02:00
parent 0351ea74b2
commit bd6d332fe7

View File

@ -62,19 +62,19 @@ QList<QByteArray> FadingMaterialShader::attributes() const
void FadingMaterialShader::updateState(const FadingMaterialState* newState, const FadingMaterialState* oldState)
{
if (!oldState || oldState->source != newState->source) {
glFuncs->glActiveTexture(GL_TEXTURE1);
glFuncs->glActiveTexture(GL_TEXTURE0);
newState->source->bind();
QRectF rect = newState->source->normalizedTextureSubRect();
program()->setUniformValue(m_sourceRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height()));
// reset the active texture back to 0 after we changed it to something else
glFuncs->glActiveTexture(GL_TEXTURE0);
}
if (!oldState || oldState->target != newState->target) {
glFuncs->glActiveTexture(GL_TEXTURE0);
glFuncs->glActiveTexture(GL_TEXTURE1);
newState->target->bind();
QRectF rect = newState->target->normalizedTextureSubRect();
program()->setUniformValue(m_targetRectId, QVector4D(rect.x(), rect.y(), rect.width(), rect.height()));
// reset the active texture back to 0 after we changed it to something else
glFuncs->glActiveTexture(GL_TEXTURE0);
}
if (!oldState || oldState->progress != newState->progress) {