Skip to main content

BackendInit

Struct BackendInit 

Source
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 Window

The window the backend opens.

§validation: bool

Debug-layer toggle for the DirectX / Vulkan validation layers.

§frames_in_flight: usize

Frames the backend keeps in flight.

§vsync: bool

Whether presentation waits for vertical blank.

§clear_color: [f32; 4]

Linear RGBA the target is cleared to.

§hot_reload: bool

True only under cn debug: disk-first shader resolution + watcher.

§capture: bool

Keep 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: LightUniforms

The 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: ShadowParams

Shadow-mapping settings.

§anisotropy: u32

Scene-sampler max anisotropy, clamped to the GPU’s range at init.

§planar_planes: usize

Distinct planar-reflection plane budget from the quality preset / GPU tier ceiling; reflectors past it fall back to the probe cube.

§post: PostSettings

Post-process and display settings.

§fx: WorldFx

World-authored effect content.

§requirements: RenderRequirements

Derived 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>

Source

pub fn minimal( window: &'a Window, text_atlases: Vec<(u32, u32, Vec<u8>)>, ) -> BackendInit<'a>

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for BackendInit<'a>

§

impl<'a> RefUnwindSafe for BackendInit<'a>

§

impl<'a> Send for BackendInit<'a>

§

impl<'a> Sync for BackendInit<'a>

§

impl<'a> Unpin for BackendInit<'a>

§

impl<'a> UnsafeUnpin for BackendInit<'a>

§

impl<'a> UnwindSafe for BackendInit<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more