mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Trace push/pop debug group on command encoder (#2294)
This commit is contained in:
parent
3960658529
commit
1e593a6bd3
@ -108,6 +108,15 @@ impl GlobalPlay for wgc::hub::Global<IdentityPassThroughFactory> {
|
||||
destination_offset,
|
||||
)
|
||||
.unwrap(),
|
||||
trace::Command::PushDebugGroup(marker) => self
|
||||
.command_encoder_push_debug_group::<A>(encoder, &marker)
|
||||
.unwrap(),
|
||||
trace::Command::PopDebugGroup => {
|
||||
self.command_encoder_pop_debug_group::<A>(encoder).unwrap()
|
||||
}
|
||||
trace::Command::InsertDebugMarker(marker) => self
|
||||
.command_encoder_insert_debug_marker::<A>(encoder, &marker)
|
||||
.unwrap(),
|
||||
trace::Command::RunComputePass { base } => {
|
||||
self.command_encoder_run_compute_pass_impl::<A>(encoder, base.as_ref())
|
||||
.unwrap();
|
||||
|
@ -31,6 +31,9 @@ use crate::{
|
||||
use hal::CommandEncoder as _;
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
use crate::device::trace::Command as TraceCommand;
|
||||
|
||||
const PUSH_CONSTANT_CLEAR_ARRAY: &[u32] = &[0_u32; 64];
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -100,7 +103,7 @@ pub struct CommandBuffer<A: hal::Api> {
|
||||
limits: wgt::Limits,
|
||||
support_clear_buffer_texture: bool,
|
||||
#[cfg(feature = "trace")]
|
||||
pub(crate) commands: Option<Vec<crate::device::trace::Command>>,
|
||||
pub(crate) commands: Option<Vec<TraceCommand>>,
|
||||
}
|
||||
|
||||
impl<A: HalApi> CommandBuffer<A> {
|
||||
@ -322,8 +325,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
|
||||
let (mut cmd_buf_guard, _) = hub.command_buffers.write(&mut token);
|
||||
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)?;
|
||||
let cmd_buf_raw = cmd_buf.encoder.open();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut list) = cmd_buf.commands {
|
||||
list.push(TraceCommand::PushDebugGroup(label.to_string()));
|
||||
}
|
||||
|
||||
let cmd_buf_raw = cmd_buf.encoder.open();
|
||||
unsafe {
|
||||
cmd_buf_raw.begin_debug_marker(label);
|
||||
}
|
||||
@ -342,8 +350,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
|
||||
let (mut cmd_buf_guard, _) = hub.command_buffers.write(&mut token);
|
||||
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)?;
|
||||
let cmd_buf_raw = cmd_buf.encoder.open();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut list) = cmd_buf.commands {
|
||||
list.push(TraceCommand::InsertDebugMarker(label.to_string()));
|
||||
}
|
||||
|
||||
let cmd_buf_raw = cmd_buf.encoder.open();
|
||||
unsafe {
|
||||
cmd_buf_raw.insert_debug_marker(label);
|
||||
}
|
||||
@ -361,8 +374,13 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
|
||||
let (mut cmd_buf_guard, _) = hub.command_buffers.write(&mut token);
|
||||
let cmd_buf = CommandBuffer::get_encoder_mut(&mut *cmd_buf_guard, encoder_id)?;
|
||||
let cmd_buf_raw = cmd_buf.encoder.open();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(ref mut list) = cmd_buf.commands {
|
||||
list.push(TraceCommand::PopDebugGroup);
|
||||
}
|
||||
|
||||
let cmd_buf_raw = cmd_buf.encoder.open();
|
||||
unsafe {
|
||||
cmd_buf_raw.end_debug_marker();
|
||||
}
|
||||
|
@ -168,6 +168,9 @@ pub enum Command {
|
||||
destination: id::BufferId,
|
||||
destination_offset: wgt::BufferAddress,
|
||||
},
|
||||
PushDebugGroup(String),
|
||||
PopDebugGroup,
|
||||
InsertDebugMarker(String),
|
||||
RunComputePass {
|
||||
base: crate::command::BasePass<crate::command::ComputeCommand>,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user