Skip to content

Commit 3f7dae1

Browse files
Additional api_logging for passes (gfx-rs#8326)
1 parent 26b83e7 commit 3f7dae1

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

wgpu-core/src/command/compute.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use wgt::{
77
use alloc::{borrow::Cow, boxed::Box, sync::Arc, vec::Vec};
88
use core::{convert::Infallible, fmt, str};
99

10-
use crate::{binding_model::BindError, resource::RawResourceAccess};
10+
use crate::{api_log, binding_model::BindError, resource::RawResourceAccess};
1111
use crate::{
1212
binding_model::{LateMinBufferBindingSizeMismatch, PushConstantUploadError},
1313
command::{
@@ -853,6 +853,8 @@ fn set_pipeline(
853853
}
854854

855855
fn dispatch(state: &mut State, groups: [u32; 3]) -> Result<(), ComputePassErrorInner> {
856+
api_log!("ComputePass::dispatch {groups:?}");
857+
856858
state.is_ready()?;
857859

858860
state.flush_states(None)?;
@@ -888,6 +890,8 @@ fn dispatch_indirect(
888890
buffer: Arc<Buffer>,
889891
offset: u64,
890892
) -> Result<(), ComputePassErrorInner> {
893+
api_log!("ComputePass::dispatch_indirect");
894+
891895
buffer.same_device(device)?;
892896

893897
state.is_ready()?;

wgpu-core/src/command/mod.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -948,20 +948,38 @@ impl CommandEncoder {
948948
timestamp_writes,
949949
occlusion_query_set,
950950
} => {
951-
encode_render_pass(
951+
api_log!(
952+
"Begin encoding render pass with '{}' label",
953+
pass.label.as_deref().unwrap_or("")
954+
);
955+
let res = encode_render_pass(
952956
&mut state,
953957
pass,
954958
color_attachments,
955959
depth_stencil_attachment,
956960
timestamp_writes,
957961
occlusion_query_set,
958-
)?;
962+
);
963+
match res.as_ref() {
964+
Err(err) => api_log!("Finished encoding render pass ({err:?})"),
965+
Ok(_) => api_log!("Finished encoding render pass (success)"),
966+
}
967+
res?;
959968
}
960969
ArcCommand::RunComputePass {
961970
pass,
962971
timestamp_writes,
963972
} => {
964-
encode_compute_pass(&mut state, pass, timestamp_writes)?;
973+
api_log!(
974+
"Begin encoding compute pass with '{}' label",
975+
pass.label.as_deref().unwrap_or("")
976+
);
977+
let res = encode_compute_pass(&mut state, pass, timestamp_writes);
978+
match res.as_ref() {
979+
Err(err) => api_log!("Finished encoding compute pass ({err:?})"),
980+
Ok(_) => api_log!("Finished encoding compute pass (success)"),
981+
}
982+
res?;
965983
}
966984
_ => unreachable!(),
967985
}

0 commit comments

Comments
 (0)