Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passes should have debug labels emitted #22

Open
attackgoat opened this issue Jun 4, 2022 · 2 comments
Open

Passes should have debug labels emitted #22

attackgoat opened this issue Jun 4, 2022 · 2 comments

Comments

@attackgoat
Copy link
Owner

This feature no longer works, should be addressed

@DGriffin91
Copy link
Contributor

Was just curious about this. It would be wonderful to see pass labels in nsight & renderdoc!

@DGriffin91
Copy link
Contributor

Was playing around with trying to get this to work and ran into #88

Idk if this will be helpful at all or not but here's a diff of what I tried:

diff --git a/src/driver/device.rs b/src/driver/device.rs
index 13ca892..00dc820 100644
--- a/src/driver/device.rs
+++ b/src/driver/device.rs
@@ -43,6 +43,8 @@ pub struct Device {
     /// Vulkan instance pointer, which includes useful functions.
     instance: Instance,
 
+    pub(crate) debug_utils_fn: Option<ext::debug_utils::Device>,
+
     /// The physical device, which contains useful data about features, properties, and limits.
     pub physical_device: PhysicalDevice,
 
@@ -313,10 +315,17 @@ impl Device {
             .ray_tracing_pipeline
             .then(|| khr::ray_tracing_pipeline::Device::new(&instance, &device));
 
+        let debug_utils_fn = if Instance::is_debug(&instance) {
+            Some(ext::debug_utils::Device::new(&instance, &device))
+        } else {
+            None
+        };
+
         Ok(Self {
             accel_struct_ext,
             allocator: ManuallyDrop::new(Mutex::new(allocator)),
             device,
+            debug_utils_fn,
             instance,
             physical_device,
             queues,
diff --git a/src/graph/resolver.rs b/src/graph/resolver.rs
index 2e68a9c..f8a2728 100644
--- a/src/graph/resolver.rs
+++ b/src/graph/resolver.rs
@@ -619,6 +619,14 @@ impl Resolver {
 
             // let start_g = std::time::Instant::now();
             unsafe {
+                if let Some(debug_utils_fn) = &cmd_buf.device.debug_utils_fn {
+                    debug_utils_fn.cmd_begin_debug_utils_label(
+                        **cmd_buf,
+                        &vk::DebugUtilsLabelEXT::default()
+                            .label_name(&std::ffi::CString::new(pass.name.clone()).unwrap()),
+                    )
+                }
+
                 cmd_buf.device.cmd_begin_render_pass(
                     **cmd_buf,
                     &vk::RenderPassBeginInfo::default()
@@ -741,6 +749,9 @@ impl Resolver {
         trace!("  end render pass");
 
         unsafe {
+            if let Some(debug_utils_fn) = &cmd_buf.device.debug_utils_fn {
+                debug_utils_fn.cmd_end_debug_utils_label(**cmd_buf)
+            }
             cmd_buf.device.cmd_end_render_pass(**cmd_buf);
         }
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants