Avoid SIOF inside Asset system
Bigfoot / Sonarqube (toolmode) (push) Skipped
Bigfoot / Sonarqube (game) (push) Skipped
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m1s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 1m7s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m37s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m33s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m6s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m10s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 48s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 2m11s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m51s
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m7s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: game) (push) Successful in 44s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 48s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 2m7s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 2m12s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m43s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m49s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m1s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m17s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: game) (push) Successful in 47s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m43s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m27s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: game) (push) Successful in 45s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 2m16s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m43s
Bigfoot / Clang Format Checks (push) Successful in 9s
Bigfoot / Sonarqube (toolmode) (push) Skipped
Bigfoot / Sonarqube (game) (push) Skipped
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m1s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 1m7s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 1m37s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m33s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m6s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m10s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 48s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 2m11s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m51s
Bigfoot / Build & Test Debug with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m7s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: game) (push) Successful in 44s
Bigfoot / Build & Test Debug with clang (Unity Build: ON, Variant: toolmode) (push) Successful in 48s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: game) (push) Successful in 2m7s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 2m12s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m43s
Bigfoot / Build & Test Debug with clang_asan (Unity Build: ON, Variant: toolmode) (push) Successful in 1m49s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: game) (push) Successful in 1m1s
Bigfoot / Build & Test Release with clang (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m17s
Bigfoot / Build & Test Release with clang (Unity Build: ON, Variant: game) (push) Successful in 47s
Bigfoot / Build & Test Release with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 1m43s
Bigfoot / Build & Test Release with clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m27s
Bigfoot / Build & Test RelWithDebInfo with clang (Unity Build: ON, Variant: game) (push) Successful in 45s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: OFF, Variant: toolmode) (push) Successful in 2m16s
Bigfoot / Build & Test RelWithDebInfo with clang_asan (Unity Build: ON, Variant: game) (push) Successful in 1m43s
Bigfoot / Clang Format Checks (push) Successful in 9s
This commit is contained in:
@@ -36,7 +36,7 @@ class ReferenceFixture: public benchmark::Fixture
|
||||
|
||||
void TearDown(benchmark::State&) override
|
||||
{
|
||||
SetActiveAssetLibrary(&g_assetLibrary);
|
||||
SetActiveAssetLibrary(g_assetLibrary);
|
||||
}
|
||||
|
||||
AssetLibrary m_library;
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
return AssetType::GetTypeID(); \
|
||||
} \
|
||||
AssetContainer<AssetType> g_containerFor##AssetName; \
|
||||
const bool g_insertedContainerFor##AssetName = []() \
|
||||
bool RegisterAssetContainerFor##AssetName() \
|
||||
{ \
|
||||
const bool inserted = g_assetLibrary.Insert(&g_containerFor##AssetName); \
|
||||
const bool inserted = g_assetLibrary->Insert(&g_containerFor##AssetName); \
|
||||
CRITICAL_ASSERT(EngineAssertHandler, \
|
||||
inserted, \
|
||||
"AssetTypeID collision or duplicate registration for asset type '" #AssetName "'"); \
|
||||
return inserted; \
|
||||
}(); \
|
||||
} \
|
||||
const bool g_insertedContainerFor##AssetName = RegisterAssetContainerFor##AssetName(); \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <Engine/Asset/AssetContainer.hpp>
|
||||
#include <Engine/Asset/AssetTypeID.hpp>
|
||||
|
||||
#include <Utils/LazyGlobal.hpp>
|
||||
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
namespace Bigfoot
|
||||
@@ -109,8 +111,44 @@ class AssetLibrary
|
||||
/****************************************************************************************/
|
||||
|
||||
// The global asset library for Bigfoot
|
||||
inline AssetLibrary g_assetLibrary;
|
||||
inline AssetLibrary* g_activeAssetLibrary = &g_assetLibrary;
|
||||
inline LazyGlobal<AssetLibrary> g_assetLibrary;
|
||||
|
||||
class ActiveAssetLibrary
|
||||
{
|
||||
public:
|
||||
ActiveAssetLibrary& operator=(AssetLibrary* p_assetLibrary)
|
||||
{
|
||||
Get() = p_assetLibrary;
|
||||
return *this;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
AssetLibrary* operator->() const
|
||||
{
|
||||
return Get();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
operator AssetLibrary*() const
|
||||
{
|
||||
return Get();
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Get the ActiveAssetLibrary
|
||||
*
|
||||
* \return The ActiveAssetLibrary
|
||||
*/
|
||||
[[nodiscard]]
|
||||
static AssetLibrary*& Get()
|
||||
{
|
||||
static AssetLibrary* activeLibrary = g_assetLibrary;
|
||||
return activeLibrary;
|
||||
}
|
||||
};
|
||||
|
||||
inline ActiveAssetLibrary g_activeAssetLibrary;
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class AssetFixture: public ::testing::Test
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
SetActiveAssetLibrary(&g_assetLibrary);
|
||||
SetActiveAssetLibrary(g_assetLibrary);
|
||||
}
|
||||
|
||||
AssetLibrary m_library;
|
||||
|
||||
@@ -244,18 +244,18 @@ TEST_F(AssetLibraryFixture, SetActiveAssetLibrary_ShouldSetTheActiveAssetLibrary
|
||||
{
|
||||
SetActiveAssetLibrary(&m_library);
|
||||
EXPECT_EQ(g_activeAssetLibrary, &m_library);
|
||||
SetActiveAssetLibrary(&g_assetLibrary);
|
||||
SetActiveAssetLibrary(g_assetLibrary);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetLibraryFixture, ScopedActiveAssetLibrary_ShouldChangeTheActiveAssetLibraryInAScopedWay)
|
||||
{
|
||||
EXPECT_EQ(g_activeAssetLibrary, &g_assetLibrary);
|
||||
EXPECT_EQ(g_activeAssetLibrary, g_assetLibrary);
|
||||
{
|
||||
ScopedActiveAssetLibrary activeAssetLibraryScoped {&m_library};
|
||||
EXPECT_EQ(g_activeAssetLibrary, &m_library);
|
||||
}
|
||||
EXPECT_EQ(g_activeAssetLibrary, &g_assetLibrary);
|
||||
EXPECT_EQ(g_activeAssetLibrary, g_assetLibrary);
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
|
||||
@@ -49,7 +49,7 @@ class ReferenceFixture: public ::testing::Test
|
||||
|
||||
void TearDown() override
|
||||
{
|
||||
SetActiveAssetLibrary(&g_assetLibrary);
|
||||
SetActiveAssetLibrary(g_assetLibrary);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
|
||||
@@ -111,7 +111,7 @@ class SerializationManagerFixture: public ::testing::Test
|
||||
void TearDown() override
|
||||
{
|
||||
SetDataAccessor(m_previousDataAccessor);
|
||||
SetActiveAssetLibrary(&g_assetLibrary);
|
||||
SetActiveAssetLibrary(g_assetLibrary);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user