Additional api_logging for passes (#8326)

This commit is contained in:
Andy Leiserson 2025-10-13 10:19:29 -07:00 committed by GitHub
parent 26b83e75ae
commit 3f7dae1a30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 4 deletions

View File

@ -7,7 +7,7 @@ use wgt::{
use alloc::{borrow::Cow, boxed::Box, sync::Arc, vec::Vec};
use core::{convert::Infallible, fmt, str};
use crate::{binding_model::BindError, resource::RawResourceAccess};
use crate::{api_log, binding_model::BindError, resource::RawResourceAccess};
use crate::{
binding_model::{LateMinBufferBindingSizeMismatch, PushConstantUploadError},
command::{
@ -853,6 +853,8 @@ fn set_pipeline(
}
fn dispatch(state: &mut State, groups: [u32; 3]) -> Result<(), ComputePassErrorInner> {
api_log!("ComputePass::dispatch {groups:?}");
state.is_ready()?;
state.flush_states(None)?;
@ -888,6 +890,8 @@ fn dispatch_indirect(
buffer: Arc<Buffer>,
offset: u64,
) -> Result<(), ComputePassErrorInner> {
api_log!("ComputePass::dispatch_indirect");
buffer.same_device(device)?;
state.is_ready()?;

View File

@ -948,20 +948,38 @@ impl CommandEncoder {
timestamp_writes,
occlusion_query_set,
} => {
encode_render_pass(
api_log!(
"Begin encoding render pass with '{}' label",
pass.label.as_deref().unwrap_or("")
);
let res = encode_render_pass(
&mut state,
pass,
color_attachments,
depth_stencil_attachment,
timestamp_writes,
occlusion_query_set,
)?;
);
match res.as_ref() {
Err(err) => api_log!("Finished encoding render pass ({err:?})"),
Ok(_) => api_log!("Finished encoding render pass (success)"),
}
res?;
}
ArcCommand::RunComputePass {
pass,
timestamp_writes,
} => {
encode_compute_pass(&mut state, pass, timestamp_writes)?;
api_log!(
"Begin encoding compute pass with '{}' label",
pass.label.as_deref().unwrap_or("")
);
let res = encode_compute_pass(&mut state, pass, timestamp_writes);
match res.as_ref() {
Err(err) => api_log!("Finished encoding compute pass ({err:?})"),
Ok(_) => api_log!("Finished encoding compute pass (success)"),
}
res?;
}
_ => unreachable!(),
}