aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickcustomparticle.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-02-03 17:36:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-18 21:00:00 +0100
commita2e92f6dee12320a58a4bcc95c14649b27804427 (patch)
tree3198365f9f7ca75cc3c4bd23340bb5fe15ee63a5 /src/particles/qquickcustomparticle.cpp
parent337524714cad51934879d817564c5d58e6dbd0c0 (diff)
Dynamic GL in Quick
The counterpart to I716fdebb. Implements the dynamic path in scenegraph. Task-number: QTBUG-36483 Change-Id: I2dc613ba84560b7b8e36d3cd1da61c050ab08db0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/particles/qquickcustomparticle.cpp')
-rw-r--r--src/particles/qquickcustomparticle.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp
index a3b41d0eb2..c112283822 100644
--- a/src/particles/qquickcustomparticle.cpp
+++ b/src/particles/qquickcustomparticle.cpp
@@ -269,6 +269,8 @@ QQuickShaderEffectNode *QQuickCustomParticle::prepareNextFrame(QQuickShaderEffec
return 0;
if (m_dirtyProgram) {
+ const bool isES = QOpenGLContext::currentContext()->isES();
+
QQuickShaderEffectMaterial *material = static_cast<QQuickShaderEffectMaterial *>(rootNode->material());
Q_ASSERT(material);
@@ -276,17 +278,16 @@ QQuickShaderEffectNode *QQuickCustomParticle::prepareNextFrame(QQuickShaderEffec
QSGShaderSourceBuilder builder;
if (s.sourceCode[Key::FragmentShader].isEmpty()) {
builder.appendSourceFile(QStringLiteral(":/particles/shaders/customparticle.frag"));
-#if defined(QT_OPENGL_ES_2)
- builder.removeVersion();
-#endif
+ if (isES)
+ builder.removeVersion();
s.sourceCode[Key::FragmentShader] = builder.source();
builder.clear();
}
builder.appendSourceFile(QStringLiteral(":/particles/shaders/customparticletemplate.vert"));
-#if defined(QT_OPENGL_ES_2)
- builder.removeVersion();
-#endif
+ if (isES)
+ builder.removeVersion();
+
if (s.sourceCode[Key::VertexShader].isEmpty())
builder.appendSourceFile(QStringLiteral(":/particles/shaders/customparticle.vert"));
s.sourceCode[Key::VertexShader] = builder.source() + s.sourceCode[Key::VertexShader];
@@ -310,12 +311,10 @@ QQuickShaderEffectNode *QQuickCustomParticle::prepareNextFrame(QQuickShaderEffec
QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
{
-#ifdef QT_OPENGL_ES_2
- if (m_count * 4 > 0xffff) {
+ if (QOpenGLContext::currentContext()->isES() && m_count * 4 > 0xffff) {
printf("CustomParticle: Too many particles... \n");
return 0;
}
-#endif
if (m_count <= 0) {
printf("CustomParticle: Too few particles... \n");