pub struct BackendInit<'a> {Show 20 fields
pub window: &'a Window,
pub validation: bool,
pub frames_in_flight: usize,
pub vsync: bool,
pub clear_color: [f32; 4],
pub hot_reload: bool,
pub capture: bool,
pub scene: SceneData<'a>,
pub shaders: Vec<WorldShader<'a>>,
pub media: MediaPayloads<'a>,
pub light_uniforms: LightUniforms,
pub local_lights: Vec<GpuLight>,
pub spot_shadows: Vec<SpotShadowData>,
pub area_lights: Vec<AreaLightData>,
pub shadows: ShadowParams,
pub anisotropy: u32,
pub planar_planes: usize,
pub post: PostSettings,
pub fx: WorldFx,
pub requirements: RenderRequirements,
}Expand description
Everything a backend constructor needs, assembled once by GraphicsSystem init after the world’s assets have been drained and settings resolved.
Fields§
§window: &'a WindowThe window the backend opens.
validation: boolDebug-layer toggle for the DirectX / Vulkan validation layers.
frames_in_flight: usizeFrames the backend keeps in flight.
vsync: boolWhether presentation waits for vertical blank.
clear_color: [f32; 4]Linear RGBA the target is cleared to.
hot_reload: boolTrue only under cn debug: disk-first shader resolution + watcher.
capture: boolKeep the presented frame blit-readable so screenshot can capture it.
On under the dev loop, and armed by cn run --screenshot; production
otherwise pays nothing for it (Metal leaves the drawable
framebuffer-only and retains nothing).
scene: SceneData<'a>The world’s static geometry and draw lists.
shaders: Vec<WorldShader<'a>>One entry per world Shader, indexed by the dense ShaderHandle value a
DrawObject’s shader_bucket carries; entry 0 is the world default
program. Never empty for a rendering world.
media: MediaPayloads<'a>Compiled media payloads (textures, fonts, environment maps).
light_uniforms: LightUniformsThe fixed directional / point light arrays.
local_lights: Vec<GpuLight>Every local light (point + spot + area) for the clustered forward pass,
uploaded to a per-scene GpuLight storage buffer. The first MAX_POINT_LIGHTS
point lights are also mirrored into light_uniforms.point for the
raymarch / fog / probe paths that still read the fixed array.
spot_shadows: Vec<SpotShadowData>One entry per spot shadow map slice, indexed by GpuLight.shadow_index.
Empty when no spot light casts shadows, in which case the backend skips
allocating the shadow array entirely.
area_lights: Vec<AreaLightData>One entry per rectangular area light, indexed by GpuLight.data_index.
Empty when the world declares none.
shadows: ShadowParamsShadow-mapping settings.
anisotropy: u32Scene-sampler max anisotropy, clamped to the GPU’s range at init.
planar_planes: usizeDistinct planar-reflection plane budget from the quality preset / GPU tier ceiling; reflectors past it fall back to the probe cube.
post: PostSettingsPost-process and display settings.
fx: WorldFxWorld-authored effect content.
requirements: RenderRequirementsDerived by resolve_requirements(); the conservative default assumes a
full scene so a caller that skips resolution never under-allocates.
Implementations§
Source§impl<'a> BackendInit<'a>
impl<'a> BackendInit<'a>
Sourcepub fn minimal(
window: &'a Window,
text_atlases: Vec<(u32, u32, Vec<u8>)>,
) -> Self
pub fn minimal( window: &'a Window, text_atlases: Vec<(u32, u32, Vec<u8>)>, ) -> Self
A backend carrying nothing but a window and glyph atlases: no geometry,
no textures, no lights, no effects. The single shader entry has empty
stage bytes, which every backend resolves to its built-in default
program. resolve_requirements then trims every scene-scoped feature.
This is the startup error screen’s path, which has to stand up a window with no compiled world data at all. Keeping it here means the field defaulting is maintained beside the struct it fills.
Sourcepub fn swapchain_config(&self) -> SwapchainConfig
pub fn swapchain_config(&self) -> SwapchainConfig
The swapchain-level configuration this world needs. Compared against a
transplanted backend’s RenderBackend::hot_swap_config to decide whether
a live SAVE can reuse the existing window (reload_world) or must rebuild.
Sourcepub fn resolve_requirements(&mut self)
pub fn resolve_requirements(&mut self)
Derive the requirements from the assembled content and trim scene-scoped features accordingly. Runtime spawning can only clone assets already declared in the world, so the derivation here is complete: a world with no scene content at init can never grow one.