diff --git a/src/ComputeSharp.Core/ComputeSharp.Core.csproj b/src/ComputeSharp.Core/ComputeSharp.Core.csproj index f45bdfcc..9147a851 100644 --- a/src/ComputeSharp.Core/ComputeSharp.Core.csproj +++ b/src/ComputeSharp.Core/ComputeSharp.Core.csproj @@ -1,7 +1,11 @@  - netstandard2.1 + netstandard2.0 + + + + diff --git a/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs b/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs index 2564eb1e..681f6bbc 100644 --- a/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs +++ b/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs @@ -35,10 +35,13 @@ namespace ComputeSharp /// A constant instance with the contents of the input 2D array [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, T[,] array) where T : unmanaged + public static unsafe ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, T[,] array) where T : unmanaged { - Span span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length); - return device.AllocateConstantBuffer(span); + fixed (T* p = array) + { + Span span = new Span(p, array.Length); + return device.AllocateConstantBuffer(span); + } } /// @@ -112,10 +115,13 @@ namespace ComputeSharp /// A read write instance with the contents of the input 2D array [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, T[,] array) where T : unmanaged + public static unsafe ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, T[,] array) where T : unmanaged { - Span span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length); - return device.AllocateReadOnlyBuffer(span); + fixed (T* p = array) + { + Span span = new Span(p, array.Length); + return device.AllocateReadOnlyBuffer(span); + } } /// @@ -189,10 +195,13 @@ namespace ComputeSharp /// A read write instance with the contents of the input 2D array [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, T[,] array) where T : unmanaged + public static unsafe ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, T[,] array) where T : unmanaged { - Span span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length); - return device.AllocateReadWriteBuffer(span); + fixed (T* p = array) + { + Span span = new Span(p, array.Length); + return device.AllocateReadWriteBuffer(span); + } } /// diff --git a/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj b/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj index c9360703..5dc565b5 100644 --- a/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj +++ b/src/ComputeSharp.Graphics/ComputeSharp.Graphics.csproj @@ -1,13 +1,14 @@  - netstandard2.1 + netstandard2.0 8.0 enable true + diff --git a/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj b/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj index 726a7283..e4c54147 100644 --- a/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj +++ b/src/ComputeSharp.Shaders/ComputeSharp.Shaders.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 8.0 enable true diff --git a/src/ComputeSharp/ComputeSharp.csproj b/src/ComputeSharp/ComputeSharp.csproj index a4f15ee8..47b844e8 100644 --- a/src/ComputeSharp/ComputeSharp.csproj +++ b/src/ComputeSharp/ComputeSharp.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 8.0 enable diff --git a/src/ComputeSharp/ComputeSharp.nuspec b/src/ComputeSharp/ComputeSharp.nuspec index 3ea4cc89..1f2e056e 100644 --- a/src/ComputeSharp/ComputeSharp.nuspec +++ b/src/ComputeSharp/ComputeSharp.nuspec @@ -17,6 +17,8 @@ + +