diff --git a/wgpu-core/src/track/mod.rs b/wgpu-core/src/track/mod.rs index bf37b256184..86133bd2b33 100644 --- a/wgpu-core/src/track/mod.rs +++ b/wgpu-core/src/track/mod.rs @@ -420,12 +420,9 @@ impl ResourceMetadataProvider<'_, A> { } ResourceMetadataProvider::Indirect { metadata } => { metadata.tracker_assert_in_bounds(index); - (unsafe { *metadata.epochs.get_unchecked(index) }, unsafe { - metadata - .ref_counts - .get_unchecked(index) - .clone() - .unwrap_unchecked() + (unsafe { *metadata.epochs.get_unchecked(index) }, { + let ref_count = unsafe { metadata.ref_counts.get_unchecked(index) }; + unsafe { ref_count.clone().unwrap_unchecked() } }) } ResourceMetadataProvider::Resource { epoch } => { diff --git a/wgpu-core/src/track/texture.rs b/wgpu-core/src/track/texture.rs index 2e06b1dedec..125eb268434 100644 --- a/wgpu-core/src/track/texture.rs +++ b/wgpu-core/src/track/texture.rs @@ -291,9 +291,10 @@ impl TextureUsageScope { self.tracker_assert_in_bounds(index); scope.tracker_assert_in_bounds(index); + let texture_data = unsafe { texture_data_from_texture(storage, index32) }; unsafe { insert_or_merge( - texture_data_from_texture(storage, index32), + texture_data, &mut self.set, &mut self.metadata, index32, @@ -359,9 +360,10 @@ impl TextureUsageScope { self.tracker_assert_in_bounds(index); + let texture_data = unsafe { texture_data_from_texture(storage, index32) }; unsafe { insert_or_merge( - texture_data_from_texture(storage, index32), + texture_data, &mut self.set, &mut self.metadata, index32, @@ -467,13 +469,8 @@ impl TextureTracker { self.tracker_assert_in_bounds(index); - unsafe { - self.metadata - .ref_counts - .get_unchecked(index) - .as_ref() - .unwrap_unchecked() - } + let ref_count = unsafe { self.metadata.ref_counts.get_unchecked(index) }; + unsafe { ref_count.as_ref().unwrap_unchecked() } } /// Inserts a single texture and a state into the resource tracker. @@ -683,9 +680,10 @@ impl TextureTracker { if unsafe { !scope.metadata.owned.get(index).unwrap_unchecked() } { continue; } + let texture_data = unsafe { texture_data_from_texture(storage, index32) }; unsafe { insert_or_barrier_update( - texture_data_from_texture(storage, index32), + texture_data, Some(&mut self.start_set), &mut self.end_set, &mut self.metadata, diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index af22f8e0391..4de2b06a57b 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -48,13 +48,16 @@ impl super::DeviceShared { .collect(); &buffer_vec }; + + let name = unsafe { CStr::from_bytes_with_nul_unchecked(name_bytes) }; + let _result = unsafe { extension.debug_utils_set_object_name( self.raw.handle(), &vk::DebugUtilsObjectNameInfoEXT::builder() .object_type(object_type) .object_handle(object.as_raw()) - .object_name(CStr::from_bytes_with_nul_unchecked(name_bytes)), + .object_name(name), ) }; }