Pass through issues reported by sonarqube
Bigfoot / Sonarqube (push) Skipped
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Failing after 21s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Failing after 26s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Failing after 26s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Failing after 17s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 26s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 19s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 27s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Failing after 28s
Bigfoot / Build & Test Debug with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Failing after 24s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Failing after 29s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Failing after 26s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Failing after 30s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Failing after 30s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Failing after 35s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: game) (push) Canceled after 0s
Bigfoot / Build & Test Release with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: ON, Variant: toolmode) (push) Canceled after 0s
Bigfoot / Clang Format Checks (push) Canceled after 0s
Bigfoot / Sonarqube (pull_request) Canceled after 0s
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/host/clang_asan (Unity Build: OFF, Variant: toolmode) (push) Canceled after 13s

This commit is contained in:
2026-09-01 17:56:56 +02:00
parent 8392245b10
commit e07830afef
45 changed files with 670 additions and 353 deletions
+4 -1
View File
@@ -11,9 +11,12 @@ Checks: >
portability-*, portability-*,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-modernize-use-auto,
-readability-avoid-const-params-in-decls, -readability-avoid-const-params-in-decls,
-cppcoreguidelines-macro-usage, -cppcoreguidelines-macro-usage,
-cppcoreguidelines-avoid-do-while -cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,
-cppcoreguidelines-pro-bounds-pointer-arithmetic
ExcludeHeaderFilterRegex: '_generated.*' ExcludeHeaderFilterRegex: '_generated.*'
+1 -8
View File
@@ -40,14 +40,7 @@ eastl::vector<UUID> AssetBase::HardReferenceVisitor::GetUUIDs() const
{ {
eastl::vector<UUID> uuids; eastl::vector<UUID> uuids;
uuids.reserve(m_uuids.size()); uuids.reserve(m_uuids.size());
std::copy(m_uuids.begin(), m_uuids.end(), eastl::back_inserter(uuids));
std::transform(m_uuids.begin(),
m_uuids.end(),
eastl::back_inserter(uuids),
[](const UUID& p_uuid)
{
return p_uuid;
});
return uuids; return uuids;
} }
+11 -11
View File
@@ -128,10 +128,10 @@ void AssetContainerBase::QueueForRemoval(const UUID& p_uuid)
void AssetContainerBase::CancelRemoval(const UUID& p_uuid) void AssetContainerBase::CancelRemoval(const UUID& p_uuid)
{ {
const auto it = eastl::find(m_pendingRemovalUuids.begin(), m_pendingRemovalUuids.end(), p_uuid); auto* const pendingIt = eastl::find(m_pendingRemovalUuids.begin(), m_pendingRemovalUuids.end(), p_uuid);
if (it != m_pendingRemovalUuids.end()) if (pendingIt != m_pendingRemovalUuids.end())
{ {
m_pendingRemovalUuids.erase_unsorted(it); m_pendingRemovalUuids.erase_unsorted(pendingIt);
} }
} }
@@ -160,29 +160,29 @@ bool AssetContainerBase::IsMarkedForRemove(const UUID& p_uuid)
AssetContainerBase::Entry* AssetContainerBase::FindEntry(const UUID& p_uuid) AssetContainerBase::Entry* AssetContainerBase::FindEntry(const UUID& p_uuid)
{ {
const auto it = m_uuidToEntry.find(p_uuid); const auto entryIt = m_uuidToEntry.find(p_uuid);
return it != m_uuidToEntry.end() ? &it->second : nullptr; return entryIt != m_uuidToEntry.end() ? &entryIt->second : nullptr;
} }
/****************************************************************************************/ /****************************************************************************************/
const AssetContainerBase::Entry* AssetContainerBase::FindEntry(const UUID& p_uuid) const const AssetContainerBase::Entry* AssetContainerBase::FindEntry(const UUID& p_uuid) const
{ {
const auto it = m_uuidToEntry.find(p_uuid); const auto entryIt = m_uuidToEntry.find(p_uuid);
return it != m_uuidToEntry.end() ? &it->second : nullptr; return entryIt != m_uuidToEntry.end() ? &entryIt->second : nullptr;
} }
/****************************************************************************************/ /****************************************************************************************/
AssetContainerBase::Entry& AssetContainerBase::GetOrCreateEntry(const UUID& p_uuid) AssetContainerBase::Entry& AssetContainerBase::GetOrCreateEntry(const UUID& p_uuid)
{ {
auto [it, inserted] = m_uuidToEntry.try_emplace(p_uuid); auto [entryIt, inserted] = m_uuidToEntry.try_emplace(p_uuid);
if (inserted) if (inserted)
{ {
it->second.m_handleSlotKey = m_handles.Insert(this, p_uuid); entryIt->second.m_handleSlotKey = m_handles.Insert(this, p_uuid);
it->second.m_handle = m_handles.Get(it->second.m_handleSlotKey); entryIt->second.m_handle = m_handles.Get(entryIt->second.m_handleSlotKey);
} }
return it->second; return entryIt->second;
} }
} // namespace Bigfoot } // namespace Bigfoot
+51 -44
View File
@@ -164,15 +164,15 @@ eastl::vector<eastl::vector<std::byte>> BigFile::GetAssetFlatbuffers(const eastl
static_cast<std::span<const std::byte>>(assetRequest.Get(0))}; static_cast<std::span<const std::byte>>(assetRequest.Get(0))};
const UUID uuid {rawUUID}; const UUID uuid {rawUUID};
const auto it = uuidToIndices.find(uuid); const auto indicesIt = uuidToIndices.find(uuid);
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
it != uuidToIndices.end(), indicesIt != uuidToIndices.end(),
"Returned UUID {} not found in requested UUIDs", "Returned UUID {} not found in requested UUIDs",
uuid); uuid);
const eastl::span<const std::byte> flatbuffer = assetRequest.Get(1); const eastl::span<const std::byte> flatbuffer = assetRequest.Get(1);
for (const std::size_t index: it->second) for (const std::size_t index: indicesIt->second)
{ {
flatbuffers[index].assign(flatbuffer.begin(), flatbuffer.end()); flatbuffers[index].assign(flatbuffer.begin(), flatbuffer.end());
} }
@@ -260,16 +260,16 @@ eastl::vector<eastl::vector<UUID>> BigFile::GetAssetsHardReferences(eastl::span<
static_cast<std::span<const std::byte>>(hardReferencesRequest.Get(0))}; static_cast<std::span<const std::byte>>(hardReferencesRequest.Get(0))};
const UUID ownerUUID {rawOwnerUUID}; const UUID ownerUUID {rawOwnerUUID};
const auto it = uuidToIndices.find(ownerUUID); const auto indicesIt = uuidToIndices.find(ownerUUID);
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
it != uuidToIndices.end(), indicesIt != uuidToIndices.end(),
"Returned UUID {} not found in requested UUIDs", "Returned UUID {} not found in requested UUIDs",
ownerUUID); ownerUUID);
const std::span<const std::byte, UUID::UUID_BYTE_SIZE> rawHardReference { const std::span<const std::byte, UUID::UUID_BYTE_SIZE> rawHardReference {
static_cast<std::span<const std::byte>>(hardReferencesRequest.Get(1))}; static_cast<std::span<const std::byte>>(hardReferencesRequest.Get(1))};
for (const std::size_t index: it->second) for (const std::size_t index: indicesIt->second)
{ {
hardReferences[index].emplace_back(rawHardReference); hardReferences[index].emplace_back(rawHardReference);
} }
@@ -356,16 +356,16 @@ eastl::vector<eastl::optional<BigFile::AssetTime>> BigFile::GetAssetsTime(const
static_cast<std::span<const std::byte>>(timeRequest.Get(0))}; static_cast<std::span<const std::byte>>(timeRequest.Get(0))};
const UUID uuid {rawUUID}; const UUID uuid {rawUUID};
const auto it = uuidToIndices.find(uuid); const auto indicesIt = uuidToIndices.find(uuid);
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
it != uuidToIndices.end(), indicesIt != uuidToIndices.end(),
"Returned UUID {} not found in requested UUIDs", "Returned UUID {} not found in requested UUIDs",
uuid); uuid);
const AssetTime assetTime {.m_creationTime = Time {static_cast<std::uint64_t>(timeRequest.Get(1))}, const AssetTime assetTime {.m_creationTime = Time {static_cast<std::uint64_t>(timeRequest.Get(1))},
.m_modificationTime = Time {static_cast<std::uint64_t>(timeRequest.Get(2))}}; .m_modificationTime = Time {static_cast<std::uint64_t>(timeRequest.Get(2))}};
for (const std::size_t index: it->second) for (const std::size_t index: indicesIt->second)
{ {
times[index] = assetTime; times[index] = assetTime;
} }
@@ -401,6 +401,7 @@ void BigFile::SaveAssetFlatbuffer(const UUID& p_uuid,
deleteHardReferencesRequest.Execute(); deleteHardReferencesRequest.Execute();
constexpr std::size_t HARDREF_PARAMS_PER_ROW = 2; constexpr std::size_t HARDREF_PARAMS_PER_ROW = 2;
constexpr std::size_t HARDREF_PLACEHOLDER_RESERVE_CHARS_PER_ROW = 8;
const std::size_t maxHardRefRowsPerStatement = static_cast<std::size_t>( const std::size_t maxHardRefRowsPerStatement = static_cast<std::size_t>(
sqlite3_limit(m_db, SQLITE_LIMIT_VARIABLE_NUMBER, -1)) / sqlite3_limit(m_db, SQLITE_LIMIT_VARIABLE_NUMBER, -1)) /
HARDREF_PARAMS_PER_ROW; HARDREF_PARAMS_PER_ROW;
@@ -410,7 +411,7 @@ void BigFile::SaveAssetFlatbuffer(const UUID& p_uuid,
const std::size_t chunkSize = eastl::min(maxHardRefRowsPerStatement, p_hardReferences.size() - chunkStart); const std::size_t chunkSize = eastl::min(maxHardRefRowsPerStatement, p_hardReferences.size() - chunkStart);
eastl::string hardReferencePlaceholders; eastl::string hardReferencePlaceholders;
hardReferencePlaceholders.reserve(chunkSize * 8); hardReferencePlaceholders.reserve(chunkSize * HARDREF_PLACEHOLDER_RESERVE_CHARS_PER_ROW);
for (std::size_t i = 0; i < chunkSize; ++i) for (std::size_t i = 0; i < chunkSize; ++i)
{ {
if (i > 0) if (i > 0)
@@ -455,6 +456,8 @@ void BigFile::SaveAssetFlatbuffers(const eastl::span<const UUID> p_uuids,
BeginTransaction(); BeginTransaction();
constexpr std::size_t METADATA_PARAMS_PER_ROW = 4; constexpr std::size_t METADATA_PARAMS_PER_ROW = 4;
constexpr std::size_t METADATA_PLACEHOLDER_RESERVE_CHARS_PER_ROW = 14;
constexpr std::size_t ASSET_PLACEHOLDER_RESERVE_CHARS_PER_ROW = 8;
const std::size_t maxRowsPerStatement = static_cast<std::size_t>( const std::size_t maxRowsPerStatement = static_cast<std::size_t>(
sqlite3_limit(m_db, SQLITE_LIMIT_VARIABLE_NUMBER, -1)) / sqlite3_limit(m_db, SQLITE_LIMIT_VARIABLE_NUMBER, -1)) /
METADATA_PARAMS_PER_ROW; METADATA_PARAMS_PER_ROW;
@@ -464,7 +467,7 @@ void BigFile::SaveAssetFlatbuffers(const eastl::span<const UUID> p_uuids,
const std::size_t chunkSize = eastl::min(maxRowsPerStatement, p_uuids.size() - chunkStart); const std::size_t chunkSize = eastl::min(maxRowsPerStatement, p_uuids.size() - chunkStart);
eastl::string metadataPlaceholders; eastl::string metadataPlaceholders;
metadataPlaceholders.reserve(chunkSize * 14); metadataPlaceholders.reserve(chunkSize * METADATA_PLACEHOLDER_RESERVE_CHARS_PER_ROW);
for (std::size_t i = 0; i < chunkSize; ++i) for (std::size_t i = 0; i < chunkSize; ++i)
{ {
if (i > 0) if (i > 0)
@@ -487,7 +490,7 @@ void BigFile::SaveAssetFlatbuffers(const eastl::span<const UUID> p_uuids,
metadataRequest.Execute(); metadataRequest.Execute();
eastl::string assetPlaceholders; eastl::string assetPlaceholders;
assetPlaceholders.reserve(chunkSize * 8); assetPlaceholders.reserve(chunkSize * ASSET_PLACEHOLDER_RESERVE_CHARS_PER_ROW);
for (std::size_t i = 0; i < chunkSize; ++i) for (std::size_t i = 0; i < chunkSize; ++i)
{ {
if (i > 0) if (i > 0)
@@ -542,6 +545,7 @@ void BigFile::SaveAssetFlatbuffers(const eastl::span<const UUID> p_uuids,
} }
constexpr std::size_t HARDREF_PARAMS_PER_ROW = 2; constexpr std::size_t HARDREF_PARAMS_PER_ROW = 2;
constexpr std::size_t HARDREF_PLACEHOLDER_RESERVE_CHARS_PER_ROW = 8;
const std::size_t maxHardRefRowsPerStatement = static_cast<std::size_t>( const std::size_t maxHardRefRowsPerStatement = static_cast<std::size_t>(
sqlite3_limit(m_db, SQLITE_LIMIT_VARIABLE_NUMBER, -1)) / sqlite3_limit(m_db, SQLITE_LIMIT_VARIABLE_NUMBER, -1)) /
HARDREF_PARAMS_PER_ROW; HARDREF_PARAMS_PER_ROW;
@@ -553,7 +557,7 @@ void BigFile::SaveAssetFlatbuffers(const eastl::span<const UUID> p_uuids,
hardReferencePairs.size() - hardRefChunkStart); hardReferencePairs.size() - hardRefChunkStart);
eastl::string hardReferencePlaceholders; eastl::string hardReferencePlaceholders;
hardReferencePlaceholders.reserve(hardRefChunkSize * 8); hardReferencePlaceholders.reserve(hardRefChunkSize * HARDREF_PLACEHOLDER_RESERVE_CHARS_PER_ROW);
for (std::size_t i = 0; i < hardRefChunkSize; ++i) for (std::size_t i = 0; i < hardRefChunkSize; ++i)
{ {
if (i > 0) if (i > 0)
@@ -601,7 +605,7 @@ BigFile::Request::Request(const BigFile& p_bigFile, const eastl::string_view p_r
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_prepare_v2(m_db, const int result = sqlite3_prepare_v2(m_db,
p_request.data(), p_request.data(),
static_cast<std::uint32_t>(p_request.size()), static_cast<int>(p_request.size()),
&m_statement, &m_statement,
nullptr); nullptr);
CRITICAL_ASSERT(EngineAssertHandler, CRITICAL_ASSERT(EngineAssertHandler,
@@ -615,11 +619,11 @@ BigFile::Request::Request(const BigFile& p_bigFile, const eastl::string_view p_r
void BigFile::Request::Bind(const std::uint32_t p_index, const std::int32_t p_value) void BigFile::Request::Bind(const std::uint32_t p_index, const std::int32_t p_value)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_int(m_statement, p_index, p_value); const int result = sqlite3_bind_int(m_statement, static_cast<int>(p_index), p_value);
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -628,11 +632,11 @@ void BigFile::Request::Bind(const std::uint32_t p_index, const std::int32_t p_va
void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint32_t p_value) void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint32_t p_value)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_int(m_statement, p_index, p_value); const int result = sqlite3_bind_int(m_statement, static_cast<int>(p_index), static_cast<int>(p_value));
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -641,11 +645,11 @@ void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint32_t p_v
void BigFile::Request::Bind(const std::uint32_t p_index, const std::int64_t p_value) void BigFile::Request::Bind(const std::uint32_t p_index, const std::int64_t p_value)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_int64(m_statement, p_index, p_value); const int result = sqlite3_bind_int64(m_statement, static_cast<int>(p_index), p_value);
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -654,11 +658,11 @@ void BigFile::Request::Bind(const std::uint32_t p_index, const std::int64_t p_va
void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint64_t p_value) void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint64_t p_value)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_int64(m_statement, p_index, std::bit_cast<std::int64_t>(p_value)); const int result = sqlite3_bind_int64(m_statement, static_cast<int>(p_index), std::bit_cast<std::int64_t>(p_value));
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -667,11 +671,11 @@ void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint64_t p_v
void BigFile::Request::Bind(const std::uint32_t p_index, const float p_value) void BigFile::Request::Bind(const std::uint32_t p_index, const float p_value)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_double(m_statement, p_index, p_value); const int result = sqlite3_bind_double(m_statement, static_cast<int>(p_index), p_value);
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -680,11 +684,11 @@ void BigFile::Request::Bind(const std::uint32_t p_index, const float p_value)
void BigFile::Request::Bind(const std::uint32_t p_index, const double p_value) void BigFile::Request::Bind(const std::uint32_t p_index, const double p_value)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_double(m_statement, p_index, p_value); const int result = sqlite3_bind_double(m_statement, static_cast<int>(p_index), p_value);
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -693,14 +697,14 @@ void BigFile::Request::Bind(const std::uint32_t p_index, const double p_value)
void BigFile::Request::Bind(const std::uint32_t p_index, const eastl::string_view p_value, const CopyValue p_copy) void BigFile::Request::Bind(const std::uint32_t p_index, const eastl::string_view p_value, const CopyValue p_copy)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_text(m_statement, const int result = sqlite3_bind_text(m_statement,
p_index, static_cast<int>(p_index),
p_value.data(), p_value.data(),
static_cast<std::uint32_t>(p_value.size()), static_cast<int>(p_value.size()),
p_copy ? SQLITE_TRANSIENT : SQLITE_STATIC); p_copy ? SQLITE_TRANSIENT : SQLITE_STATIC);
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -712,14 +716,14 @@ void BigFile::Request::Bind(const std::uint32_t p_index,
const CopyValue p_copy) const CopyValue p_copy)
{ {
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))), (p_index >= 1U) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
"Invalid index for statement"); "Invalid index for statement");
[[maybe_unused]] [[maybe_unused]]
const int result = sqlite3_bind_blob(m_statement, const int result = sqlite3_bind_blob(m_statement,
p_index, static_cast<int>(p_index),
p_value.data(), p_value.data(),
static_cast<std::uint32_t>(p_value.size()), static_cast<int>(p_value.size()),
p_copy ? SQLITE_TRANSIENT : SQLITE_STATIC); p_copy ? SQLITE_TRANSIENT : SQLITE_STATIC);
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db)); ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
} }
@@ -760,66 +764,69 @@ BigFile::Request::Column::Column(const Request& p_request, const std::uint32_t p
BigFile::Request::Column::operator std::int32_t() const BigFile::Request::Column::operator std::int32_t() const
{ {
return sqlite3_column_int(m_statement, m_index); return sqlite3_column_int(m_statement, static_cast<int>(m_index));
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator std::uint32_t() const BigFile::Request::Column::operator std::uint32_t() const
{ {
return sqlite3_column_int(m_statement, m_index); return sqlite3_column_int(m_statement, static_cast<int>(m_index));
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator std::int64_t() const BigFile::Request::Column::operator std::int64_t() const
{ {
return sqlite3_column_int64(m_statement, m_index); return sqlite3_column_int64(m_statement, static_cast<int>(m_index));
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator std::uint64_t() const BigFile::Request::Column::operator std::uint64_t() const
{ {
return std::bit_cast<std::uint64_t>(sqlite3_column_int64(m_statement, m_index)); return std::bit_cast<std::uint64_t>(sqlite3_column_int64(m_statement, static_cast<int>(m_index)));
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator float() const BigFile::Request::Column::operator float() const
{ {
return static_cast<float>(sqlite3_column_double(m_statement, m_index)); return static_cast<float>(sqlite3_column_double(m_statement, static_cast<int>(m_index)));
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator double() const BigFile::Request::Column::operator double() const
{ {
return sqlite3_column_double(m_statement, m_index); return sqlite3_column_double(m_statement, static_cast<int>(m_index));
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator eastl::string_view() const BigFile::Request::Column::operator eastl::string_view() const
{ {
return eastl::string_view {reinterpret_cast<const char*>(sqlite3_column_text(m_statement, m_index)), return eastl::string_view {
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, m_index))}; reinterpret_cast<const char*>(sqlite3_column_text(m_statement, static_cast<int>(m_index))),
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, static_cast<int>(m_index)))};
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator eastl::span<const std::byte>() const BigFile::Request::Column::operator eastl::span<const std::byte>() const
{ {
return eastl::span<const std::byte> {static_cast<const std::byte*>(sqlite3_column_blob(m_statement, m_index)), return eastl::span<const std::byte> {
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, m_index))}; static_cast<const std::byte*>(sqlite3_column_blob(m_statement, static_cast<int>(m_index))),
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, static_cast<int>(m_index)))};
} }
/****************************************************************************************/ /****************************************************************************************/
BigFile::Request::Column::operator std::span<const std::byte>() const BigFile::Request::Column::operator std::span<const std::byte>() const
{ {
return std::span<const std::byte> {static_cast<const std::byte*>(sqlite3_column_blob(m_statement, m_index)), return std::span<const std::byte> {
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, m_index))}; static_cast<const std::byte*>(sqlite3_column_blob(m_statement, static_cast<int>(m_index))),
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, static_cast<int>(m_index)))};
} }
/****************************************************************************************/ /****************************************************************************************/
@@ -26,7 +26,7 @@ template<class ASSET>
class Asset: public AssetBase class Asset: public AssetBase
{ {
public: public:
using FLAT_ASSET = typename ASSET::FLAT; using FLAT_ASSET = ASSET::FLAT;
/** /**
* Constructor * Constructor
@@ -67,7 +67,7 @@ class Asset: public AssetBase
* \return The asset * \return The asset
*/ */
[[nodiscard]] [[nodiscard]]
const typename FLAT_ASSET::NativeTableType& GetAsset() const const FLAT_ASSET::NativeTableType& GetAsset() const
{ {
return m_asset; return m_asset;
} }
@@ -78,7 +78,7 @@ class Asset: public AssetBase
* \return The asset * \return The asset
*/ */
[[nodiscard]] [[nodiscard]]
typename FLAT_ASSET::NativeTableType& GetAsset() FLAT_ASSET::NativeTableType& GetAsset()
{ {
return m_asset; return m_asset;
} }
@@ -185,7 +185,7 @@ class Asset: public AssetBase
/** /**
* The asset * The asset
*/ */
typename FLAT_ASSET::NativeTableType m_asset; FLAT_ASSET::NativeTableType m_asset;
/** /**
* The asset header * The asset header
*/ */
@@ -54,13 +54,14 @@ class AssetBase
[[nodiscard]] [[nodiscard]]
virtual eastl::vector<std::byte> Pack() const = 0; virtual eastl::vector<std::byte> Pack() const = 0;
AssetBase(const AssetBase& p_asset) = delete;
AssetBase& operator=(const AssetBase& p_asset) = delete;
protected: protected:
AssetBase() = default; AssetBase() = default;
AssetBase(const AssetBase& p_asset) = delete;
AssetBase(AssetBase&& p_asset) = default; AssetBase(AssetBase&& p_asset) = default;
AssetBase& operator=(const AssetBase& p_asset) = delete;
AssetBase& operator=(AssetBase&& p_asset) = default; AssetBase& operator=(AssetBase&& p_asset) = default;
class HardReferenceVisitor: public flatbuffers::IterationVisitor class HardReferenceVisitor: public flatbuffers::IterationVisitor
@@ -200,8 +200,12 @@ class AssetContainerBase
[[nodiscard]] [[nodiscard]]
bool IsMarkedForRemove(const UUID& p_uuid); bool IsMarkedForRemove(const UUID& p_uuid);
AssetContainerBase& operator=(const AssetContainerBase& p_container) = delete;
AssetContainerBase& operator=(AssetContainerBase&& p_container) = delete; AssetContainerBase& operator=(AssetContainerBase&& p_container) = delete;
AssetContainerBase(const AssetContainerBase& p_container) = delete;
AssetContainerBase(AssetContainerBase&& p_container) = delete;
protected: protected:
struct Entry struct Entry
{ {
@@ -223,8 +227,6 @@ class AssetContainerBase
AssetContainerBase() = default; AssetContainerBase() = default;
AssetContainerBase(AssetContainerBase&& p_container) = delete;
/* /*
* Finds an entry matching the Asset * Finds an entry matching the Asset
* *
@@ -352,7 +354,6 @@ class AssetContainer: public AssetContainerBase
m_assets.Remove(p_key); m_assets.Remove(p_key);
} }
private:
/* /*
* The assets * The assets
*/ */
@@ -99,6 +99,8 @@ class AssetLibrary
AssetLibrary& operator=(const AssetLibrary& p_library) = default; AssetLibrary& operator=(const AssetLibrary& p_library) = default;
AssetLibrary& operator=(AssetLibrary&& p_library) = delete; AssetLibrary& operator=(AssetLibrary&& p_library) = delete;
~AssetLibrary() = default;
private: private:
// All the asset containers // All the asset containers
ankerl::unordered_dense::map<AssetTypeID, AssetContainerBase*> m_assetContainers; ankerl::unordered_dense::map<AssetTypeID, AssetContainerBase*> m_assetContainers;
@@ -15,13 +15,10 @@ using AssetTypeID = std::uint64_t;
/****************************************************************************************/ /****************************************************************************************/
namespace Flat namespace Flat::Bigfoot
{
namespace Bigfoot
{ {
struct AssetTypeID; struct AssetTypeID;
} } // namespace Flat::Bigfoot
} // namespace Flat
/****************************************************************************************/ /****************************************************************************************/
@@ -94,7 +94,9 @@ class ReferenceBase
return m_uuid == p_reference.m_uuid; return m_uuid == p_reference.m_uuid;
} }
protected: private:
friend DERIVED;
ReferenceBase() = default; ReferenceBase() = default;
ReferenceBase(const UUID& p_uuid): ReferenceBase(const UUID& p_uuid):
@@ -116,7 +118,6 @@ class ReferenceBase
{ {
} }
private:
/** /**
* Get the associated handle container for the asset * Get the associated handle container for the asset
* Register the reference inside the handle * Register the reference inside the handle
@@ -152,7 +153,6 @@ class ReferenceBase
} }
} }
private:
/** /**
* The UUID * The UUID
*/ */
@@ -60,7 +60,7 @@ class BigFile: public DataAccessor
*/ */
void Clear(); void Clear();
~BigFile(); ~BigFile() override;
/** /**
* Get an Asset flatbuffer * Get an Asset flatbuffer
@@ -369,14 +369,14 @@ class BigFile: public DataAccessor
/* /*
* The statement * The statement
*/ */
sqlite3_stmt* m_statement; sqlite3_stmt* m_statement = nullptr;
}; };
private: private:
/** /**
* The BigFile DB * The BigFile DB
*/ */
sqlite3* m_db; sqlite3* m_db = nullptr;
}; };
#endif #endif
} // namespace Bigfoot } // namespace Bigfoot
@@ -10,7 +10,7 @@
#include <Utils/Assert/AssertHandler.hpp> #include <Utils/Assert/AssertHandler.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot namespace Bigfoot
{ {
@@ -95,7 +95,7 @@ class SasquatchWriter
SasquatchWriter& operator=(SasquatchWriter&& p_writer) = delete; SasquatchWriter& operator=(SasquatchWriter&& p_writer) = delete;
private: private:
static constexpr std::uint64_t PREFETCH_BYTES = 4 * 1024 * 1024; static constexpr std::uint64_t PREFETCH_BYTES = 4ULL * 1024 * 1024;
/** /**
* The number of assets expected * The number of assets expected
@@ -105,7 +105,7 @@ class SasquatchWriter
/** /**
* How far into m_file has already been prefetched * How far into m_file has already been prefetched
*/ */
std::size_t m_prefetchedUpTo; std::size_t m_prefetchedUpTo = 0;
/** /**
* Current write position in the data region * Current write position in the data region
@@ -145,6 +145,7 @@ class Sasquatch: public DataAccessor
* *
* \return The header * \return The header
*/ */
[[nodiscard]]
const SasquatchHeader& GetHeader() const; const SasquatchHeader& GetHeader() const;
/** /**
@@ -28,7 +28,7 @@ void LoadAsset(const UUID& p_uuid);
*/ */
void LoadAssets(const eastl::span<const UUID> p_uuids); void LoadAssets(const eastl::span<const UUID> p_uuids);
#if defined BIGFOOT_TOOLMODE #ifdef BIGFOOT_TOOLMODE
/** /**
* Save an Asset * Save an Asset
* Fails without saving if a cyclic dependency is detected starting from this asset * Fails without saving if a cyclic dependency is detected starting from this asset
+17 -18
View File
@@ -19,10 +19,9 @@ SasquatchWriter::SasquatchWriter(const File& p_file,
const std::size_t p_totalFlatbufferBytes, const std::size_t p_totalFlatbufferBytes,
const std::size_t p_totalHardReferencesBytes): const std::size_t p_totalHardReferencesBytes):
m_assetCount(p_assetCount), m_assetCount(p_assetCount),
m_prefetchedUpTo(0), m_currentDataOffset(sizeof(SasquatchHeader) + (m_assetCount * sizeof(SasquatchEntry))),
m_currentDataOffset(sizeof(SasquatchHeader) + m_assetCount * sizeof(SasquatchEntry)),
m_file(p_file, m_file(p_file,
sizeof(SasquatchHeader) + m_assetCount * sizeof(SasquatchEntry) + p_totalFlatbufferBytes + sizeof(SasquatchHeader) + (m_assetCount * sizeof(SasquatchEntry)) + p_totalFlatbufferBytes +
p_totalHardReferencesBytes) p_totalHardReferencesBytes)
{ {
m_entries.reserve(m_assetCount); m_entries.reserve(m_assetCount);
@@ -68,11 +67,11 @@ void SasquatchWriter::WriteAsset(const UUID& p_uuid,
const eastl::span<std::byte> data = m_file.GetData(); const eastl::span<std::byte> data = m_file.GetData();
ASSERT(EngineAssertHandler, ASSERT(EngineAssertHandler,
offset + p_flatbuffer.size() + p_hardReferences.size() * UUID::UUID_BYTE_SIZE <= data.size(), offset + p_flatbuffer.size() + (p_hardReferences.size() * UUID::UUID_BYTE_SIZE) <= data.size(),
"SasquatchWriter can only write {} bytes", "SasquatchWriter can only write {} bytes",
data.size()); data.size());
const std::size_t writeEnd = offset + p_flatbuffer.size() + p_hardReferences.size() * UUID::UUID_BYTE_SIZE; const std::size_t writeEnd = offset + p_flatbuffer.size() + (p_hardReferences.size() * UUID::UUID_BYTE_SIZE);
if (writeEnd > m_prefetchedUpTo) if (writeEnd > m_prefetchedUpTo)
{ {
const std::size_t prefetchEnd = std::min(writeEnd + PREFETCH_BYTES, data.size()); const std::size_t prefetchEnd = std::min(writeEnd + PREFETCH_BYTES, data.size());
@@ -92,7 +91,7 @@ void SasquatchWriter::WriteAsset(const UUID& p_uuid,
for (std::uint32_t i = 0; i < p_hardReferences.size(); ++i) for (std::uint32_t i = 0; i < p_hardReferences.size(); ++i)
{ {
const std::span<const std::byte, UUID::UUID_BYTE_SIZE> rawUUID = p_hardReferences[i].ToBytes(); const std::span<const std::byte, UUID::UUID_BYTE_SIZE> rawUUID = p_hardReferences[i].ToBytes();
std::memcpy(data.data() + entry.m_hardReferencesOffset + i * UUID::UUID_BYTE_SIZE, std::memcpy(data.data() + entry.m_hardReferencesOffset + (static_cast<std::size_t>(i) * UUID::UUID_BYTE_SIZE),
rawUUID.data(), rawUUID.data(),
UUID::UUID_BYTE_SIZE); UUID::UUID_BYTE_SIZE);
} }
@@ -129,11 +128,11 @@ Sasquatch::Sasquatch(const File& p_file):
SasquatchHeader::VERSION); SasquatchHeader::VERSION);
CRITICAL_ASSERT(EngineAssertHandler, CRITICAL_ASSERT(EngineAssertHandler,
data.size() >= sizeof(SasquatchHeader) + m_header.m_assetCount * sizeof(SasquatchEntry), data.size() >= sizeof(SasquatchHeader) + (m_header.m_assetCount * sizeof(SasquatchEntry)),
"Sasquatch file {} index is truncated (got {} / expected at least {})", "Sasquatch file {} index is truncated (got {} / expected at least {})",
p_file.GetPath(), p_file.GetPath(),
data.size(), data.size(),
sizeof(SasquatchHeader) + m_header.m_assetCount * sizeof(SasquatchEntry)); sizeof(SasquatchHeader) + (m_header.m_assetCount * sizeof(SasquatchEntry)));
eastl::vector<SasquatchEntry> entries(m_header.m_assetCount); eastl::vector<SasquatchEntry> entries(m_header.m_assetCount);
if (!entries.empty()) if (!entries.empty())
@@ -168,15 +167,15 @@ const SasquatchHeader& Sasquatch::GetHeader() const
eastl::vector<std::byte> Sasquatch::GetAssetFlatbuffer(const UUID& p_uuid) const eastl::vector<std::byte> Sasquatch::GetAssetFlatbuffer(const UUID& p_uuid) const
{ {
const auto it = m_entries.find(p_uuid); const auto entryIt = m_entries.find(p_uuid);
if (it == m_entries.end()) if (entryIt == m_entries.end())
{ {
return {}; return {};
} }
const eastl::span<const std::byte> data = m_file.GetData(); const eastl::span<const std::byte> data = m_file.GetData();
const eastl::span<const std::byte> bytes {data.data() + it->second.m_assetOffset, const eastl::span<const std::byte> bytes {data.data() + entryIt->second.m_assetOffset,
static_cast<std::size_t>(it->second.m_assetSize)}; static_cast<std::size_t>(entryIt->second.m_assetSize)};
return eastl::vector<std::byte> {bytes.begin(), bytes.end()}; return eastl::vector<std::byte> {bytes.begin(), bytes.end()};
} }
@@ -201,15 +200,15 @@ eastl::vector<UUID> Sasquatch::GetAssetHardReferences(const UUID& p_uuid) const
{ {
eastl::vector<UUID> hardReferences; eastl::vector<UUID> hardReferences;
const auto it = m_entries.find(p_uuid); const auto entryIt = m_entries.find(p_uuid);
if (it == m_entries.end()) if (entryIt == m_entries.end())
{ {
return hardReferences; return hardReferences;
} }
const eastl::span<const std::byte> data = m_file.GetData(); const eastl::span<const std::byte> data = m_file.GetData();
const eastl::span<const std::byte> bytes {data.data() + it->second.m_hardReferencesOffset, const eastl::span<const std::byte> bytes {data.data() + entryIt->second.m_hardReferencesOffset,
static_cast<std::size_t>(it->second.m_hardReferencesSize)}; static_cast<std::size_t>(entryIt->second.m_hardReferencesSize)};
const std::size_t hardReferenceCount = bytes.size() / UUID::UUID_BYTE_SIZE; const std::size_t hardReferenceCount = bytes.size() / UUID::UUID_BYTE_SIZE;
hardReferences.reserve(hardReferenceCount); hardReferences.reserve(hardReferenceCount);
@@ -217,7 +216,7 @@ eastl::vector<UUID> Sasquatch::GetAssetHardReferences(const UUID& p_uuid) const
for (std::size_t i = 0; i < hardReferenceCount; ++i) for (std::size_t i = 0; i < hardReferenceCount; ++i)
{ {
std::array<std::byte, UUID::UUID_BYTE_SIZE> rawUUID; std::array<std::byte, UUID::UUID_BYTE_SIZE> rawUUID;
std::memcpy(rawUUID.data(), bytes.data() + i * UUID::UUID_BYTE_SIZE, UUID::UUID_BYTE_SIZE); std::memcpy(rawUUID.data(), bytes.data() + (i * UUID::UUID_BYTE_SIZE), UUID::UUID_BYTE_SIZE);
hardReferences.emplace_back(rawUUID); hardReferences.emplace_back(rawUUID);
} }
@@ -261,7 +260,7 @@ void Sasquatch::SaveAssetFlatbuffers([[maybe_unused]] const eastl::span<const UU
bool Sasquatch::Has(const UUID& p_uuid) const bool Sasquatch::Has(const UUID& p_uuid) const
{ {
return m_entries.find(p_uuid) != m_entries.end(); return m_entries.contains(p_uuid);
} }
#endif #endif
} // namespace Bigfoot } // namespace Bigfoot
@@ -104,6 +104,10 @@ void LoadAssets(const eastl::span<const UUID> p_uuids)
AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer( AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer(
flatbuffers::UnPack(*asset->header()->type_id())); flatbuffers::UnPack(*asset->header()->type_id()));
CRITICAL_ASSERT(EngineAssertHandler,
container != nullptr,
"No AssetContainer registered for asset {}",
wave[i]);
std::ignore = container->Insert(flatbuffer); std::ignore = container->Insert(flatbuffer);
} }
} }
@@ -118,7 +122,7 @@ void LoadAsset(const UUID& p_uuid)
/****************************************************************************************/ /****************************************************************************************/
#if defined BIGFOOT_TOOLMODE #ifdef BIGFOOT_TOOLMODE
/* /*
* Finds the cyclic dependencies that may exist in Assets * Finds the cyclic dependencies that may exist in Assets
* *
@@ -183,6 +187,7 @@ eastl::vector<UUID> FindCyclicDependencies(const eastl::span<const UUID> p_uuids
bool SaveAsset(const UUID& p_uuid) bool SaveAsset(const UUID& p_uuid)
{ {
AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer(p_uuid); AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer(p_uuid);
CRITICAL_ASSERT(EngineAssertHandler, container != nullptr, "No AssetContainer registered for asset {}", p_uuid);
const AssetBase* asset = container->AcquireContainerHandle(p_uuid)->GetAsset(); const AssetBase* asset = container->AcquireContainerHandle(p_uuid)->GetAsset();
const eastl::vector<std::byte> flatbuffer = asset->Pack(); const eastl::vector<std::byte> flatbuffer = asset->Pack();
@@ -217,6 +222,7 @@ bool SaveAssets(const eastl::span<const UUID> p_uuids)
for (const UUID& uuid: p_uuids) for (const UUID& uuid: p_uuids)
{ {
AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer(uuid); AssetContainerBase* container = g_activeAssetLibrary->GetAssetContainer(uuid);
CRITICAL_ASSERT(EngineAssertHandler, container != nullptr, "No AssetContainer registered for asset {}", uuid);
const AssetBase* asset = container->AcquireContainerHandle(uuid)->GetAsset(); const AssetBase* asset = container->AcquireContainerHandle(uuid)->GetAsset();
const eastl::vector<std::byte> flatbuffer = asset->Pack(); const eastl::vector<std::byte> flatbuffer = asset->Pack();
+2 -2
View File
@@ -112,8 +112,8 @@ void File::Delete() const
/****************************************************************************************/ /****************************************************************************************/
File::File(const std::filesystem::path& p_path): File::File(std::filesystem::path p_path):
m_path(p_path), m_path(std::move(p_path)),
m_pathString(m_path.string().c_str()) m_pathString(m_path.string().c_str())
{ {
} }
@@ -10,7 +10,7 @@
#include <string> #include <string>
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
#include <Windows.h> #include <Windows.h>
#elif defined BIGFOOT_LINUX #elif defined BIGFOOT_LINUX
#include <fcntl.h> #include <fcntl.h>
@@ -26,7 +26,7 @@ MemoryMappedFile::MemoryMappedFile(const File& p_file)
const File absoluteFile = p_file.ToAbsolute(); const File absoluteFile = p_file.ToAbsolute();
const eastl::string_view path = absoluteFile.GetPath(); const eastl::string_view path = absoluteFile.GetPath();
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
m_fileHandle = CreateFileA(path.data(), m_fileHandle = CreateFileA(path.data(),
GENERIC_READ, GENERIC_READ,
FILE_SHARE_READ, FILE_SHARE_READ,
@@ -78,7 +78,7 @@ MemoryMappedFile::MemoryMappedFile(const File& p_file)
MemoryMappedFile::~MemoryMappedFile() MemoryMappedFile::~MemoryMappedFile()
{ {
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
if (m_data != nullptr) if (m_data != nullptr)
{ {
[[maybe_unused]] [[maybe_unused]]
@@ -133,7 +133,7 @@ WritableMemoryMappedFile::WritableMemoryMappedFile(const File& p_file, const std
const File absoluteFile = p_file.ToAbsolute(); const File absoluteFile = p_file.ToAbsolute();
const eastl::string_view path = absoluteFile.GetPath(); const eastl::string_view path = absoluteFile.GetPath();
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
m_fileHandle = m_fileHandle =
CreateFileA(path.data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); CreateFileA(path.data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
CRITICAL_ASSERT(SystemAssertHandler, m_fileHandle != INVALID_HANDLE_VALUE, "Failed to create file {}", path); CRITICAL_ASSERT(SystemAssertHandler, m_fileHandle != INVALID_HANDLE_VALUE, "Failed to create file {}", path);
@@ -169,7 +169,7 @@ WritableMemoryMappedFile::WritableMemoryMappedFile(const File& p_file, const std
WritableMemoryMappedFile::~WritableMemoryMappedFile() WritableMemoryMappedFile::~WritableMemoryMappedFile()
{ {
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
if (m_data != nullptr) if (m_data != nullptr)
{ {
[[maybe_unused]] [[maybe_unused]]
@@ -220,7 +220,7 @@ eastl::span<std::byte> WritableMemoryMappedFile::GetData() const
void WritableMemoryMappedFile::Prefetch(const std::size_t p_offset, const std::size_t p_size) const void WritableMemoryMappedFile::Prefetch(const std::size_t p_offset, const std::size_t p_size) const
{ {
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
WIN32_MEMORY_RANGE_ENTRY range {.VirtualAddress = m_data + p_offset, .NumberOfBytes = p_size}; WIN32_MEMORY_RANGE_ENTRY range {.VirtualAddress = m_data + p_offset, .NumberOfBytes = p_size};
[[maybe_unused]] [[maybe_unused]]
const BOOL prefetched = PrefetchVirtualMemory(GetCurrentProcess(), 1, &range, 0); const BOOL prefetched = PrefetchVirtualMemory(GetCurrentProcess(), 1, &range, 0);
@@ -112,7 +112,7 @@ class File
* *
* \param p_path The path * \param p_path The path
*/ */
File(const std::filesystem::path& p_path); File(std::filesystem::path p_path);
/** /**
* The path * The path
@@ -47,7 +47,7 @@ class MemoryMappedFile
MemoryMappedFile& operator=(MemoryMappedFile&& p_file) = delete; MemoryMappedFile& operator=(MemoryMappedFile&& p_file) = delete;
private: private:
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
/** /**
* Handle to the file * Handle to the file
*/ */
@@ -118,7 +118,7 @@ class WritableMemoryMappedFile
WritableMemoryMappedFile& operator=(WritableMemoryMappedFile&& p_file) = delete; WritableMemoryMappedFile& operator=(WritableMemoryMappedFile&& p_file) = delete;
private: private:
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
/** /**
* Handle to the file * Handle to the file
*/ */
@@ -10,7 +10,7 @@
#include <Utils/Assert/AssertHandler.hpp> #include <Utils/Assert/AssertHandler.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot namespace Bigfoot
{ {
@@ -65,13 +65,10 @@ class Time
/****************************************************************************************/ /****************************************************************************************/
namespace Flat namespace Flat::Bigfoot
{
namespace Bigfoot
{ {
struct Time; struct Time;
} } // namespace Flat::Bigfoot
} // namespace Flat
/****************************************************************************************/ /****************************************************************************************/
@@ -121,12 +121,12 @@ struct std::hash<Bigfoot::UUID>
template<> template<>
struct fmt::formatter<Bigfoot::UUID> struct fmt::formatter<Bigfoot::UUID>
{ {
constexpr auto parse(format_parse_context& ctx) static constexpr auto parse(format_parse_context& ctx)
{ {
return ctx.begin(); return ctx.begin();
} }
auto format(const Bigfoot::UUID& p_uuid, format_context& ctx) const static auto format(const Bigfoot::UUID& p_uuid, format_context& ctx)
{ {
return fmt::format_to(ctx.out(), "{}", p_uuid.ToString().c_str()); return fmt::format_to(ctx.out(), "{}", p_uuid.ToString().c_str());
} }
@@ -159,13 +159,10 @@ struct quill::Codec<Bigfoot::UUID>: quill::DeferredFormatCodec<Bigfoot::UUID>
/****************************************************************************************/ /****************************************************************************************/
namespace Flat namespace Flat::Bigfoot
{
namespace Bigfoot
{ {
struct UUID; struct UUID;
} } // namespace Flat::Bigfoot
} // namespace Flat
/****************************************************************************************/ /****************************************************************************************/
@@ -25,20 +25,21 @@ int main(int argc, char** argv)
std::string bigFilePath; std::string bigFilePath;
std::string outputPath; std::string outputPath;
auto cli = lyra::help(showHelp) | const auto& cli = lyra::help(showHelp) |
lyra::opt(bigFilePath, "bigfile")["-b"]["--bigfile"]("The BigFile to bake (must exist)").required() | lyra::opt(bigFilePath, "bigfile")["-b"]["--bigfile"]("The BigFile to bake (must exist)")
lyra::opt(outputPath, "output")["-o"]["--output"]("The Sasquatch file to write").required(); .required() |
lyra::opt(outputPath, "output")["-o"]["--output"]("The Sasquatch file to write").required();
const lyra::parse_result result = cli.parse({argc, argv}); const lyra::parse_result result = cli.parse({argc, argv});
if (!result) if (!result)
{ {
std::cerr << result.message() << "\n\n" << cli << std::endl; std::cerr << result.message() << "\n\n" << cli << '\n';
return 1; return 1;
} }
if (showHelp) if (showHelp)
{ {
std::cout << cli << std::endl; std::cout << cli << '\n';
return 0; return 0;
} }
@@ -10,7 +10,7 @@
#include <SasquatchBaker/SasquatchBakerLogger_generated.hpp> #include <SasquatchBaker/SasquatchBakerLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot namespace Bigfoot
{ {
@@ -67,11 +67,11 @@ bool LayeredTopologicalSort(const ankerl::unordered_dense::map<NODE_TYPE, eastl:
std::uint32_t degree = 0; std::uint32_t degree = 0;
for (const NODE_TYPE& edge: p_graph.at(indexToNode[index])) for (const NODE_TYPE& edge: p_graph.at(indexToNode[index]))
{ {
const auto it = nodeToIndex.find(edge); const auto nodeIt = nodeToIndex.find(edge);
if (it != nodeToIndex.end()) if (nodeIt != nodeToIndex.end())
{ {
++degree; ++degree;
++adjacencyOffsets[it->second + 1]; ++adjacencyOffsets[nodeIt->second + 1];
} }
} }
@@ -93,10 +93,10 @@ bool LayeredTopologicalSort(const ankerl::unordered_dense::map<NODE_TYPE, eastl:
{ {
for (const NODE_TYPE& edge: p_graph.at(indexToNode[index])) for (const NODE_TYPE& edge: p_graph.at(indexToNode[index]))
{ {
const auto it = nodeToIndex.find(edge); const auto nodeIt = nodeToIndex.find(edge);
if (it != nodeToIndex.end()) if (nodeIt != nodeToIndex.end())
{ {
adjacency[cursor[it->second]++] = index; adjacency[cursor[nodeIt->second]++] = index;
} }
} }
} }
@@ -9,7 +9,7 @@
#include <Utils/Log/LogMacros.hpp> #include <Utils/Log/LogMacros.hpp>
#include <Utils/TargetMacros.h> #include <Utils/TargetMacros.h>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <Utils/Format.hpp> #include <Utils/Format.hpp>
@@ -19,11 +19,11 @@
#include <cstdlib> #include <cstdlib>
#include <source_location> #include <source_location>
#if defined BIGFOOT_LINUX #ifdef BIGFOOT_LINUX
#include <csignal> #include <csignal>
#endif #endif
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
#define BREAK \ #define BREAK \
do \ do \
{ \ { \
@@ -9,7 +9,7 @@
#include <Utils/Assert/Assert.hpp> #include <Utils/Assert/Assert.hpp>
#include <Utils/Log/Log.hpp> #include <Utils/Log/Log.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <EASTL/string.h> #include <EASTL/string.h>
@@ -28,7 +28,7 @@ class SlotMapKey
private: private:
static constexpr std::uint32_t VERSION_BIT_COUNT = sizeof(VersionType) * std::numeric_limits<unsigned char>::digits; static constexpr std::uint32_t VERSION_BIT_COUNT = sizeof(VersionType) * std::numeric_limits<unsigned char>::digits;
static constexpr std::uint32_t INDEX_BIT_COUNT = sizeof(IndexType) * std::numeric_limits<unsigned char>::digits; static constexpr std::uint32_t INDEX_BIT_COUNT = sizeof(IndexType) * std::numeric_limits<unsigned char>::digits;
static_assert(VERSION_BIT_COUNT + INDEX_BIT_COUNT <= 64, static_assert(VERSION_BIT_COUNT + INDEX_BIT_COUNT <= std::numeric_limits<std::uint64_t>::digits,
"We cant construct a 64 bit key from the given Version and Index types!"); "We cant construct a 64 bit key from the given Version and Index types!");
static constexpr std::uint64_t INDEX_MASK = (static_cast<std::uint64_t>(1) << INDEX_BIT_COUNT) - 1; static constexpr std::uint64_t INDEX_MASK = (static_cast<std::uint64_t>(1) << INDEX_BIT_COUNT) - 1;
@@ -115,10 +115,10 @@ class DenseSlotMap
public: public:
using SlotMapKey = SLOT_MAP_KEY_TYPE; using SlotMapKey = SLOT_MAP_KEY_TYPE;
using iterator = typename eastl::vector<T>::iterator; using iterator = eastl::vector<T>::iterator;
using const_iterator = typename eastl::vector<T>::const_iterator; using const_iterator = eastl::vector<T>::const_iterator;
using reverse_iterator = typename eastl::vector<T>::reverse_iterator; using reverse_iterator = eastl::vector<T>::reverse_iterator;
using const_reverse_iterator = typename eastl::vector<T>::const_reverse_iterator; using const_reverse_iterator = eastl::vector<T>::const_reverse_iterator;
/** /**
* Check if the map has the key * Check if the map has the key
@@ -402,7 +402,6 @@ class DenseSlotMap
m_freeListHead = p_key.GetIndex(); m_freeListHead = p_key.GetIndex();
} }
private:
/** /**
* The actual storage for our data * The actual storage for our data
*/ */
@@ -431,12 +430,13 @@ class DenseSlotMap
template<class T, class SLOT_MAP_KEY_TYPE = SlotMapKey<>> template<class T, class SLOT_MAP_KEY_TYPE = SlotMapKey<>>
class StableSlotMap class StableSlotMap
{ {
private: public:
static constexpr std::size_t PAGE_SIZE = 64; static constexpr std::size_t PAGE_SIZE = 64;
private:
struct AlignedSlot struct AlignedSlot
{ {
alignas(T) std::byte m_bytes[sizeof(T)]; alignas(T) eastl::array<std::byte, sizeof(T)> m_bytes;
}; };
struct Page struct Page
@@ -467,7 +467,7 @@ class StableSlotMap
T* Get(const std::size_t p_offset) T* Get(const std::size_t p_offset)
{ {
ASSERT(UtilsAssertHandler, m_occupied[p_offset], "Requesting a dead data!"); ASSERT(UtilsAssertHandler, m_occupied[p_offset], "Requesting a dead data!");
return std::launder(reinterpret_cast<T*>(m_data[p_offset].m_bytes)); return std::launder(reinterpret_cast<T*>(m_data[p_offset].m_bytes.data()));
} }
/** /**
@@ -479,7 +479,7 @@ class StableSlotMap
const T* Get(const std::size_t p_offset) const const T* Get(const std::size_t p_offset) const
{ {
ASSERT(UtilsAssertHandler, m_occupied[p_offset], "Requesting a dead data!"); ASSERT(UtilsAssertHandler, m_occupied[p_offset], "Requesting a dead data!");
return std::launder(reinterpret_cast<const T*>(m_data[p_offset].m_bytes)); return std::launder(reinterpret_cast<const T*>(m_data[p_offset].m_bytes.data()));
} }
/** /**
@@ -527,7 +527,8 @@ class StableSlotMap
IteratorImpl() = default; IteratorImpl() = default;
// Allows an iterator to be implicitly used as a const_iterator. // Allows an iterator to be implicitly used as a const_iterator.
template<class OTHER_VALUE_TYPE, class = std::enable_if_t<std::is_same_v<VALUE_TYPE, const OTHER_VALUE_TYPE>>> template<class OTHER_VALUE_TYPE>
requires std::is_same_v<VALUE_TYPE, const OTHER_VALUE_TYPE>
IteratorImpl(const IteratorImpl<OTHER_VALUE_TYPE>& p_other): IteratorImpl(const IteratorImpl<OTHER_VALUE_TYPE>& p_other):
m_map(p_other.m_map), m_map(p_other.m_map),
m_pageIt(p_other.m_pageIt), m_pageIt(p_other.m_pageIt),
@@ -777,7 +778,7 @@ class StableSlotMap
Page* const page = GetPageAt(pageIndex); Page* const page = GetPageAt(pageIndex);
const std::size_t offsetInPage = GetDataOffset(key); const std::size_t offsetInPage = GetDataOffset(key);
new (page->m_data[offsetInPage].m_bytes) T(std::forward<ARGS>(p_args)...); new (page->m_data[offsetInPage].m_bytes.data()) T(std::forward<ARGS>(p_args)...);
page->m_occupied.set(offsetInPage); page->m_occupied.set(offsetInPage);
return key; return key;
@@ -835,7 +836,7 @@ class StableSlotMap
{ {
std::destroy_at(page->Get(offset)); std::destroy_at(page->Get(offset));
const std::size_t keyIndex = pageIndex * PAGE_SIZE + offset; const std::size_t keyIndex = (pageIndex * PAGE_SIZE) + offset;
RecycleKey(SlotMapKey {m_keys[keyIndex].GetVersion(), static_cast<SlotMapKey::IndexType>(keyIndex)}); RecycleKey(SlotMapKey {m_keys[keyIndex].GetVersion(), static_cast<SlotMapKey::IndexType>(keyIndex)});
} }
page->m_occupied.reset(); page->m_occupied.reset();
@@ -870,9 +871,9 @@ class StableSlotMap
[[nodiscard]] [[nodiscard]]
iterator begin() iterator begin()
{ {
iterator it {this}; iterator result {this};
it.SeekFirstFrom(m_pages.begin()); result.SeekFirstFrom(m_pages.begin());
return it; return result;
} }
[[nodiscard]] [[nodiscard]]
@@ -884,9 +885,9 @@ class StableSlotMap
[[nodiscard]] [[nodiscard]]
const_iterator begin() const const_iterator begin() const
{ {
const_iterator it {this}; const_iterator result {this};
it.SeekFirstFrom(m_pages.begin()); result.SeekFirstFrom(m_pages.begin());
return it; return result;
} }
[[nodiscard]] [[nodiscard]]
@@ -1024,7 +1025,6 @@ class StableSlotMap
return m_pages[p_pageIndex].get(); return m_pages[p_pageIndex].get();
} }
private:
/** /**
* The pages * The pages
*/ */
@@ -8,7 +8,7 @@
#define BIGFOOT_UTILS_LOG_EASTLFORMATTERS_HPP #define BIGFOOT_UTILS_LOG_EASTLFORMATTERS_HPP
#include <Utils/TargetMacros.h> #include <Utils/TargetMacros.h>
#if defined(BIGFOOT_NOT_OPTIMIZED) #ifdef BIGFOOT_NOT_OPTIMIZED
#include <quill/core/Codec.h> #include <quill/core/Codec.h>
#endif #endif
@@ -24,27 +24,27 @@
template<> template<>
struct fmt::formatter<eastl::string> struct fmt::formatter<eastl::string>
{ {
constexpr auto parse(format_parse_context& ctx) static constexpr auto parse(format_parse_context& ctx)
{ {
return ctx.begin(); return ctx.begin();
} }
auto format(const eastl::string& p_string, format_context& ctx) const static auto format(const eastl::string& p_string, format_context& ctx)
{ {
return fmt::format_to(ctx.out(), "{}", p_string.c_str()); return fmt::format_to(ctx.out(), "{}", p_string.c_str());
} }
}; };
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
template<> template<>
struct fmtquill::formatter<eastl::string> struct fmtquill::formatter<eastl::string>
{ {
constexpr auto parse(format_parse_context& ctx) static constexpr auto parse(format_parse_context& ctx)
{ {
return ctx.begin(); return ctx.begin();
} }
auto format(const eastl::string& p_string, format_context& ctx) const static auto format(const eastl::string& p_string, format_context& ctx)
{ {
return fmtquill::format_to(ctx.out(), "{}", p_string.c_str()); return fmtquill::format_to(ctx.out(), "{}", p_string.c_str());
} }
@@ -56,27 +56,27 @@ struct fmtquill::formatter<eastl::string>
template<> template<>
struct fmt::formatter<eastl::string_view> struct fmt::formatter<eastl::string_view>
{ {
constexpr auto parse(format_parse_context& ctx) static constexpr auto parse(format_parse_context& ctx)
{ {
return ctx.begin(); return ctx.begin();
} }
auto format(const eastl::string_view& p_stringView, format_context& ctx) const static auto format(const eastl::string_view& p_stringView, format_context& ctx)
{ {
return fmt::format_to(ctx.out(), "{}", p_stringView.data()); return fmt::format_to(ctx.out(), "{}", p_stringView.data());
} }
}; };
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
template<> template<>
struct fmtquill::formatter<eastl::string_view> struct fmtquill::formatter<eastl::string_view>
{ {
constexpr auto parse(format_parse_context& ctx) static constexpr auto parse(format_parse_context& ctx)
{ {
return ctx.begin(); return ctx.begin();
} }
auto format(const eastl::string_view& p_stringView, format_context& ctx) const static auto format(const eastl::string_view& p_stringView, format_context& ctx)
{ {
return fmtquill::format_to(ctx.out(), "{}", p_stringView.data()); return fmtquill::format_to(ctx.out(), "{}", p_stringView.data());
} }
@@ -141,7 +141,7 @@ struct fmt::formatter<eastl::vector<T>>
} }
}; };
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <quill/DeferredFormatCodec.h> #include <quill/DeferredFormatCodec.h>
template<class T> template<class T>
@@ -8,7 +8,7 @@
#define BIGFOOT_UTILS_LOG_LOG_HPP #define BIGFOOT_UTILS_LOG_LOG_HPP
#include <Utils/Log/EASTLFormatters.hpp> #include <Utils/Log/EASTLFormatters.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <Utils/Log/Log_generated.hpp> #include <Utils/Log/Log_generated.hpp>
#include <EASTL/array.h> #include <EASTL/array.h>
@@ -23,7 +23,7 @@
#include <quill/Logger.h> #include <quill/Logger.h>
#include <quill/sinks/ConsoleSink.h> #include <quill/sinks/ConsoleSink.h>
#include <quill/sinks/FileSink.h> #include <quill/sinks/FileSink.h>
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
#pragma warning(default: 4702) #pragma warning(default: 4702)
#endif #endif
@@ -61,7 +61,7 @@ class Log
* *
* \param p_loggerInfo The logger to unregister * \param p_loggerInfo The logger to unregister
*/ */
void UnregisterLogger(const LoggerInfo& p_loggerInfo); static void UnregisterLogger(const LoggerInfo& p_loggerInfo);
/** /**
* Register a logger. * Register a logger.
@@ -84,7 +84,7 @@ class Log
* Flush all the loggers * Flush all the loggers
* *
*/ */
void Flush(); static void Flush();
~Log(); ~Log();
@@ -9,7 +9,7 @@
#include <Utils/Log/Log.hpp> #include <Utils/Log/Log.hpp>
#include <Utils/Singleton.hpp> #include <Utils/Singleton.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#define BIGFOOT_FLUSH_LOG \ #define BIGFOOT_FLUSH_LOG \
do \ do \
{ \ { \
@@ -111,7 +111,7 @@
#define BIGFOOT_LOG_FATAL(loggerName, fmt, ...) #define BIGFOOT_LOG_FATAL(loggerName, fmt, ...)
#endif #endif
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#define BIGFOOT_LOG_DEBUG_IF(condition, loggerName, fmt, ...) \ #define BIGFOOT_LOG_DEBUG_IF(condition, loggerName, fmt, ...) \
do \ do \
{ \ { \
@@ -7,15 +7,15 @@
#ifndef BIGFOOT_UTILS_TARGETMACROS_H #ifndef BIGFOOT_UTILS_TARGETMACROS_H
#define BIGFOOT_UTILS_TARGETMACROS_H #define BIGFOOT_UTILS_TARGETMACROS_H
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
#define BIGFOOT_WINDOWS_OR_LINUX(p_windows, p_linux) p_windows #define BIGFOOT_WINDOWS_OR_LINUX(p_windows, p_linux) p_windows
#endif #endif
#if defined BIGFOOT_LINUX #ifdef BIGFOOT_LINUX
#define BIGFOOT_WINDOWS_OR_LINUX(p_windows, p_linux) p_linux #define BIGFOOT_WINDOWS_OR_LINUX(p_windows, p_linux) p_linux
#endif #endif
#if defined BIGFOOT_WINDOWS #ifdef BIGFOOT_WINDOWS
#define BIGFOOT_ALWAYS_INLINE [[msvc::forceinline]] #define BIGFOOT_ALWAYS_INLINE [[msvc::forceinline]]
#elif defined BIGFOOT_LINUX #elif defined BIGFOOT_LINUX
#define BIGFOOT_ALWAYS_INLINE [[gnu::always_inline]] inline #define BIGFOOT_ALWAYS_INLINE [[gnu::always_inline]] inline
@@ -33,13 +33,13 @@
#define BIGFOOT_OPTIMIZED_OR_NOT(p_optimized, p_notOptimized) p_notOptimized #define BIGFOOT_OPTIMIZED_OR_NOT(p_optimized, p_notOptimized) p_notOptimized
#endif #endif
#if defined BIGFOOT_TOOLMODE #ifdef BIGFOOT_TOOLMODE
#define BIGFOOT_TOOLMODE_ONLY(...) __VA_ARGS__ #define BIGFOOT_TOOLMODE_ONLY(...) __VA_ARGS__
#define BIGFOOT_GAME_ONLY(...) #define BIGFOOT_GAME_ONLY(...)
#define BIGFOOT_GAME_OR_TOOLMODE(p_game, p_toolmode) p_toolmode #define BIGFOOT_GAME_OR_TOOLMODE(p_game, p_toolmode) p_toolmode
#endif #endif
#if defined BIGFOOT_GAME #ifdef BIGFOOT_GAME
#define BIGFOOT_TOOLMODE_ONLY(...) #define BIGFOOT_TOOLMODE_ONLY(...)
#define BIGFOOT_GAME_ONLY(...) __VA_ARGS__ #define BIGFOOT_GAME_ONLY(...) __VA_ARGS__
#define BIGFOOT_GAME_OR_TOOLMODE(p_game, p_toolmode) p_game #define BIGFOOT_GAME_OR_TOOLMODE(p_game, p_toolmode) p_game
@@ -9,7 +9,7 @@
#include <Utils/Assert/AssertHandler.hpp> #include <Utils/Assert/AssertHandler.hpp>
#include <Utils/UtilsLogger_generated.hpp> #include <Utils/UtilsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
namespace Bigfoot namespace Bigfoot
{ {
@@ -24,7 +24,7 @@ class ContainerHandleFixture: public ::testing::Test
AssetContainer<AssetA> m_containerA; AssetContainer<AssetA> m_containerA;
UUID m_uuid; UUID m_uuid;
ContainerHandle* m_handle; ContainerHandle* m_handle = nullptr;
}; };
/****************************************************************************************/ /****************************************************************************************/
+1 -1
View File
@@ -66,7 +66,7 @@ class ReferenceTypeNameGenerator
{ {
public: public:
template<typename T> template<typename T>
static std::string GetName(int) static std::string GetName([[maybe_unused]] int p_index)
{ {
if constexpr (std::is_same_v<T, HardReference<AssetA>>) if constexpr (std::is_same_v<T, HardReference<AssetA>>)
{ {
@@ -26,7 +26,7 @@ class DataAccessorFixture: public ::testing::Test
} }
DataAccessorMock m_accessor; DataAccessorMock m_accessor;
DataAccessor* m_original; DataAccessor* m_original = nullptr;
}; };
/****************************************************************************************/ /****************************************************************************************/
@@ -9,7 +9,7 @@
#include <Engine/Asset/AssetLibrary.hpp> #include <Engine/Asset/AssetLibrary.hpp>
#include <Engine/DataAccessor/DataAccessor.hpp> #include <Engine/DataAccessor/DataAccessor.hpp>
#if defined BIGFOOT_TOOLMODE #ifdef BIGFOOT_TOOLMODE
#include <Engine/BigFile/BigFile.hpp> #include <Engine/BigFile/BigFile.hpp>
#include <EngineTests/BigFileInfo_generated.hpp> #include <EngineTests/BigFileInfo_generated.hpp>
@@ -114,7 +114,7 @@ class SerializationManagerFixture: public ::testing::Test
*/ */
void Populate(const eastl::vector<AssetBase*>& p_assets) void Populate(const eastl::vector<AssetBase*>& p_assets)
{ {
#if defined BIGFOOT_TOOLMODE #ifdef BIGFOOT_TOOLMODE
m_bigFile.emplace(File {BIGFILE_ENGINETESTS_LOCATION}); m_bigFile.emplace(File {BIGFILE_ENGINETESTS_LOCATION});
m_bigFile->Clear(); m_bigFile->Clear();
@@ -200,7 +200,7 @@ class SerializationManagerFixture: public ::testing::Test
UUID m_multiRootBUUID; UUID m_multiRootBUUID;
eastl::vector<std::byte> m_multiRootBFlatbuffer; eastl::vector<std::byte> m_multiRootBFlatbuffer;
#if defined BIGFOOT_TOOLMODE #ifdef BIGFOOT_TOOLMODE
eastl::optional<BigFile> m_bigFile; eastl::optional<BigFile> m_bigFile;
#elif defined BIGFOOT_GAME #elif defined BIGFOOT_GAME
eastl::optional<Sasquatch> m_sasquatch; eastl::optional<Sasquatch> m_sasquatch;
+2 -2
View File
@@ -175,10 +175,10 @@ TEST_F(UUIDFixture, GeneratingFiveMillionUniqueID)
TEST_F(UUIDFixture, ToBytes_ShouldGiveBackTheRawDataOfTheID) TEST_F(UUIDFixture, ToBytes_ShouldGiveBackTheRawDataOfTheID)
{ {
std::span<const std::byte, UUID::UUID_BYTE_SIZE> d = m_d.ToBytes(); std::span<const std::byte, UUID::UUID_BYTE_SIZE> idBytes = m_d.ToBytes();
std::span<const std::byte, UUID::UUID_BYTE_SIZE> raw = m_raw; std::span<const std::byte, UUID::UUID_BYTE_SIZE> raw = m_raw;
EXPECT_THAT(d, ::testing::ElementsAreArray(raw)); EXPECT_THAT(idBytes, ::testing::ElementsAreArray(raw));
} }
/****************************************************************************************/ /****************************************************************************************/
+1 -1
View File
@@ -8,7 +8,7 @@
#include <UtilsTests/UtilsTestsLogger_generated.hpp> #include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <gtest/gtest.h> #include <gtest/gtest.h>
+2 -2
View File
@@ -11,7 +11,7 @@
#include <UtilsTests/UtilsTestsLogger_generated.hpp> #include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
@@ -26,7 +26,7 @@ namespace Bigfoot
class AssertHandlerFixture: public ::testing::Test class AssertHandlerFixture: public ::testing::Test
{ {
protected: protected:
std::string ReadFileSinkContent() static std::string ReadFileSinkContent()
{ {
Singleton<Log>::GetInstance().Flush(); Singleton<Log>::GetInstance().Flush();
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -85,11 +85,11 @@ TEST_F(EASTLFormattersFixture, FormatsNestedVectors)
/****************************************************************************************/ /****************************************************************************************/
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
class EASTLFormattersLogFixture: public ::testing::Test class EASTLFormattersLogFixture: public ::testing::Test
{ {
protected: protected:
std::string ReadFileSinkContent() static std::string ReadFileSinkContent()
{ {
Singleton<Log>::GetInstance().Flush(); Singleton<Log>::GetInstance().Flush();
+1 -1
View File
@@ -10,7 +10,7 @@
#include <UtilsTests/UtilsTestsLogger_generated.hpp> #include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <gtest/gtest.h> #include <gtest/gtest.h>
+2 -2
View File
@@ -10,7 +10,7 @@
#include <UtilsTests/UtilsTestsLogger_generated.hpp> #include <UtilsTests/UtilsTestsLogger_generated.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #ifdef BIGFOOT_NOT_OPTIMIZED
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
@@ -24,7 +24,7 @@ namespace Bigfoot
class LogMacrosFixture: public ::testing::Test class LogMacrosFixture: public ::testing::Test
{ {
protected: protected:
std::string ReadFileSinkContent() static std::string ReadFileSinkContent()
{ {
Singleton<Log>::GetInstance().Flush(); Singleton<Log>::GetInstance().Flush();