BigFile/Sasquatch #1
@@ -107,6 +107,11 @@ class SasquatchWriter
|
||||
*/
|
||||
std::size_t m_prefetchedUpTo;
|
||||
|
||||
/**
|
||||
* Current write position in the data region
|
||||
*/
|
||||
std::size_t m_currentDataOffset;
|
||||
|
||||
/**
|
||||
* The Sasquatch file being written, mapped at its final size
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ SasquatchWriter::SasquatchWriter(const File& p_file,
|
||||
const std::size_t p_totalHardReferencesBytes):
|
||||
m_assetCount(p_assetCount),
|
||||
m_prefetchedUpTo(0),
|
||||
m_currentDataOffset(sizeof(SasquatchHeader) + m_assetCount * sizeof(SasquatchEntry)),
|
||||
m_file(p_file,
|
||||
sizeof(SasquatchHeader) + m_assetCount * sizeof(SasquatchEntry) + p_totalFlatbufferBytes +
|
||||
p_totalHardReferencesBytes)
|
||||
@@ -63,13 +64,7 @@ void SasquatchWriter::WriteAsset(const UUID& p_uuid,
|
||||
"SasquatchWriter can only hold {} assets",
|
||||
m_assetCount);
|
||||
|
||||
const std::size_t offset = std::accumulate(m_entries.begin(),
|
||||
m_entries.end(),
|
||||
sizeof(SasquatchHeader) + m_assetCount * sizeof(SasquatchEntry),
|
||||
[](const std::size_t p_value, const SasquatchEntry& p_entry)
|
||||
{
|
||||
return p_value + p_entry.m_assetSize + p_entry.m_hardReferencesSize;
|
||||
});
|
||||
const std::size_t offset = m_currentDataOffset;
|
||||
|
||||
const eastl::span<std::byte> data = m_file.GetData();
|
||||
ASSERT(EngineAssertHandler,
|
||||
@@ -102,6 +97,7 @@ void SasquatchWriter::WriteAsset(const UUID& p_uuid,
|
||||
UUID::UUID_BYTE_SIZE);
|
||||
}
|
||||
|
||||
m_currentDataOffset += entry.m_assetSize + entry.m_hardReferencesSize;
|
||||
m_entries.push_back(entry);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user