1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 07:03:14 -04:00

egui-wgpu: Show wgpu profiling scopes when using puffin profiler

This commit is contained in:
Emil Ernerfeldt
2023-12-19 12:45:20 +01:00
parent 9253cafedd
commit b6beba55d3
3 changed files with 31 additions and 13 deletions

19
Cargo.lock generated
View File

@@ -1218,6 +1218,7 @@ dependencies = [
"egui",
"epaint",
"log",
"profiling",
"puffin",
"thiserror",
"type-map",
@@ -2881,9 +2882,23 @@ dependencies = [
[[package]]
name = "profiling"
version = "1.0.11"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f89dff0959d98c9758c88826cc002e2c3d0b9dfac4139711d1f30de442f1139b"
checksum = "1de09527cd2ea2c2d59fb6c2f8c1ab8c71709ed9d1b6d60b0e1c9fbb6fdcb33c"
dependencies = [
"profiling-procmacros",
"puffin",
]
[[package]]
name = "profiling-procmacros"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d8f36e3c621a72254893ed5cc57d1a069162adb3f98bfef610788661db6ad8d"
dependencies = [
"quote",
"syn 2.0.37",
]
[[package]]
name = "puffin"

View File

@@ -43,15 +43,23 @@ epaint = { version = "0.24.1", path = "../epaint", default-features = false, fea
bytemuck = "1.7"
log = { version = "0.4", features = ["std"] }
# wgpu uses the `profiling` crate for its profiling scopes.
# This will hook them up to the puffin profiler as backend:
profiling = { version = "1.0.12", default-features = false, features = [
"profile-with-puffin",
] }
thiserror.workspace = true
type-map = "0.5.0"
wgpu.workspace = true
#! ### Optional dependencies
## Enable this when generating docs.
document-features = { version = "0.2", optional = true }
winit = { version = "0.29.4", default-features = false, optional = true, features = ["rwh_05"] }
winit = { version = "0.29.4", default-features = false, optional = true, features = [
"rwh_05",
] }
# Native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@@ -622,12 +622,9 @@ impl Painter {
};
// Submit the commands: both the main buffer and user-defined ones.
{
crate::profile_scope!("Queue::submit");
render_state
.queue
.submit(user_cmd_bufs.into_iter().chain([encoded]));
};
render_state
.queue
.submit(user_cmd_bufs.into_iter().chain([encoded]));
let screenshot = if capture {
let screen_capture_state = self.screen_capture_state.as_ref()?;
@@ -636,10 +633,8 @@ impl Painter {
None
};
{
crate::profile_scope!("present");
output_frame.present();
}
output_frame.present();
screenshot
}