From 9774757312cc75e4f49bd14a7729a9fdfb4456ae Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 8 Dec 2016 13:14:03 +0100 Subject: particles: Fix up 16k warnings and apply them on non-ES too The isOpenGLES() condition is plain wrong: the code always uses ushort as the index type. Change-Id: Ibc5989227f61201913ff124485df4890b3490db5 Task-number: QTBUG-57515 Reviewed-by: Robin Burchell --- src/particles/qquickcustomparticle.cpp | 9 ++++++--- src/particles/qquickimageparticle.cpp | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/particles') diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp index c08ae3d9ff..babf13a93c 100644 --- a/src/particles/qquickcustomparticle.cpp +++ b/src/particles/qquickcustomparticle.cpp @@ -40,6 +40,7 @@ #include "qquickcustomparticle_p.h" #include #include +#include #include QT_BEGIN_NAMESPACE @@ -90,6 +91,7 @@ struct PlainVertices { \brief For specifying shaders to paint particles \ingroup qtquick-particles + \note The maximum number of custom particles is limited to 16383. */ QQuickCustomParticle::QQuickCustomParticle(QQuickItem* parent) @@ -316,13 +318,14 @@ QQuickOpenGLShaderEffectNode* QQuickCustomParticle::buildCustomNodes() if (!QOpenGLContext::currentContext()) return 0; - if (QOpenGLContext::currentContext()->isOpenGLES() && m_count * 4 > 0xffff) { - printf("CustomParticle: Too many particles... \n"); + if (m_count * 4 > 0xffff) { + // Index data is ushort. + qmlInfo(this) << "CustomParticle: Too many particles - maximum 16383 per CustomParticle"; return 0; } if (m_count <= 0) { - printf("CustomParticle: Too few particles... \n"); + qmlInfo(this) << "CustomParticle: Too few particles"; return 0; } diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index e6b921792f..60cbf6175d 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -510,6 +510,8 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) So if you explicitly set an attribute affecting color, such as redVariation, and then reset it (by setting redVariation to undefined), all color data will be reset and it will begin to have an implicit value of any shared color from other ImageParticles. + + \note The maximum number of image particles is limited to 16383. */ /*! \qmlproperty url QtQuick.Particles::ImageParticle::source @@ -1240,8 +1242,9 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) if (!QOpenGLContext::currentContext()) return; - if (QOpenGLContext::currentContext()->isOpenGLES() && m_count * 4 > 0xffff) { - printf("ImageParticle: Too many particles - maximum 16,000 per ImageParticle.\n");//ES 2 vertex count limit is ushort + if (m_count * 4 > 0xffff) { + // Index data is ushort. + qmlInfo(this) << "ImageParticle: Too many particles - maximum 16383 per ImageParticle"; return; } -- cgit v1.2.3