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

Method sync_archetype

modules/engine/runtime/src/ecs/scheduler.cpp:65–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool sugoi::scheduler_t::sync_archetype(sugoi::archetype_t* type)
66{
67 SKR_ASSERT(is_main_thread(type->storage));
68 // TODO: performance optimization
69 skr::stl_vector<skr::task::event_t> deps;
70 {
71 SMutexLock entryLock(entryMutex.mMutex);
72 auto pair = dependencyEntries.find(type);
73 if (pair == dependencyEntries.end())
74 {
75 return false;
76 }
77 auto entries = pair->second.data();
78 auto count = type->type.length;
79 forloop (i, 0, count)
80 {
81 if (type_index_t(type->type.data[i]).is_tag())
82 break;
83 for (auto dep : entries[i].owned)
84 if(auto ptr = dep.lock())
85 deps.push_back(ptr);
86 for (auto p : entries[i].shared)
87 if(auto ptr = p.lock())
88 deps.push_back(ptr);
89 entries[i].shared.clear();
90 entries[i].owned.clear();
91 }
92 dependencyEntries.erase(pair);
93 }
94 for (auto dep : deps)
95 dep.wait(true);
96 return !deps.empty();
97}
98
99bool sugoi::scheduler_t::sync_entry(sugoi::archetype_t* type, sugoi_type_index_t i, bool readonly)
100{

Callers 6

allocateMethod · 0.80
destroyMethod · 0.80
instantiateMethod · 0.80
castMethod · 0.80
deserialize_singleMethod · 0.80
serialize_prefabMethod · 0.80

Calls 11

type_index_tClass · 0.85
is_tagMethod · 0.80
findMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
lockMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
eraseMethod · 0.45
waitMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected