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

Function sugoiV_get_owned

modules/engine/runtime/src/ecs/chunk_view.cpp:724–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

722
723template <bool readonly, bool local>
724auto sugoiV_get_owned(const sugoi_chunk_view_t* view, sugoi_type_index_t type)
725{
726 using namespace sugoi;
727 using return_type = std::conditional_t<readonly, const void*, void*>;
728 if (type_index_t(type).is_tag()) SUGOI_UNLIKELY
729 return (return_type) nullptr;
730 auto chunk = view->chunk;
731 auto structure = chunk->type;
732 SIndex id;
733 if constexpr (local)
734 id = type;
735 else
736 id = structure->index(type);
737 if (id == kInvalidSIndex)
738 return (return_type) nullptr;
739 if constexpr (!readonly)
740 chunk->timestamps()[id] = structure->storage->timestamp;
741 auto scheduler = structure->storage->scheduler;
742 if (scheduler && scheduler->is_main_thread(structure->storage))
743 SKR_ASSERT(!scheduler->sync_entry(structure, id, readonly));
744 EIndex offset = 0;
745 if (!type_index_t(type).is_chunk())
746 offset = structure->sizes[id] * view->start;
747 return (return_type)(chunk->data() + offset + structure->offsets[chunk->pt][id]);
748}
749
750extern "C" {
751const void* sugoiV_get_component_ro(const sugoi_chunk_view_t* view, sugoi_type_index_t type)

Callers

nothing calls this directly

Calls 8

type_index_tClass · 0.85
is_tagMethod · 0.80
timestampsMethod · 0.80
is_main_threadMethod · 0.80
sync_entryMethod · 0.80
is_chunkMethod · 0.80
indexMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected