From 570b01c30c01d74f800e527d46859c26c8fb318e Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 19 Dec 2022 09:31:35 +0100 Subject: [PATCH] inline for deref for both direct/web backend --- wgpu/src/backend/direct.rs | 3 +++ wgpu/src/backend/web.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index b103658acdc..815115b1387 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -2507,6 +2507,7 @@ impl std::ops::Deref for QueueWriteBuffer { } impl std::ops::DerefMut for QueueWriteBuffer { + #[inline] fn deref_mut(&mut self) -> &mut Self::Target { use crate::BufferMappedRangeSlice; self.mapping.slice_mut() @@ -2523,10 +2524,12 @@ unsafe impl Send for BufferMappedRange {} unsafe impl Sync for BufferMappedRange {} impl crate::BufferMappedRangeSlice for BufferMappedRange { + #[inline] fn slice(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.ptr, self.size) } } + #[inline] fn slice_mut(&mut self) -> &mut [u8] { unsafe { slice::from_raw_parts_mut(self.ptr, self.size) } } diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 38f2419a16b..db0ff1eafd1 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -2527,10 +2527,12 @@ pub struct BufferMappedRange { } impl crate::BufferMappedRangeSlice for BufferMappedRange { + #[inline] fn slice(&self) -> &[u8] { &self.temporary_mapping } + #[inline] fn slice_mut(&mut self) -> &mut [u8] { &mut self.temporary_mapping }