From 97a05efebe08e19893f6b1161a7e058de349aacc Mon Sep 17 00:00:00 2001 From: sean Date: Sat, 10 Feb 2024 15:51:47 +0100 Subject: [PATCH] Remove operator=(Asset&&) --- include/fastgltf/types.hpp | 30 +----------------------------- tests/benchmarks.cpp | 16 ++++------------ 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/include/fastgltf/types.hpp b/include/fastgltf/types.hpp index d2ee7c837..c2e149314 100644 --- a/include/fastgltf/types.hpp +++ b/include/fastgltf/types.hpp @@ -1935,10 +1935,6 @@ namespace fastgltf { Optional sparse; FASTGLTF_STD_PMR_NS::string name; - - explicit Accessor() = default; - Accessor(const Accessor& accessor) = default; - Accessor(Accessor&& accessor) noexcept = default; }; struct CompressedBufferView { @@ -2059,31 +2055,7 @@ namespace fastgltf { availableCategories(other.availableCategories) {} Asset& operator=(const Asset& other) = delete; - Asset& operator=(Asset&& other) noexcept { -#if !FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL - memoryResource = std::move(other.memoryResource); -#endif - assetInfo = std::move(other.assetInfo); - extensionsUsed = std::move(other.extensionsUsed); - extensionsRequired = std::move(other.extensionsRequired); - defaultScene = other.defaultScene; - accessors = std::move(other.accessors); - animations = std::move(other.animations); - buffers = std::move(other.buffers); - bufferViews = std::move(other.bufferViews); - cameras = std::move(other.cameras); - images = std::move(other.images); - lights = std::move(other.lights); - materials = std::move(other.materials); - meshes = std::move(other.meshes); - nodes = std::move(other.nodes); - samplers = std::move(other.samplers); - scenes = std::move(other.scenes); - skins = std::move(other.skins); - textures = std::move(other.textures); - availableCategories = other.availableCategories; - return *this; - } + Asset& operator=(Asset&& other) noexcept = delete; }; #pragma endregion } // namespace fastgltf diff --git a/tests/benchmarks.cpp b/tests/benchmarks.cpp index cd695c394..1859622cd 100644 --- a/tests/benchmarks.cpp +++ b/tests/benchmarks.cpp @@ -106,10 +106,8 @@ TEST_CASE("Benchmark loading of NewSponza", "[gltf-benchmark]") { auto jsonData = std::make_unique(); REQUIRE(jsonData->fromByteView(bytes.data(), bytes.size() - fastgltf::getGltfBufferPadding(), bytes.size())); - // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too. - fastgltf::Expected asset(fastgltf::Error::None); BENCHMARK("Parse NewSponza") { - asset = parser.loadGltfJson(jsonData.get(), intelSponza, benchmarkOptions); + return parser.loadGltfJson(jsonData.get(), intelSponza, benchmarkOptions); }; #ifdef HAS_TINYGLTF @@ -158,10 +156,8 @@ TEST_CASE("Benchmark base64 decoding from glTF file", "[gltf-benchmark]") { auto jsonData = std::make_unique(); REQUIRE(jsonData->fromByteView(bytes.data(), bytes.size() - fastgltf::getGltfBufferPadding(), bytes.size())); - // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too. - fastgltf::Expected asset(fastgltf::Error::None); BENCHMARK("Parse 2CylinderEngine and decode base64") { - asset = parser.loadGltfJson(jsonData.get(), cylinderEngine, benchmarkOptions); + return parser.loadGltfJson(jsonData.get(), cylinderEngine, benchmarkOptions); }; #ifdef HAS_TINYGLTF @@ -214,10 +210,8 @@ TEST_CASE("Benchmark raw JSON parsing", "[gltf-benchmark]") { auto jsonData = std::make_unique(); REQUIRE(jsonData->fromByteView(bytes.data(), bytes.size() - fastgltf::getGltfBufferPadding(), bytes.size())); - // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too. - fastgltf::Expected asset(fastgltf::Error::None); BENCHMARK("Parse Buggy.gltf") { - asset = parser.loadGltfJson(jsonData.get(), buggyPath, benchmarkOptions); + return parser.loadGltfJson(jsonData.get(), buggyPath, benchmarkOptions); }; #ifdef HAS_TINYGLTF @@ -271,10 +265,8 @@ TEST_CASE("Benchmark massive gltf file", "[gltf-benchmark]") { auto jsonData = std::make_unique(); REQUIRE(jsonData->fromByteView(bytes.data(), bytes.size() - fastgltf::getGltfBufferPadding(), bytes.size())); - // Extract this from the benchmark loop, as otherwise we benchmark the asset destruction/deallocation too. - fastgltf::Expected asset(fastgltf::Error::None); BENCHMARK("Parse Bistro") { - asset = parser.loadGltfJson(jsonData.get(), bistroPath, benchmarkOptions); + return parser.loadGltfJson(jsonData.get(), bistroPath, benchmarkOptions); }; #ifdef HAS_TINYGLTF