diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-12-08 13:14:03 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-12-21 20:31:56 +0000 |
commit | 9774757312cc75e4f49bd14a7729a9fdfb4456ae (patch) | |
tree | 7c1e6687c721a06da5ec0a34461e4800fe34bcbe /src/particles | |
parent | 42c52e6f2d9002e8191ada765d8a2509c7fae71b (diff) |
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 <robin.burchell@viroteck.net>
Diffstat (limited to 'src/particles')
-rw-r--r-- | src/particles/qquickcustomparticle.cpp | 9 | ||||
-rw-r--r-- | src/particles/qquickimageparticle.cpp | 7 |
2 files changed, 11 insertions, 5 deletions
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 <QtQuick/private/qquickshadereffectmesh_p.h> #include <QtQuick/private/qsgshadersourcebuilder_p.h> +#include <QtQml/qqmlinfo.h> #include <cstdlib> 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; } |