diff options
author | Kaj Grönholm <kaj.gronholm@qt.io> | 2020-11-06 12:56:36 +0200 |
---|---|---|
committer | Kaj Grönholm <kaj.gronholm@qt.io> | 2020-11-09 19:35:40 +0200 |
commit | ebe36705223d00bfe92c7b8fc391e97895ba1155 (patch) | |
tree | fffaa9c2ca30454cd3155447c11452d755b0622f /tests | |
parent | 1df1167ff1226637cf659debaa3296f03f4a3994 (diff) |
Optimize particles vertex data
Use uchar instead of float for vertex data that doesn't need float.
Continue using floats in shaders. Also remove animY2, which is same as
animY1. These changes reduce memory usage especially when the amount
of particles increases.
Testing on windows, memory reductions with emitters/trailemitter
example were:
- OpenGL: 82.7 MB -> 76.5 MB
- Vulkan: 130.8 MB -> 126.3 MB
- D3D11: 143.7 MB -> 135.8 MB
Task-number: QTBUG-88124
Change-Id: I8f8dcb3845323b0e69fb99b5bff830cd0f151a47
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp | 2 | ||||
-rw-r--r-- | tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp index cad3813e92..b213f54007 100644 --- a/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp +++ b/tests/auto/particles/qquickcustomaffector/tst_qquickcustomaffector.cpp @@ -75,7 +75,7 @@ void tst_qquickcustomaffector::test_basic() QCOMPARE(d->lifeSpan, 0.5f); QCOMPARE(d->size, 100.f); QCOMPARE(d->endSize, 100.f); - QCOMPARE(d->autoRotate, 1.f); + QCOMPARE(d->autoRotate, (uchar)1); QCOMPARE(d->color.r, (uchar)0); QCOMPARE(d->color.g, (uchar)255); QCOMPARE(d->color.b, (uchar)0); diff --git a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp index 7e07878d39..736c188991 100644 --- a/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp +++ b/tests/auto/particles/qquickimageparticle/tst_qquickimageparticle.cpp @@ -96,7 +96,7 @@ void tst_qquickimageparticle::test_basic() QCOMPARE(d->yx, 0.0f); QCOMPARE(d->rotation, 0.0f); QCOMPARE(d->rotationVelocity, 0.0f); - QCOMPARE(d->autoRotate, 0.0f); + QCOMPARE(d->autoRotate, (uchar)0); QCOMPARE(d->animX, 0.0f); QCOMPARE(d->animY, 0.0f); QCOMPARE(d->animWidth, 1.0f); @@ -140,7 +140,7 @@ void tst_qquickimageparticle::test_colored() QCOMPARE(d->yx, 0.0f); QCOMPARE(d->rotation, 0.0f); QCOMPARE(d->rotationVelocity, 0.0f); - QCOMPARE(d->autoRotate, 0.0f); + QCOMPARE(d->autoRotate, (uchar)0); QCOMPARE(d->animX, 0.0f); QCOMPARE(d->animY, 0.0f); QCOMPARE(d->animWidth, 1.0f); @@ -185,7 +185,7 @@ void tst_qquickimageparticle::test_colorVariance() QCOMPARE(d->yx, 0.0f); QCOMPARE(d->rotation, 0.0f); QCOMPARE(d->rotationVelocity, 0.0f); - QCOMPARE(d->autoRotate, 0.0f); + QCOMPARE(d->autoRotate, (uchar)0); QCOMPARE(d->animX, 0.0f); QCOMPARE(d->animY, 0.0f); QCOMPARE(d->animWidth, 1.0f); @@ -229,7 +229,7 @@ void tst_qquickimageparticle::test_deformed() QCOMPARE(d->yx, 0.5f); QCOMPARE(d->rotation, 90.0f * (float)CONV_FACTOR); QCOMPARE(d->rotationVelocity, 90.0f * (float)CONV_FACTOR); - QCOMPARE(d->autoRotate, 1.0f); + QCOMPARE(d->autoRotate, (uchar)1); QCOMPARE(d->animX, 0.0f); QCOMPARE(d->animY, 0.0f); QCOMPARE(d->animWidth, 1.0f); @@ -273,7 +273,7 @@ void tst_qquickimageparticle::test_tabled() QCOMPARE(d->yx, 0.0f); QCOMPARE(d->rotation, 0.0f); QCOMPARE(d->rotationVelocity, 0.0f); - QCOMPARE(d->autoRotate, 0.0f); + QCOMPARE(d->autoRotate, (uchar)0); QCOMPARE(d->animX, 0.0f); QCOMPARE(d->animY, 0.0f); QCOMPARE(d->animWidth, 1.0f); @@ -318,7 +318,7 @@ void tst_qquickimageparticle::test_sprite() QCOMPARE(d->yx, 0.0f); QCOMPARE(d->rotation, 0.0f); QCOMPARE(d->rotationVelocity, 0.0f); - QCOMPARE(d->autoRotate, 0.0f); + QCOMPARE(d->autoRotate, (uchar)0); QVERIFY(myFuzzyCompare(d->frameDuration, 120.f)); QCOMPARE(d->frameCount, 6.0f); QVERIFY(d->animT > 0.0f); |