Skip to content

Engine → ECS → archetype.h

chunk_layout

Syntax

struct CONJURE_API chunk_layout

Variables

AccessNameTypeDefaultDescription
publiccapacityu320
publiccolumnIndexstd::array<u16, MAX_COMPONENTS>make_empty_column_index()
publiccolumnOffsetscore::small_vector<u32, 16>{}
publiccolumnSizescore::small_vector<u32, 16>{}
publiccomponentscore::small_vector<component_id, 16>{}
publicNO_COLUMNstatic constexpr u160xFFFF

Functions

Public

block_end

[[nodiscard]] u32 block_end() const noexcept;

Byte offset one past the last column (the used part of the block).

column_count

[[nodiscard]] u32 column_count() const noexcept;

Number of data columns (tags excluded).

column_of

[[nodiscard]] u16 column_of(
    component_id id) const noexcept;

The column of a component id, or NO_COLUMN when the archetype lacks it or it is a tag.

compute

[[nodiscard]] static core::result<chunk_layout> compute(
    const component_mask &mask,
    const component_registry &registry);

Computes the maximal layout for a mask: rowBytes = sizeof(entity) + sum of sizes, capacity starts at CHUNK_SIZE / rowBytes and decrements until every aligned column fits the block. ARCHETYPE_TOO_LARGE when not even one row fits, UNKNOWN_COMPONENT for an id the registry does not know. A capacity below SMALL_CAPACITY_WARNING logs one WARN.

make_empty_column_index

[[nodiscard]] static constexpr std::array<u16, MAX_COMPONENTS> make_empty_column_index() noexcept;

An index table with every id mapped to NO_COLUMN.

row_bytes

[[nodiscard]] u32 row_bytes() const noexcept;

Bytes one row occupies across every column, entity included.