viewport_lib/renderer/shadow_debug_stats.rs
1/// Per-frame shadow and lighting pipeline statistics for debug inspection.
2///
3/// Returned by [`crate::ViewportRenderer::shadow_debug_stats`]. All values reflect
4/// the most recently completed `prepare` call (one frame behind the display).
5#[derive(Clone, Copy, Debug)]
6pub struct ShadowDebugStats {
7 /// True when the current frame uses the instanced draw path.
8 ///
9 /// When true, edits to `mesh.wgsl` shadow sampling code have no effect --
10 /// the active shader is `mesh_instanced.wgsl`.
11 pub using_instanced_path: bool,
12 /// Number of instanced batches in the current frame. Zero when non-instanced.
13 pub instanced_batch_count: usize,
14 /// Number of active shadow cascades (1-4).
15 pub cascade_count: u32,
16 /// Distance to each cascade split in camera space. Unused slots are 0.
17 pub cascade_splits: [f32; 4],
18 /// Shadow atlas resolution (width = height) in pixels.
19 pub shadow_atlas_resolution: u32,
20 /// Shadow frustum half-extent in world units.
21 ///
22 /// Auto-computed as 20.0 unless overridden via `shadow_extent_override`.
23 pub shadow_extent_world: f32,
24 /// True when screen-space contact shadows are enabled in post-process settings.
25 pub contact_shadow_active: bool,
26}
27
28impl Default for ShadowDebugStats {
29 fn default() -> Self {
30 Self {
31 using_instanced_path: false,
32 instanced_batch_count: 0,
33 cascade_count: 0,
34 cascade_splits: [0.0; 4],
35 shadow_atlas_resolution: 4096,
36 shadow_extent_world: 20.0,
37 contact_shadow_active: false,
38 }
39 }
40}