Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Count total meshes drawn + optional draw_sprite_pro counter
Browse files Browse the repository at this point in the history
  • Loading branch information
darthdeus committed Jan 28, 2024
1 parent a996acb commit 9d127af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions comfy-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ blobs = ["dep:blobs"]
wayland = ["winit/wayland"]
exr = ["half", "image/exr"]

sprite-pro-counter = []

[dependencies]
smallvec = "1.10.0"

Expand Down
3 changes: 3 additions & 0 deletions comfy-core/src/quad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ pub fn draw_sprite_pro(
) {
let _span = span!("draw_sprite_pro");

#[cfg(feature = "sprite-pro-counter")]
perf_counter_inc("draw_sprite_pro", 1);

if SPRITE_CULLING_ENABLED.load(Ordering::SeqCst) {
if !CAMERA_BOUNDS.load().contains_rect_safe(position, params.size) {
return;
Expand Down
4 changes: 3 additions & 1 deletion comfy-wgpu/src/batching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ pub fn run_batched_render_passes(
});
}

perf_counter_inc("render passes", 1);
perf_counter_inc("meshes", meshes.len() as u64);

render_meshes(
c,
is_first,
Expand All @@ -61,7 +64,6 @@ pub fn run_batched_render_passes(
error_shader_id,
);

perf_counter_inc("render passes", 1);

is_first = false;
}
Expand Down

0 comments on commit 9d127af

Please sign in to comment.