Skip to main content

mittens_engine/engine/graphics/
render_info.rs

1// Render-related helper functions and types that don't neatly fit anywhere else.
2//
3// Currently just owns the LC_PRINT_PIPELINE_LAYOUTS env-var gating and printing.
4
5// Intentionally empty for now; this file remains as a home for renderer debug helpers.
6
7pub struct RenderInfo;
8
9impl RenderInfo {
10    pub fn maybe_print_pipeline_layouts<M: std::fmt::Debug, Me: std::fmt::Debug>(
11        current_frame: usize,
12        material: &M,
13        mesh: &Me,
14        pipeline_u64: u64,
15        layout_u64: Option<u64>,
16        push_constant_size_bytes: usize,
17        batch_index: usize,
18        batch_len: usize,
19        start: u32,
20        count: u32,
21    ) {
22        if std::env::var("LC_PRINT_PIPELINE_LAYOUTS").ok().as_deref() != Some("1")
23            || current_frame != 0
24        {
25            return;
26        }
27
28        println!(
29            "[Renderer] pipeline/layout debug: material={:?} mesh={:?} pipeline=0x{:x} layout={}",
30            material,
31            mesh,
32            pipeline_u64,
33            layout_u64
34                .map(|l| format!("0x{:x}", l))
35                .unwrap_or_else(|| "<missing>".to_string()),
36        );
37        println!(
38            "[Renderer] expected push-constant range: stage=VERTEX offset=0 size={} bytes",
39            push_constant_size_bytes
40        );
41        println!(
42            "[Renderer] batch idx {}/{} start={} count={}",
43            batch_index, batch_len, start, count
44        );
45    }
46}