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: Atlas2D2D atlas resources (directional / spot lights).
atlas_cube: AtlasCubeCube 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
impl ShadowsLaneState
Sourcepub 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>
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].
Sourcepub 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>>,
)
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).
Sourcepub fn shadow_bindings(&self) -> Option<ShadowGpuBindings>
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].