diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index bd20da90e..2910ea2ba 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -1845,14 +1845,12 @@ impl Global { /// /// [api]: ../../wgpu/struct.Device.html#method.start_graphics_debugger_capture pub unsafe fn device_start_graphics_debugger_capture(&self, device_id: DeviceId) { - api_log!("Device::start_graphics_debugger_capture"); - - let device = self.hub.devices.get(device_id); - - if !device.is_valid() { - return; + unsafe { + self.hub + .devices + .get(device_id) + .start_graphics_debugger_capture(); } - unsafe { device.raw().start_graphics_debugger_capture() }; } /// # Safety @@ -1861,14 +1859,12 @@ impl Global { /// /// [api]: ../../wgpu/struct.Device.html#method.stop_graphics_debugger_capture pub unsafe fn device_stop_graphics_debugger_capture(&self, device_id: DeviceId) { - api_log!("Device::stop_graphics_debugger_capture"); - - let device = self.hub.devices.get(device_id); - - if !device.is_valid() { - return; + unsafe { + self.hub + .devices + .get(device_id) + .stop_graphics_debugger_capture(); } - unsafe { device.raw().stop_graphics_debugger_capture() }; } pub fn pipeline_cache_get_data(&self, id: id::PipelineCacheId) -> Option> { diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 93ab25921..d585f5c8e 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -338,6 +338,34 @@ impl Device { Err(MissingDownlevelFlags(flags)) } } + + /// # Safety + /// + /// - See [wgpu::Device::start_graphics_debugger_capture][api] for details the safety. + /// + /// [api]: ../../wgpu/struct.Device.html#method.start_graphics_debugger_capture + pub unsafe fn start_graphics_debugger_capture(&self) { + api_log!("Device::start_graphics_debugger_capture"); + + if !self.is_valid() { + return; + } + unsafe { self.raw().start_graphics_debugger_capture() }; + } + + /// # Safety + /// + /// - See [wgpu::Device::stop_graphics_debugger_capture][api] for details the safety. + /// + /// [api]: ../../wgpu/struct.Device.html#method.stop_graphics_debugger_capture + pub unsafe fn stop_graphics_debugger_capture(&self) { + api_log!("Device::stop_graphics_debugger_capture"); + + if !self.is_valid() { + return; + } + unsafe { self.raw().stop_graphics_debugger_capture() }; + } } impl Device {