MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / serialize

Method serialize

modules/engine/runtime/src/ecs/serialize.cpp:257–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void sugoi_storage_t::serialize(skr_binary_writer_t* s)
258{
259 SkrZoneScopedN("sugoi_storage_t::serialize");
260 using namespace sugoi;
261 namespace bin = skr::binary;
262 if(scheduler)
263 {
264 SKR_ASSERT(scheduler->is_main_thread(this));
265 scheduler->sync_storage(this);
266 }
267 {
268 SkrZoneScopedN("serialize entities");
269 bin::Archive(s, (uint32_t)entities.entries.size());
270 bin::Archive(s, (uint32_t)entities.freeEntries.size());
271 ArchiveBuffer(s, entities.freeEntries.data(), static_cast<uint32_t>(entities.freeEntries.size()));
272 }
273 bin::Archive(s, (uint32_t)groups.size());
274 for (auto& pair : groups)
275 {
276 SkrZoneScopedN("serialize group");
277 auto group = pair.second;
278 serialize_type(group->type, s, true);
279 bin::Archive(s, (uint32_t)group->chunks.size());
280 for(auto c : group->chunks)
281 {
282 SkrZoneScopedN("serialize chunk");
283 sugoi_chunk_view_t view = { c, 0, c->count };
284 serialize_view(group, view, s, nullptr, true);
285 }
286 }
287}
288
289void sugoi_storage_t::deserialize(skr_binary_reader_t* s)
290{

Callers 1

sugoiS_serializeFunction · 0.45

Calls 6

ArchiveFunction · 0.85
ArchiveBufferFunction · 0.85
is_main_threadMethod · 0.80
sync_storageMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected