diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index f220877ac5..5b24a82a84 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -32,10 +32,22 @@ use std::{ mod life; #[cfg(feature = "trace")] -mod trace; +pub(crate) mod trace; #[cfg(feature = "trace")] use trace::{Action, Trace}; +pub type Label = *const std::os::raw::c_char; +#[cfg(feature = "trace")] +fn own_label(label: &Label) -> String { + if label.is_null() { + String::new() + } else { + unsafe { ffi::CStr::from_ptr(*label) } + .to_string_lossy() + .to_string() + } +} + pub const MAX_COLOR_TARGETS: usize = 4; pub const MAX_MIP_LEVELS: usize = 16; pub const MAX_VERTEX_BUFFERS: usize = 16; @@ -200,7 +212,7 @@ pub struct Device { pub(crate) private_features: PrivateFeatures, limits: wgt::Limits, #[cfg(feature = "trace")] - trace: Option>, + pub(crate) trace: Option>, } impl Device { @@ -293,7 +305,7 @@ impl Device { fn create_buffer( &self, self_id: id::DeviceId, - desc: &wgt::BufferDescriptor, + desc: &wgt::BufferDescriptor