Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
AotHost.hpp File Reference

The host half of the Estella ABI. More...

#include <cstddef>
#include <cstdint>
#include <functional>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "estella_abi.h"
Include dependency graph for AotHost.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esengine::aot::WorldStamp
struct  esengine::aot::QuerySpec
class  esengine::aot::CallArena
struct  esengine::aot::RowSpan
struct  esengine::aot::BoundSystem

Namespaces

namespace  esengine
namespace  esengine::aot

Typedefs

using esengine::aot::SystemFn = void (*)(es_addr_t)
using esengine::aot::ComponentAt = std::function<void*(std::uint32_t)>
using esengine::aot::Candidates = std::optional<std::span<const std::uint32_t>>
using esengine::aot::CandidatesOf = std::function<Candidates()>
using esengine::aot::ResourceLookup = std::function<void*(const char*)>
using esengine::aot::ComponentLookup = std::function<ComponentAt(const char*)>
using esengine::aot::CandidateLookup = std::function<CandidatesOf(const char*)>

Functions

Candidates esengine::aot::narrowest (const QuerySpec &spec)
bool esengine::aot::narrows (std::span< const QuerySpec > queries)
std::span< const EsCmd > esengine::aot::run (SystemFn fn, std::span< const std::uint32_t > fallback, std::span< const QuerySpec > queries, std::span< void *const > resources, CallArena &arena, WorldStamp world={})
void * esengine::aot::rowAt (const RowSpan &span, std::uint32_t entity)
ComponentAt esengine::aot::fromRows (const RowSpan &span)
ComponentAt esengine::aot::fromMovingRows (const RowSpan *slot)
CandidatesOf esengine::aot::fromMovingOwners (const RowSpan *slot)
BoundSystem esengine::aot::bind (const EsSystemDecl &decl, const ComponentLookup &components, const ResourceLookup &resources, const CandidateLookup &candidates={})
std::span< const EsCmd > esengine::aot::runBound (const BoundSystem &bound, std::span< const std::uint32_t > fallback, const ResourceLookup &resources, CallArena &arena, WorldStamp world={}, bool *runnable=nullptr)
std::uint64_t esengine::aot::abiHash (std::uint64_t contract)

Variables

constexpr std::uint32_t esengine::aot::NO_OWNER = 0xFFFFFFFFu

Detailed Description

The host half of the Estella ABI.

A compiled system calls the engine ZERO times, which means everything it reads has to be in memory before the call. This puts it there: pack the rows, resolve the resource addresses, zero the count, fill the SysCtx, call, and hand back what the system wrote.

It does not know about Registry. A component is reached through a resolver the caller supplies, because the caller is where the component's TYPE is known — and that is also what lets this be tested without linking the engine.

The arena is reused across calls and rebuilt in each one, because a row array has a one-call lifetime. Nothing here allocates per row after the first frame at a given size.

A row table is a function of two things: which entities match, and where their components are. narrowest answers the first; WorldStamp answers the second, and when neither moved last frame's rows are this frame's. Same model as the web road (sdk/src/ecs/aot/AotDispatch.ts), reached through different doors.

Definition in file AotHost.hpp.