Skip to main content

ShadowsLaneState

Struct ShadowsLaneState 

Source
pub struct ShadowsLaneState {
    pub pipeline: RwLock<Option<RenderPipelineId>>,
    pub camera_layout: RwLock<Option<BindGroupLayoutId>>,
    pub model_layout: RwLock<Option<BindGroupLayoutId>>,
    pub atlas_2d: Atlas2D,
    pub atlas_cube: AtlasCube,
    pub shadow_sampler: RwLock<Option<SamplerId>>,
    pub shadow_results: RwLock<HashMap<usize, ShadowEntry>>,
    pub camera_ring: RwLock<Option<DynamicUniformRingBuffer>>,
    pub model_ring: RwLock<Option<DynamicUniformRingBuffer>>,
}
Expand description

Shared state used by every shadows lane.

The state’s shape is identical across quality tiers; the per-lane constants (atlas resolution, max lights) are passed in at init_gpu time and recorded inside the resources (textures are sized accordingly). The lane itself is the source of truth for its constants — there is no config struct injected by the agent.

Fields§

§pipeline: RwLock<Option<RenderPipelineId>>

Depth-only render pipeline shared by both atlas paths.

§camera_layout: RwLock<Option<BindGroupLayoutId>>

Shadow camera (light view-projection) bind group layout.

§model_layout: RwLock<Option<BindGroupLayoutId>>

Shadow model-uniform bind group layout.

§atlas_2d: Atlas2D

2D atlas resources (directional / spot lights).

§atlas_cube: AtlasCube

Cube atlas resources (point lights).

§shadow_sampler: RwLock<Option<SamplerId>>

Comparison sampler shared by both atlases.

§shadow_results: RwLock<HashMap<usize, ShadowEntry>>

Per-light shadow entries for the per-frame OutputDeck.

§camera_ring: RwLock<Option<DynamicUniformRingBuffer>>

Dynamic ring buffer for camera (light view-proj) uniforms — one slot per pass (1 per directional/spot light + 6 per point).

§model_ring: RwLock<Option<DynamicUniformRingBuffer>>

Dynamic ring buffer for per-mesh model uniforms.

Implementations§

Source§

impl ShadowsLaneState

Source

pub fn init_gpu( &self, device: &dyn GraphicsDevice, pipeline_system: &dyn PipelineSystem, atlas_2d_resolution: u32, atlas_2d_max_lights: u32, cube_face_resolution: u32, cube_max_lights: u32, label_prefix: &str, ) -> Result<(), RenderError>

One-time GPU initialisation sized to the lane’s own constants.

Called by the lane’s [khora_core::lane::Lane::on_initialize].

Source

pub fn render( &self, atlas_2d_max_lights: u32, cube_max_lights: u32, strategy_label: &str, render_world: &RenderWorld, shadow_view: Option<&ShadowView>, device: &dyn GraphicsDevice, encoder: &mut dyn CommandEncoder, gpu_meshes: &RwLock<Assets<GpuMesh>>, )

Renders one frame’s shadows. The lane is responsible for providing its own atlas capacities (used here only to cap per-frame allocation; the texture is already sized correctly by init_gpu).

Source

pub fn shadow_bindings(&self) -> Option<ShadowGpuBindings>

Publishes the shadow bindings (per-frame snapshot of atlas resource ids) into the lane context. Lit consumer lanes read this opaquely via [khora_data::render::ShadowGpuBindings].

Source

pub fn shutdown(&self, device: &dyn GraphicsDevice)

Releases every GPU resource owned by this state. No-op if already shut down.

Trait Implementations§

Source§

impl Default for ShadowsLaneState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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
§

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

§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.
§

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a reference to the inner value as &dyn Any.
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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.