Add debug markers to command encoder

This commit is contained in:
Dzmitry Malyshau committed 2020-07-10 10:26:03 -04:00
1 parent 24405e8f5e
commit 73c217dce0
2 files changed
+69 -5

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
[package]
name = "wgpu"
version = "0.5.1"
version = "0.5.2"
authors = [
"Dzmitry Malyshau <kvark@mozilla.com>",
"Joshua Groves <josh@joshgroves.com>",
@@ -25,7 +25,7 @@ vulkan = ["wgn/vulkan-portability"]
[dependencies.wgn]
package = "wgpu-native"
version = "0.5"
version = "0.5.1"
#git = "https://github.com/gfx-rs/wgpu"
[dependencies.wgc]
@@ -60,7 +60,7 @@ name="hello-compute"
path="examples/hello-compute/main.rs"
test = true
#[patch.crates-io]
[patch.crates-io]
#wgpu-types = { version = "0.5.0", path = "../wgpu/wgpu-types" }
#wgpu-core = { version = "0.5.0", path = "../wgpu/wgpu-core" }
#wgpu-native = { version = "0.5.0", path = "../wgpu/wgpu-native" }
+66 -2
View File
@@ -1337,6 +1337,37 @@ impl CommandEncoder {
copy_size,
);
}
/// Inserts debug marker.
pub fn insert_debug_marker(&mut self, label: &str) {
let cstring = CString::new(label).unwrap();
unsafe {
wgn::wgpu_command_encoder_insert_debug_marker(
self.id,
cstring.as_ptr(),
0,
)
};
}
/// Start record commands and group it into debug marker group.
pub fn push_debug_group(&mut self, label: &str) {
let cstring = CString::new(label).unwrap();
unsafe {
wgn::wgpu_command_encoder_push_debug_group(
self.id,
cstring.as_ptr(),
0,
)
};
}
/// Stops command recording and creates debug group.
pub fn pop_debug_group(&mut self) {
unsafe {
wgn::wgpu_command_encoder_pop_debug_group(self.id)
};
}
}
impl<'a> RenderPass<'a> {
@@ -1487,10 +1518,11 @@ impl<'a> RenderPass<'a> {
/// Inserts debug marker.
pub fn insert_debug_marker(&mut self, label: &str) {
let cstring = CString::new(label).unwrap();
unsafe {
wgn::wgpu_render_pass_insert_debug_marker(
self.id.as_mut().unwrap(),
label.as_ptr() as *const i8,
cstring.as_ptr(),
0,
);
}
@@ -1498,10 +1530,11 @@ impl<'a> RenderPass<'a> {
/// Start record commands and group it into debug marker group.
pub fn push_debug_group(&mut self, label: &str) {
let cstring = CString::new(label).unwrap();
unsafe {
wgn::wgpu_render_pass_push_debug_group(
self.id.as_mut().unwrap(),
label.as_ptr() as *const i8,
cstring.as_ptr(),
0,
);
}
@@ -1603,6 +1636,37 @@ impl<'a> ComputePass<'a> {
}
}
/// Inserts debug marker.
pub fn insert_debug_marker(&mut self, label: &str) {
let cstring = CString::new(label).unwrap();
unsafe {
wgn::wgpu_compute_pass_insert_debug_marker(
self.id.as_mut().unwrap(),
cstring.as_ptr(),
0,
);
}
}
/// Start record commands and group it into debug marker group.
pub fn push_debug_group(&mut self, label: &str) {
let cstring = CString::new(label).unwrap();
unsafe {
wgn::wgpu_compute_pass_push_debug_group(
self.id.as_mut().unwrap(),
cstring.as_ptr(),
0,
);
}
}
/// Stops command recording and creates debug group.
pub fn pop_debug_group(&mut self) {
unsafe {
wgn::wgpu_compute_pass_pop_debug_group(self.id.as_mut().unwrap());
}
}
/// Dispatches compute work operations.
///
/// `x`, `y` and `z` denote the number of work groups to dispatch in each dimension.