Skip to main content

Module resolver

Module resolver 

Source
Expand description

Name -> id resolution seam.

A reference deserializes either from an already-resolved integer id (the compiled-args / runtime form) or from a name string (the authoring form). Turning a name into a dense id is engine policy – the build assigns ids in world declaration order – so this data crate does not own it. concinnity-host installs a resolver here, backed by its build-time interner, before it deserializes named references. A name seen with no resolver installed is a configuration error, surfaced as a deserialization failure (the resolver is always installed during a build; only an out-of-engine tool reading authoring JSON would hit the unset case).

Each resolver is a plain function pointer held in an atomic, so this stays no_std and thread-safe: the pointer is written once (install) and only read afterward, and the installed function keeps its own (per-thread) state in concinnity-host. The two slot types below centralize the single unavoidable piece of unsafe – core has no atomic function-pointer type, so reading a fn back out of a usize requires a transmute – into one audited place per function-pointer shape.

Functions§

set_audio_clip_handle_resolver
Install the name -> audio-clip-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered audio-clip handle map. Idempotent; the last writer wins.
set_font_handle_resolver
Install the name -> font-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered font handle map. Idempotent; the last writer wins.
set_material_handle_resolver
Install the name -> material-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered material handle map. Idempotent; the last writer wins.
set_mesh_handle_resolver
Install the name -> mesh-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered mesh handle map. Idempotent; the last writer wins. The mesh-source handle space is shared across every geometry-producing kind (Mesh, ProceduralMesh, VoxelChunk, and mesh-kind File), so one resolver serves them all.
set_name_resolver
Install the name -> id resolver. Called once by concinnity-host, backed by its build-time interner. Idempotent; the last writer wins.
set_shader_handle_resolver
Install the name -> shader-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered shader handle map. Idempotent; the last writer wins. A Shader stays an ECS component, but a Material’s authored shader reference resolves to its dense handle so the runtime never scans by name.
set_skinned_mesh_handle_resolver
Install the name -> skinned-mesh-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered skinned-mesh handle map. Idempotent; the last writer wins. A SkinnedMesh stays an ECS component, but its authored references (Animation.target, AnimationGraph.target, FollowController.target) resolve to its dense handle so they no longer carry an interned id.
set_texture_handle_resolver
Install the name -> texture-handle resolver. Called by concinnity-cook, backed by the current build’s declaration-ordered texture handle map. Idempotent; the last writer wins.