From f9962b0db5072870864a1f758687106139f740dc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 25 Feb 2025 00:23:11 +0000 Subject: Improve Terrain::generateMeshes performance 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. --- test/Jamfile.jam | 1 + test/perf-terrain.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/perf-terrain.cpp (limited to 'test') 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 ] : test ; run perf-assetFactory.cpp : \< : test-assetFactory : benchmark test ; run perf-geoData.cpp : \< : test-geoData : test benchmark ; +run perf-terrain.cpp : \< : test-geoData : test benchmark ; run perf-persistence.cpp : \< : test-persistence : benchmark test ; run test-worker.cpp ; run test-instancing.cpp : -- : test-glContainer : 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 + +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(); -- cgit v1.2.3