mln_gfx/rendering_stats.rs
1/// Counters of the rendering backend. The `num_*` and `mem_*` counters of
2/// buffers, textures and frame buffers count the live resources; `total_*`,
3/// `*_updates` and `*_bytes` grow over the context's life.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct RenderingStats {
6 /// Frame CPU encoding time (seconds).
7 pub encoding_time: f64,
8 /// Frame CPU rendering time (seconds).
9 pub rendering_time: f64,
10 /// Number of frames rendered.
11 pub num_frames: i32,
12 /// Draw calls executed during the most recent frame.
13 pub num_draw_calls: i32,
14 /// Draw calls executed during all the frames.
15 pub total_draw_calls: i32,
16 /// Textures created.
17 pub num_created_textures: i32,
18 /// Live textures.
19 pub num_active_textures: i32,
20 /// Net texture bindings.
21 pub num_texture_bindings: i32,
22 /// Times a texture was updated.
23 pub num_texture_updates: i32,
24 /// Bytes written in texture updates.
25 pub texture_update_bytes: usize,
26 /// Buffers created.
27 pub total_buffers: usize,
28 /// Backend buffer objects created.
29 pub total_buffer_objs: usize,
30 /// Times a buffer was updated.
31 pub buffer_updates: usize,
32 /// Times a backend buffer object was updated.
33 pub buffer_obj_updates: usize,
34 /// Bytes written in buffer updates.
35 pub buffer_update_bytes: usize,
36 /// Live buffers of every kind.
37 pub num_buffers: i32,
38 /// Live offscreen frame buffers.
39 pub num_frame_buffers: i32,
40 /// Live index buffers.
41 pub num_index_buffers: i32,
42 /// Bytes written in index buffer updates.
43 pub index_update_bytes: usize,
44 /// Live vertex buffers.
45 pub num_vertex_buffers: i32,
46 /// Bytes written in vertex buffer updates.
47 pub vertex_update_bytes: usize,
48 /// Live uniform and storage buffers.
49 pub num_uniform_buffers: i32,
50 /// Times a uniform or storage buffer was updated.
51 pub num_uniform_updates: i32,
52 /// Bytes written in uniform and storage buffer updates.
53 pub uniform_update_bytes: usize,
54 /// Bytes of the live textures.
55 pub mem_textures: i32,
56 /// Bytes of the live buffers of every kind.
57 pub mem_buffers: i32,
58 /// Bytes of the live index buffers.
59 pub mem_index_buffers: i32,
60 /// Bytes of the live vertex buffers.
61 pub mem_vertex_buffers: i32,
62 /// Bytes of the live uniform and storage buffers.
63 pub mem_uniform_buffers: i32,
64 /// Stencil buffer clears.
65 pub stencil_clears: i32,
66 /// Stencil buffer updates.
67 pub stencil_updates: i32,
68 /// What the drapes of 3D terrain hold, and what the most recent frame
69 /// drew of them.
70 pub terrain: TerrainStats,
71}
72
73/// What the drapes of 3D terrain hold after the most recent frame, and what
74/// that frame drew of them: all zero for a frame without terrain. Its byte
75/// counts are of what the drapes hold now, as the `mem_*` counters of
76/// [`RenderingStats`] are; a depth and stencil texture counts 4 bytes a
77/// texel, though a backend may store it in more.
78#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
79pub struct TerrainStats {
80 /// Drapes whose textures are made: one for each terrain tile and stack
81 /// whose layers draw something there.
82 pub drapes: usize,
83 /// Drapes drawn during the most recent frame, each followed by the
84 /// generation of its mips. The others kept what they last drew.
85 pub drapes_drawn: usize,
86 /// Bytes of the drapes' textures, their mips included, and of the depth
87 /// and stencil and composite textures they draw with.
88 pub mem_drapes: usize,
89}