summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-02-25 00:23:11 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-02-25 00:23:11 +0000
commitf9962b0db5072870864a1f758687106139f740dc (patch)
treeae1b05395de5c07164151ef7fc7de202be19b9f0 /test
parentAdd VertexArrayObject::data for an external existing buffer (diff)
downloadilt-f9962b0db5072870864a1f758687106139f740dc.tar.bz2
ilt-f9962b0db5072870864a1f758687106139f740dc.tar.xz
ilt-f9962b0db5072870864a1f758687106139f740dc.zip
Improve Terrain::generateMeshes performanceHEADmain
Creates mesh per surface based on a single buffer of all vertices and a collection of per surfuce indices. Makes ColourBias a uniform instead of a vertex attribute.
Diffstat (limited to 'test')
-rw-r--r--test/Jamfile.jam1
-rw-r--r--test/perf-terrain.cpp20
2 files changed, 21 insertions, 0 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index c5c49d2..8219398 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -57,6 +57,7 @@ run test-glContextBhvr.cpp ;
run test-assetFactory.cpp : -- : [ sequence.insertion-sort [ glob-tree $(res) : *.* ] fixtures/rgb.txt test-instancing ] : <library>test ;
run perf-assetFactory.cpp : \< : test-assetFactory : <library>benchmark <library>test ;
run perf-geoData.cpp : \< : test-geoData : <library>test <library>benchmark ;
+run perf-terrain.cpp : \< : test-geoData : <library>test <library>benchmark ;
run perf-persistence.cpp : \< : test-persistence : <library>benchmark <library>test ;
run test-worker.cpp ;
run test-instancing.cpp : -- : test-glContainer : <library>test ;
diff --git a/test/perf-terrain.cpp b/test/perf-terrain.cpp
new file mode 100644
index 0000000..dbd44fa
--- /dev/null
+++ b/test/perf-terrain.cpp
@@ -0,0 +1,20 @@
+#include "game/terrain.h"
+#include "testMainWindow.h"
+#include <benchmark/benchmark.h>
+
+namespace {
+ void
+ terrainMeshgen(benchmark::State & state)
+ {
+ TestMainWindowAppBase window;
+ Terrain terrain {GeoData::loadFromAsciiGrid(FIXTURESDIR "height/SD19.asc")};
+
+ for (auto _ : state) {
+ terrain.generateMeshes();
+ }
+ }
+}
+
+BENCHMARK(terrainMeshgen);
+
+BENCHMARK_MAIN();