Skip to content

Commit

Permalink
Remove operator=(Asset&&)
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Feb 10, 2024
1 parent 71db731 commit 97a05ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
30 changes: 1 addition & 29 deletions include/fastgltf/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,10 +1935,6 @@ namespace fastgltf {
Optional<SparseAccessor> sparse;

FASTGLTF_STD_PMR_NS::string name;

explicit Accessor() = default;
Accessor(const Accessor& accessor) = default;
Accessor(Accessor&& accessor) noexcept = default;
};

struct CompressedBufferView {
Expand Down Expand Up @@ -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
Expand Down
16 changes: 4 additions & 12 deletions tests/benchmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ TEST_CASE("Benchmark loading of NewSponza", "[gltf-benchmark]") {
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
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<fastgltf::Asset> asset(fastgltf::Error::None);
BENCHMARK("Parse NewSponza") {
asset = parser.loadGltfJson(jsonData.get(), intelSponza, benchmarkOptions);
return parser.loadGltfJson(jsonData.get(), intelSponza, benchmarkOptions);
};

#ifdef HAS_TINYGLTF
Expand Down Expand Up @@ -158,10 +156,8 @@ TEST_CASE("Benchmark base64 decoding from glTF file", "[gltf-benchmark]") {
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
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<fastgltf::Asset> 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
Expand Down Expand Up @@ -214,10 +210,8 @@ TEST_CASE("Benchmark raw JSON parsing", "[gltf-benchmark]") {
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
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<fastgltf::Asset> 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
Expand Down Expand Up @@ -271,10 +265,8 @@ TEST_CASE("Benchmark massive gltf file", "[gltf-benchmark]") {
auto jsonData = std::make_unique<fastgltf::GltfDataBuffer>();
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<fastgltf::Asset> asset(fastgltf::Error::None);
BENCHMARK("Parse Bistro") {
asset = parser.loadGltfJson(jsonData.get(), bistroPath, benchmarkOptions);
return parser.loadGltfJson(jsonData.get(), bistroPath, benchmarkOptions);
};

#ifdef HAS_TINYGLTF
Expand Down

0 comments on commit 97a05ef

Please sign in to comment.