@@ -106,10 +106,8 @@ TEST_CASE("Benchmark loading of NewSponza", "[gltf-benchmark]") {
106
106
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
107
107
REQUIRE (jsonData->fromByteView (bytes.data (), bytes.size () - fastgltf::getGltfBufferPadding (), bytes.size ()));
108
108
109
- // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too.
110
- fastgltf::Expected<fastgltf::Asset> asset (fastgltf::Error::None);
111
109
BENCHMARK (" Parse NewSponza" ) {
112
- asset = parser.loadGltfJson (jsonData.get (), intelSponza, benchmarkOptions);
110
+ return parser.loadGltfJson (jsonData.get (), intelSponza, benchmarkOptions);
113
111
};
114
112
115
113
#ifdef HAS_TINYGLTF
@@ -158,10 +156,8 @@ TEST_CASE("Benchmark base64 decoding from glTF file", "[gltf-benchmark]") {
158
156
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
159
157
REQUIRE (jsonData->fromByteView (bytes.data (), bytes.size () - fastgltf::getGltfBufferPadding (), bytes.size ()));
160
158
161
- // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too.
162
- fastgltf::Expected<fastgltf::Asset> asset (fastgltf::Error::None);
163
159
BENCHMARK (" Parse 2CylinderEngine and decode base64" ) {
164
- asset = parser.loadGltfJson (jsonData.get (), cylinderEngine, benchmarkOptions);
160
+ return parser.loadGltfJson (jsonData.get (), cylinderEngine, benchmarkOptions);
165
161
};
166
162
167
163
#ifdef HAS_TINYGLTF
@@ -214,10 +210,8 @@ TEST_CASE("Benchmark raw JSON parsing", "[gltf-benchmark]") {
214
210
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
215
211
REQUIRE (jsonData->fromByteView (bytes.data (), bytes.size () - fastgltf::getGltfBufferPadding (), bytes.size ()));
216
212
217
- // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too.
218
- fastgltf::Expected<fastgltf::Asset> asset (fastgltf::Error::None);
219
213
BENCHMARK (" Parse Buggy.gltf" ) {
220
- asset = parser.loadGltfJson (jsonData.get (), buggyPath, benchmarkOptions);
214
+ return parser.loadGltfJson (jsonData.get (), buggyPath, benchmarkOptions);
221
215
};
222
216
223
217
#ifdef HAS_TINYGLTF
@@ -271,10 +265,8 @@ TEST_CASE("Benchmark massive gltf file", "[gltf-benchmark]") {
271
265
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
272
266
REQUIRE (jsonData->fromByteView (bytes.data (), bytes.size () - fastgltf::getGltfBufferPadding (), bytes.size ()));
273
267
274
- // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too.
275
- fastgltf::Expected<fastgltf::Asset> asset (fastgltf::Error::None);
276
268
BENCHMARK (" Parse Bistro" ) {
277
- asset = parser.loadGltfJson (jsonData.get (), bistroPath, benchmarkOptions);
269
+ return parser.loadGltfJson (jsonData.get (), bistroPath, benchmarkOptions);
278
270
};
279
271
280
272
#ifdef HAS_TINYGLTF
0 commit comments