Fix video nodes material comparison.

Don't consider a material equal to another when their texture IDs
are not available yet.

Change-Id: Id4127d71abb2db33950a206dc722b24ab626e960
Task-number: QTBUG-47205
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Yoann Lopes
2015-07-17 11:37:02 +02:00
parent 9ae70447d5
commit f25034afaf
3 changed files with 11 additions and 0 deletions

View File

@@ -145,6 +145,10 @@ public:
virtual int compare(const QSGMaterial *other) const { virtual int compare(const QSGMaterial *other) const {
const QSGVideoMaterial_RGB *m = static_cast<const QSGVideoMaterial_RGB *>(other); const QSGVideoMaterial_RGB *m = static_cast<const QSGVideoMaterial_RGB *>(other);
if (!m_textureId)
return 1;
return m_textureId - m->m_textureId; return m_textureId - m->m_textureId;
} }

View File

@@ -138,6 +138,10 @@ public:
virtual int compare(const QSGMaterial *other) const { virtual int compare(const QSGMaterial *other) const {
const QSGVideoMaterial_Texture *m = static_cast<const QSGVideoMaterial_Texture *>(other); const QSGVideoMaterial_Texture *m = static_cast<const QSGVideoMaterial_Texture *>(other);
if (!m_textureId)
return 1;
int diff = m_textureId - m->m_textureId; int diff = m_textureId - m->m_textureId;
if (diff) if (diff)
return diff; return diff;

View File

@@ -171,6 +171,9 @@ public:
virtual int compare(const QSGMaterial *other) const { virtual int compare(const QSGMaterial *other) const {
const QSGVideoMaterial_YUV *m = static_cast<const QSGVideoMaterial_YUV *>(other); const QSGVideoMaterial_YUV *m = static_cast<const QSGVideoMaterial_YUV *>(other);
if (!m_textureIds[0])
return 1;
int d = m_textureIds[0] - m->m_textureIds[0]; int d = m_textureIds[0] - m->m_textureIds[0];
if (d) if (d)
return d; return d;