Skip to content

Commit 65024e6

Browse files
committed
Move start/stop debugger capture out of Global
1 parent 00a655c commit 65024e6

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

wgpu-core/src/device/global.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,14 +1845,12 @@ impl Global {
18451845
///
18461846
/// [api]: ../../wgpu/struct.Device.html#method.start_graphics_debugger_capture
18471847
pub unsafe fn device_start_graphics_debugger_capture(&self, device_id: DeviceId) {
1848-
api_log!("Device::start_graphics_debugger_capture");
1849-
1850-
let device = self.hub.devices.get(device_id);
1851-
1852-
if !device.is_valid() {
1853-
return;
1848+
unsafe {
1849+
self.hub
1850+
.devices
1851+
.get(device_id)
1852+
.start_graphics_debugger_capture();
18541853
}
1855-
unsafe { device.raw().start_graphics_debugger_capture() };
18561854
}
18571855

18581856
/// # Safety
@@ -1861,14 +1859,12 @@ impl Global {
18611859
///
18621860
/// [api]: ../../wgpu/struct.Device.html#method.stop_graphics_debugger_capture
18631861
pub unsafe fn device_stop_graphics_debugger_capture(&self, device_id: DeviceId) {
1864-
api_log!("Device::stop_graphics_debugger_capture");
1865-
1866-
let device = self.hub.devices.get(device_id);
1867-
1868-
if !device.is_valid() {
1869-
return;
1862+
unsafe {
1863+
self.hub
1864+
.devices
1865+
.get(device_id)
1866+
.stop_graphics_debugger_capture();
18701867
}
1871-
unsafe { device.raw().stop_graphics_debugger_capture() };
18721868
}
18731869

18741870
pub fn pipeline_cache_get_data(&self, id: id::PipelineCacheId) -> Option<Vec<u8>> {

wgpu-core/src/device/resource.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,34 @@ impl Device {
338338
Err(MissingDownlevelFlags(flags))
339339
}
340340
}
341+
342+
/// # Safety
343+
///
344+
/// - See [wgpu::Device::start_graphics_debugger_capture][api] for details the safety.
345+
///
346+
/// [api]: ../../wgpu/struct.Device.html#method.start_graphics_debugger_capture
347+
pub unsafe fn start_graphics_debugger_capture(&self) {
348+
api_log!("Device::start_graphics_debugger_capture");
349+
350+
if !self.is_valid() {
351+
return;
352+
}
353+
unsafe { self.raw().start_graphics_debugger_capture() };
354+
}
355+
356+
/// # Safety
357+
///
358+
/// - See [wgpu::Device::stop_graphics_debugger_capture][api] for details the safety.
359+
///
360+
/// [api]: ../../wgpu/struct.Device.html#method.stop_graphics_debugger_capture
361+
pub unsafe fn stop_graphics_debugger_capture(&self) {
362+
api_log!("Device::stop_graphics_debugger_capture");
363+
364+
if !self.is_valid() {
365+
return;
366+
}
367+
unsafe { self.raw().stop_graphics_debugger_capture() };
368+
}
341369
}
342370

343371
impl Device {

0 commit comments

Comments
 (0)