Skip to content

Engine → Bindings

native_api_entries.h

The bindings-owned entries of the native table.

Structs

File Description
binding_context Non-owning view of the engine services the entries act on. A null pointer means the subsystem is compiled out or disabled: fill_native_table then installs stubs for the groups that need it. Every pointer is stable from application::initialise() to shutdown().
stubs::stub_thunk<Id, Ret(Args...)>

Forward Declarations

asset_database

class asset_database;

asset_manager

class asset_manager;

audio_engine

class audio_engine;

component_registry

class component_registry;

debug_draw

class debug_draw;

diagnostics::check_registry

class check_registry;

engine_context

struct engine_context;

engine_time

struct engine_time;

frame_stats

class frame_stats;

input

class input;

jobs::job_system

class job_system;

module_registry

class module_registry;

physics_world

class physics_world;

render_defaults

class render_defaults;

renderer

class renderer;

scene_manager

class scene_manager;

script_runtime

class script_runtime;

stubs::stub_thunk

template <native_function_id Id, typename Fn> struct stub_thunk;

window

class window;

world

class world;

Constants

Name Type Value Description
BINDINGS_ENTRY_COUNT inline constexpr u32 CONJURE_NATIVE_API_ENTRY_COUNT - CONJURE_NATIVE_API_CORE_ENTRY_COUNT Number of bindings-owned entries (everything after the marker of native_api.inl).
BINDINGS_GROUP_COUNT inline constexpr u32 13 Number of groups the bindings own.

Macros

entries::CONJURE_BINDINGS_FOR_EACH_ENTRY

CONJURE_BINDINGS_FOR_EACH_ENTRY(CONJURE_BINDINGS_DECLARE_ENTRY)

Functions

Public

active_context

[[nodiscard]] CONJURE_API const binding_context &active_context() noexcept;

The context the last fill_native_table installed (every pointer null before the first fill).

clear_active_context

CONJURE_API void clear_active_context() noexcept;

Forgets the active context (shutdown; the entries then answer NOT_SUPPORTED).

detail::clear_frame_failure_log

CONJURE_API void clear_frame_failure_log() noexcept;

Forgets which entries logged a failure this frame (begin_frame).

detail::fail_entry

[[nodiscard]] CONJURE_API int32_t fail_entry( native_function_id id, bindings_error code, std::string_view detail = {} ) noexcept;

fail() for an entry by id: records the failure and, outside Distribution, logs it at DEBUG once per entry per frame (a dead-entity loop cannot flood the console).

[[nodiscard]] CONJURE_API int32_t fail_entry(native_function_id id, const core::error &failure) noexcept;

fail_entry with the code and message of a core::error from a called module.

detail::failure_logged_this_frame

[[nodiscard]] CONJURE_API bool failure_logged_this_frame(native_function_id id) noexcept;

True when the entry already logged a failure since the last clear_frame_failure_log.

fill_native_table

[[nodiscard]] CONJURE_API core::result<void> fill_native_table(
    conjure_native_api &api,
    const binding_context &context);

Fills every bindings-owned slot of api: the real implementation when the group is compiled in and available, the stub otherwise. A slot already holding a foreign pointer (a plugin's native_binding_desc) is overridden with a WARN when the group is compiled in and kept when it is compiled out. Core-owned slots are never touched. Installs context as the active context (one table per process). Idempotent. Fails with TABLE_INCOMPLETE when an owned slot is still null afterwards (only reachable with a broken build).

group_available

[[nodiscard]] CONJURE_API bool group_available(
    std::string_view group,
    const binding_context &context) noexcept;

True when the group's real implementations have what they need in context (the world and the scene manager for transform, entity, scene, prefab and camera; the physics world; the audio engine and the world; the input and the window; the asset manager; the module registry; the world for render, whose entry answers NOT_SUPPORTED itself while renderDefaults is null); the diagnostics group and the rendering group (whose entries answer for a null renderer themselves) are always available. Unknown groups are never available.

group_compiled

[[nodiscard]] CONJURE_API bool group_compiled(
    std::string_view group) noexcept;

True when the module behind the group is compiled into this build (CONJURE_BINDINGS_GROUP_COMPILED).

is_counting_installed

[[nodiscard]] CONJURE_API bool is_counting_installed(
    const conjure_native_api &api,
    native_function_id id) noexcept;

True when the slot of id holds the entry's counting thunk.

is_implementation_installed

[[nodiscard]] CONJURE_API bool is_implementation_installed(
    const conjure_native_api &api,
    native_function_id id) noexcept;

True when the slot of id holds the entry's real implementation (directly or behind its thunk).

is_scope_hook_installed

[[nodiscard]] CONJURE_API bool is_scope_hook_installed(
    const conjure_native_api &api) noexcept;

True while the scope-end hook of wrap_with_counters sits over query_end. False again after script_runtime::initialise refilled the core slots (a runtime re-initialised after shutdown()), which is the signal to call wrap_with_counters once more.

is_stub_installed

[[nodiscard]] CONJURE_API bool is_stub_installed(
    const conjure_native_api &api,
    native_function_id id) noexcept;

True when the slot of id holds the entry's stub (directly or behind its counting thunk).

stubs::report_not_supported

[[nodiscard]] CONJURE_API int32_t report_not_supported(native_function_id id) noexcept;

Records "<entry>: subsystem unavailable" as the last error and returns -NOT_SUPPORTED.

wrap_with_counters

CONJURE_API void wrap_with_counters(
    conjure_native_api &api) noexcept;

Replaces every non-null slot (core-owned ones included) with its counting_thunk and remembers the original as the thunk's target, then installs the scope-end hook over query_end that applies the scene fixups of the locked entries. A slot already pointing at its thunk is left alone and the hook is re-installed over whatever it already covered, so a second call never double-counts and never chains the hook behind itself. In Distribution only the hook is installed.