diff --git a/src/Veldrid/CommandList.cs b/src/Veldrid/CommandList.cs index 983bdf9c8..ec0b3ca90 100644 --- a/src/Veldrid/CommandList.cs +++ b/src/Veldrid/CommandList.cs @@ -694,8 +694,7 @@ public unsafe void UpdateBuffer( uint bufferOffsetInBytes, T source) where T : unmanaged { - ref byte sourceByteRef = ref Unsafe.AsRef(Unsafe.AsPointer(ref source)); - fixed (byte* ptr = &sourceByteRef) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, (uint)sizeof(T)); + UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)(&source), (uint)sizeof(T)); } /// @@ -714,8 +713,7 @@ public unsafe void UpdateBuffer( uint bufferOffsetInBytes, ref T source) where T : unmanaged { - ref byte sourceByteRef = ref Unsafe.AsRef(Unsafe.AsPointer(ref source)); - fixed (byte* ptr = &sourceByteRef) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, Util.USizeOf()); + fixed (T* ptr = &source) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, Util.USizeOf()); } /// @@ -736,8 +734,7 @@ public unsafe void UpdateBuffer( ref T source, uint sizeInBytes) where T : unmanaged { - ref byte sourceByteRef = ref Unsafe.AsRef(Unsafe.AsPointer(ref source)); - fixed (byte* ptr = &sourceByteRef) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, sizeInBytes); + fixed (T* ptr = &source) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, sizeInBytes); } /// diff --git a/src/Veldrid/GraphicsDevice.cs b/src/Veldrid/GraphicsDevice.cs index 6b64c29de..68c02ceff 100644 --- a/src/Veldrid/GraphicsDevice.cs +++ b/src/Veldrid/GraphicsDevice.cs @@ -672,8 +672,7 @@ public unsafe void UpdateBuffer( uint bufferOffsetInBytes, T source) where T : unmanaged { - ref byte sourceByteRef = ref Unsafe.AsRef(Unsafe.AsPointer(ref source)); - fixed (byte* ptr = &sourceByteRef) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, (uint)sizeof(T)); + UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)(&source), (uint)sizeof(T)); } /// @@ -692,8 +691,7 @@ public unsafe void UpdateBuffer( uint bufferOffsetInBytes, ref T source) where T : unmanaged { - ref byte sourceByteRef = ref Unsafe.AsRef(Unsafe.AsPointer(ref source)); - fixed (byte* ptr = &sourceByteRef) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, (uint)sizeof(T)); + fixed (T* ptr = &source) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, (uint)sizeof(T)); } /// @@ -714,8 +712,7 @@ public unsafe void UpdateBuffer( ref T source, uint sizeInBytes) where T : unmanaged { - ref byte sourceByteRef = ref Unsafe.AsRef(Unsafe.AsPointer(ref source)); - fixed (byte* ptr = &sourceByteRef) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, sizeInBytes); + fixed (T* ptr = &source) UpdateBuffer(buffer, bufferOffsetInBytes, (IntPtr)ptr, sizeInBytes); } ///