pub(crate) mod access_ids;
pub(crate) mod by_asset_id;
#[cfg(test)]
mod consumed_columns_tests;
pub(crate) mod decompose;
#[cfg(test)]
mod determinism_tests;
#[cfg(test)]
mod headless_drift_tests;
mod registry;
pub mod schedule;
mod world_queries;
pub use concinnity_core::ecs::{
Access, Arena, AudioClipHandle, BlobAssetDef, ColumnTicks, Component, ComponentAsset,
ComponentId, ComponentMask, ComponentSlot, ComponentStorage, Entity, EventCursor, EventStore,
Events, FontHandle, FrameContext, FrameVec, MAX_CHANGE_AGE, MaterialHandle, MeshBoundsRecord,
MeshHandle, PayloadLocator, PipelineContext, Resources, RuntimeComponent, SceneGroup,
ScratchStats, SkinnedMeshHandle, TextureHandle, Tick,
};
pub use concinnity_host::thread::asset_id;
pub use concinnity_core::ecs::{
CursorShape, CursorState, DesiredCursor, DropdownView, ExecutionTrace, FlyCam, FrameRateCap,
GpuMemoryPressure, HiddenAssets, HudLayers, HudPrefs, MenuActive, MenuOverride, OpenDropdown,
OverlayImage, OverlayImages, PickEntry, PickIndex, ScheduleMode, ScreenStack, SimTiming,
TraceEvent, TracePath, TracePaths, TraceRequest, TraceStep, TraceVal, TransientSaves,
ViewOverrides, WorldLines,
};
pub use concinnity_core::ecs::{BuiltSystem, SystemEntry, SystemTable};
pub use registry::SYSTEMS;
pub use concinnity_core::ecs::World;
pub use world_queries::{
gpu_profile, memory_budget, memory_drift, renders, state_tree, streaming_pressure,
streaming_stats, systems_and_render_backend, take_render_backend, thread_budget,
};
pub use concinnity_core::ecs::{Clock, StepResult, System};
pub struct PendingBackend(pub Box<dyn crate::gfx::backend::RenderBackend>);
#[derive(Default)]
pub(crate) struct InputMailbox(pub Option<concinnity_core::render::input::InputPacket>);
impl InputMailbox {
pub(crate) fn deposit(&mut self, packet: concinnity_core::render::input::InputPacket) {
match &mut self.0 {
Some(pending) => pending.merge_from(packet),
None => self.0 = Some(packet),
}
}
}
pub(crate) struct RenderQueues {
pub ops: concinnity_core::render::ops::RenderOps,
pub slots: crate::gfx::render_slots::RenderSlots,
}
#[derive(Clone, Copy)]
pub(crate) struct ActiveDeviceCaps(pub concinnity_core::render::backend::DeviceCapabilities);
pub(crate) struct ActiveRenderQueues(pub Option<RenderQueues>);
impl ActiveRenderQueues {
pub(crate) fn take(resources: &mut Resources) -> Option<RenderQueues> {
resources.get_mut::<Self>()?.0.take()
}
pub(crate) fn put(resources: &mut Resources, queues: RenderQueues) {
match resources.get_mut::<Self>() {
Some(slot) => slot.0 = Some(queues),
None => {
resources.insert(Self(Some(queues)));
}
}
}
}
#[derive(Default)]
pub(crate) struct RenderOpFailures(pub Vec<concinnity_core::render::ops::OpFailure>);
pub(crate) struct PipelinedFrames(pub Option<PipelineChannels>);
pub(crate) struct PipelineChannels {
pub(crate) snapshot_tx:
std::sync::mpsc::SyncSender<concinnity_core::render::snapshot::RenderSnapshot>,
pub(crate) feedback_rx:
std::sync::mpsc::Receiver<concinnity_core::render::feedback::FrameFeedback>,
}
impl PipelinedFrames {
pub(crate) fn take(resources: &mut Resources) -> Option<PipelineChannels> {
resources.get_mut::<Self>()?.0.take()
}
pub(crate) fn put(resources: &mut Resources, channels: PipelineChannels) {
match resources.get_mut::<Self>() {
Some(slot) => slot.0 = Some(channels),
None => {
resources.insert(Self(Some(channels)));
}
}
}
}
pub struct ActiveRenderBackend(pub Option<Box<dyn crate::gfx::backend::RenderBackend>>);
impl ActiveRenderBackend {
pub(crate) fn take(
resources: &mut Resources,
) -> Option<Box<dyn crate::gfx::backend::RenderBackend>> {
resources.get_mut::<Self>()?.0.take()
}
pub(crate) fn put(
resources: &mut Resources,
backend: Box<dyn crate::gfx::backend::RenderBackend>,
) {
match resources.get_mut::<Self>() {
Some(slot) => slot.0 = Some(backend),
None => {
resources.insert(Self(Some(backend)));
}
}
}
}
pub(crate) struct ActiveSceneFlow {
pub flow: Option<crate::gfx::scene_flow::SceneFlow>,
pub(crate) epoch: std::time::Instant,
}
pub struct BlobSceneGroups(pub Vec<crate::ecs::SceneGroup>);
pub struct BlobMeshBounds(pub Vec<MeshBoundsRecord>);
pub(crate) struct SceneResidencyStatus {
pub scenes: Vec<(
asset_id::AssetId,
crate::gfx::scene_residency::SceneLoadState,
f32,
)>,
}
#[derive(Debug, Clone, Default)]
pub(crate) struct DisabledSettingRows(pub std::collections::HashSet<String>);
#[derive(Debug, Clone, Default)]
pub(crate) struct DisplayModes(pub Vec<crate::gfx::display_mode::DisplayMode>);
#[macro_export]
macro_rules! define_systems {
( complete_world: $complete_world:path,
before_init: $before_init:path,
prepare_events: $prepare_events:path,
$( $name:ident => $behavior:path {
gate: $gate:path,
present_when: $present_when:literal,
after: [ $( $after:ident ),* $(,)? ],
before: [ $( $before:ident ),* $(,)? ] $(,)?
} ),* $(,)? ) => {
pub const SYSTEMS: &$crate::ecs::SystemTable = &$crate::ecs::SystemTable {
entries: &[
$( $crate::ecs::SystemEntry {
name: stringify!($name),
present_when: $present_when,
gate: {
fn build(
world: &$crate::ecs::World,
) -> Option<::std::boxed::Box<dyn $crate::ecs::System>> {
let built: Option<$behavior> = $gate(world);
built.map(|s| -> ::std::boxed::Box<dyn $crate::ecs::System> {
::std::boxed::Box::new(s)
})
}
build
},
after: &[ $( stringify!($after) ),* ],
before: &[ $( stringify!($before) ),* ],
}, )*
],
complete_world: Some($complete_world),
before_init: Some($before_init),
prepare_events: Some($prepare_events),
};
};
}