mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 07:21:04 +01:00
Added debug marker/groups for ComputePass & CommandEncoder
This commit is contained in:
1 parent
854b3f1c5d
commit
cb2072ed6a
6 files changed
+132
-18
No files matched your search
@@ -96,6 +96,22 @@ mod pass_impl {
|
||||
)
|
||||
}
|
||||
}
|
||||
fn insert_debug_marker(&mut self, label: &str) {
|
||||
unsafe {
|
||||
let label = std::ffi::CString::new(label).unwrap();
|
||||
wgpu_compute_pass_insert_debug_marker(self, label.as_ptr().into(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
fn push_debug_group(&mut self, group_label: &str) {
|
||||
unsafe {
|
||||
let label = std::ffi::CString::new(group_label).unwrap();
|
||||
wgpu_compute_pass_push_debug_group(self, label.as_ptr().into(), 0);
|
||||
}
|
||||
}
|
||||
fn pop_debug_group(&mut self) {
|
||||
wgpu_compute_pass_pop_debug_group(self);
|
||||
}
|
||||
fn dispatch(&mut self, x: u32, y: u32, z: u32) {
|
||||
wgpu_compute_pass_dispatch(self, x, y, z)
|
||||
}
|
||||
@@ -1244,6 +1260,22 @@ impl crate::Context for Context {
|
||||
wgc::gfx_select!(*encoder => global.command_encoder_finish(*encoder, &desc)).unwrap_pretty()
|
||||
}
|
||||
|
||||
fn command_encoder_insert_debug_marker(&self, encoder: &Self::CommandEncoderId, label: &str) {
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*encoder => global.command_encoder_insert_debug_marker(*encoder, &label))
|
||||
.unwrap_pretty()
|
||||
}
|
||||
fn command_encoder_push_debug_group(&self, encoder: &Self::CommandEncoderId, label: &str) {
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*encoder => global.command_encoder_push_debug_group(*encoder, &label))
|
||||
.unwrap_pretty()
|
||||
}
|
||||
fn command_encoder_pop_debug_group(&self, encoder: &Self::CommandEncoderId) {
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*encoder => global.command_encoder_pop_debug_group(*encoder))
|
||||
.unwrap_pretty()
|
||||
}
|
||||
|
||||
fn render_bundle_encoder_finish(
|
||||
&self,
|
||||
encoder: Self::RenderBundleEncoderId,
|
||||
|
||||
@@ -88,6 +88,19 @@ impl crate::ComputePassInner<Context> for ComputePass {
|
||||
fn set_push_constants(&mut self, _offset: u32, _data: &[u32]) {
|
||||
panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect")
|
||||
}
|
||||
|
||||
fn insert_debug_marker(&mut self, _label: &str) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn push_debug_group(&mut self, _group_label: &str) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn pop_debug_group(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn dispatch(&mut self, x: u32, y: u32, z: u32) {
|
||||
self.0.dispatch_with_y_and_z(x, y, z);
|
||||
}
|
||||
@@ -1436,6 +1449,16 @@ impl crate::Context for Context {
|
||||
Sendable(encoder.finish_with_descriptor(&mapped_desc))
|
||||
}
|
||||
|
||||
fn command_encoder_insert_debug_marker(&self, encoder: &Self::CommandEncoderId, label: &str) {
|
||||
unimplemented!()
|
||||
}
|
||||
fn command_encoder_push_debug_group(&self, encoder: &Self::CommandEncoderId, label: &str) {
|
||||
unimplemented!()
|
||||
}
|
||||
fn command_encoder_pop_debug_group(&self, encoder: &Self::CommandEncoderId) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn render_bundle_encoder_finish(
|
||||
&self,
|
||||
_encoder: Self::RenderBundleEncoderId,
|
||||
|
||||
+38
@@ -56,6 +56,9 @@ trait ComputePassInner<Ctx: Context> {
|
||||
offsets: &[DynamicOffset],
|
||||
);
|
||||
fn set_push_constants(&mut self, offset: u32, data: &[u32]);
|
||||
fn insert_debug_marker(&mut self, label: &str);
|
||||
fn push_debug_group(&mut self, group_label: &str);
|
||||
fn pop_debug_group(&mut self);
|
||||
fn dispatch(&mut self, x: u32, y: u32, z: u32);
|
||||
fn dispatch_indirect(
|
||||
&mut self,
|
||||
@@ -368,6 +371,11 @@ trait Context: Debug + Send + Sized + Sync {
|
||||
pass: &mut Self::RenderPassId,
|
||||
);
|
||||
fn command_encoder_finish(&self, encoder: &Self::CommandEncoderId) -> Self::CommandBufferId;
|
||||
|
||||
fn command_encoder_insert_debug_marker(&self, encoder: &Self::CommandEncoderId, label: &str);
|
||||
fn command_encoder_push_debug_group(&self, encoder: &Self::CommandEncoderId, label: &str);
|
||||
fn command_encoder_pop_debug_group(&self, encoder: &Self::CommandEncoderId);
|
||||
|
||||
fn render_bundle_encoder_finish(
|
||||
&self,
|
||||
encoder: Self::RenderBundleEncoderId,
|
||||
@@ -1905,6 +1913,21 @@ impl CommandEncoder {
|
||||
copy_size,
|
||||
);
|
||||
}
|
||||
|
||||
/// Inserts debug marker.
|
||||
pub fn insert_debug_marker(&mut self, label: &str) {
|
||||
Context::command_encoder_insert_debug_marker(&*self.context, &self.id, label);
|
||||
}
|
||||
|
||||
/// Start record commands and group it into debug marker group.
|
||||
pub fn push_debug_group(&mut self, label: &str) {
|
||||
Context::command_encoder_push_debug_group(&*self.context, &self.id, label);
|
||||
}
|
||||
|
||||
/// Stops command recording and creates debug group.
|
||||
pub fn pop_debug_group(&mut self) {
|
||||
Context::command_encoder_pop_debug_group(&*self.context, &self.id);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> RenderPass<'a> {
|
||||
@@ -2297,6 +2320,21 @@ impl<'a> ComputePass<'a> {
|
||||
ComputePassInner::set_pipeline(&mut self.id, &pipeline.id);
|
||||
}
|
||||
|
||||
/// Inserts debug marker.
|
||||
pub fn insert_debug_marker(&mut self, label: &str) {
|
||||
self.id.insert_debug_marker(label);
|
||||
}
|
||||
|
||||
/// Start record commands and group it into debug marker group.
|
||||
pub fn push_debug_group(&mut self, label: &str) {
|
||||
self.id.push_debug_group(label);
|
||||
}
|
||||
|
||||
/// Stops command recording and creates debug group.
|
||||
pub fn pop_debug_group(&mut self) {
|
||||
self.id.pop_debug_group();
|
||||
}
|
||||
|
||||
/// Dispatches compute work operations.
|
||||
///
|
||||
/// `x`, `y` and `z` denote the number of work groups to dispatch in each dimension.
|
||||
|
||||
Reference in new issue
Block a user