| 255 | } |
| 256 | |
| 257 | void 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 | |
| 289 | void sugoi_storage_t::deserialize(skr_binary_reader_t* s) |
| 290 | { |
no test coverage detected