Expand description
High-level renderer API and shared modules.
§The scene-schema feature (optional schema → runtime bridge)
awsm-renderer-scene is the pure-data,
on-disk authoring format (EditorProject, saved as project.json). The
renderer holds the runtime equivalents of those types. Enabling the
scene-schema feature pulls in awsm-renderer-scene (an optional dep) and
compiles a set of From<awsm_renderer_scene::*> impls so a consumer can convert
authored data into renderer config with a single .into():
let project: awsm_renderer_scene::EditorProject = serde_json::from_str(&text)?;
renderer.set_shadows_config(project.shadows.into());It is off by default: a bare runtime consumer never pays for the schema
crate, and the editor frontends keep their own bridges. It exists mainly for
standalone players that load EditorProject bundles and want first-party
conversion that lives next to the runtime structs (so it can never drift).
§Adding more conversions
This is an extension point, not a one-off. Today the only bridge is
shadows (shadows::schema_convert, gated by #[cfg(feature = "scene-schema")]). To bridge another subsystem (environment, lights,
materials, …), add a feature-gated schema_convert module beside that
subsystem’s runtime types and write the From impls there, following
shadows::schema_convert as the template. Keeping each bridge next to the
structs it maps is what stops the conversions from rotting.
Re-exports§
pub use dynamic_materials::BucketConfig;pub use load_phase::LoadPhase;pub use loading::LoadPhase as CommitLoadPhase;pub use loading::LoadingStats;
Modules§
- animation
- anti_
alias - Anti-aliasing configuration.
- bind_
group_ layout - Bind group layout caching.
- bind_
groups - Bind group recreation coordination.
- bounds
- Axis-aligned bounding boxes.
- buffer
- camera
- Camera buffers and matrices.
- cameras
- Per-camera parameter store.
- cluster_
lod - Runtime cluster-LOD (Phase B): the loaded cluster DAG + the LOD-cut
selection. The CPU
select_cuthere is the reference spec for the GPU compute pass (B.2) — the same per-cluster rule runs on-device against the uploaded cluster pages. Inert unless thevirtual_geometryfeature loads a cluster mesh. - core
- coverage
- Last-frame pixel coverage per mesh.
- debug
- Debug helpers and logging flags.
- decals
- Projection decals.
- dynamic_
materials - Unified material variant registry (the specialize-only design).
- environment
- Environment and skybox helpers.
- error
- Renderer error types and results.
- features
- Opt-in renderer features picked at construction time.
- frame_
globals - Renderer-wide per-frame state —
time,delta_time,frame_count,resolution. - frustum
- Frustum extraction and culling helpers.
- instances
- GPU instancing data and buffers.
- light_
buckets - Per-light → per-mesh AABB-overlap buckets + GPU upload, used by the visibility-buffer-native lighting path.
- lights
- Lighting data and GPU uploads.
- load_
phase - Coarse load-time progress phases a scene/asset loader reports so a host can show “what’s happening now” while a bundle or model materializes.
- loading
- The load-transaction progress surface.
- lod
- Discrete level-of-detail: per-mesh simplified level chains + screen-error level selection.
- materials
- Material storage + GPU upload management.
- mesh_
pack - The single GPU-buffer packer for the visibility + transparency geometry
streams (see
docs/buffers.md). - meshes
- Mesh storage and GPU buffer management.
- opaque_
mipgen - Per-frame box-filter mipmap generator for the opaque render target.
- optimization_
policy - Adaptive runtime policy on top of the build-time
RendererFeatures. - picker
- GPU picking support for mesh selection.
- pipeline_
layouts - Pipeline layout caching.
- pipeline_
scheduler - Pipeline-readiness scheduler.
- pipelines
- Pipeline caches for render and compute passes.
- post_
process - Post-processing configuration and updates.
- profile
- Coarse-grained renderer profile — one knob that flips a coordinated set of defaults across anti-aliasing, shadows, post-processing, features, optimization policy, edge-budget, scene-spatial cadence, and depth format.
- raw_
mesh - Public raw-mesh upload API.
- render
- Render entry points and render context.
- render_
passes - Render pass orchestration and initialization.
- render_
textures - Render texture allocation and management.
- renderable
- Renderable collection and draw helpers.
- scene_
spatial - Spatial index for renderer-owned scene queries.
- shaders
- Shader cache and template helpers.
- shadows
- Shadow mapping subsystem.
- textures
- Texture management and GPU uploads.
- transforms
- Transform hierarchy and GPU upload.
- update
- web_
global - Runtime-global picking helpers — bridges the main-thread
web_sys::Windowand workerweb_sys::DedicatedWorkerGlobalScopeAPIs behind a single call surface so the same renderer source works in both contexts (theweb_sys::OffscreenCanvasworker-mode deployment shipped in Phase 4.4 needs the worker side of everynavigator/performance/requestAnimationFramecall). - workers
- Library-wide worker-job infrastructure.
Structs§
- Awsm
Renderer - Main renderer state and GPU resources.
- Awsm
Renderer Builder - Builder for
AwsmRenderer. - Cluster
CutReadback - Verification of the Phase B per-cluster GPU cut+compaction: reads
draw_args.index_countback and logs the drawn cut size (a sanity check vs the testedselect_cut_per_cluster).inflightsingle-buffers themapAsync. Re-fires on a cadence (frame 5, then every 30) — NOT one-shot — so the drawn cut is observable as the camera/scene change (Gap-B paging A2 + the A3 cut-vs-source numbers); the async handler logs only when the value changes (last_value, init-1). - Coverage
Readback State - Per-frame state for the GPU coverage readback loop.
- Edge
Overflow Readback State - Per-frame state for the MSAA edge-budget overflow readback loop.
- Froxel
Overflow Readback State - Mirror of
EdgeOverflowReadbackStatefor the GPU light-culling per-froxel capacity auto-grow loop. The cull shader atomic-adds intoLightCullingBuffers::overflow_bufferevery time it bumps a froxel’s count pastmax_per_froxel_capacity; the host records acopy_buffer_to_bufferinto the per-frame command encoder, thenmapAsync’s the staging copy. When the resolved value is non-zero, the next render preamble callscrate::AwsmRenderer::set_max_per_froxel_capacity(current * 2)so subsequent frames have headroom. Single-buffered (inflightgates the next kick). - Renderer
Config Spec - Immutable snapshot of every build-time config knob the embedder chose — the
declare→commit-for-config analog of the load transaction. Captured at
build()and stored onAwsmRenderer;AwsmRenderer::remove_allrebuilds straight from it viaAwsmRendererBuilder::from_spec, so a scene-data wipe can NEVER silently drop a config (the historical hand-copy inremove_allrepeatedly did — bucket cap, shadow-K, brdf-lut, env colors).
Enums§
- Awsm
Renderer GpuBuilder Kind - WebGPU builder input for
AwsmRendererBuilder. - Renderer
Loading Phase - Coarse-grained stages the renderer passes through during
AwsmRendererBuilder::build. Subscribers passed viaAwsmRendererBuilder::with_phase_handlerget a callback at each transition; consumer UIs can map these to whatever progress message they want to show.
Statics§
- COMPATIBITLIY_
REQUIREMENTS - Compatibility requirements for this renderer.
Functions§
- edge_
resolve_ supported - Returns true if the device can host the Stage 3 / Priority 3 per-shader-id MSAA edge-resolve pipelines.
Type Aliases§
- Renderer
Loading Phase Handler - Boxed phase-transition callback handed to the builder via
AwsmRendererBuilder::with_phase_handler. wasm is single-threaded so we don’t needSend + Sync.