Removed array pinning
このコミットが含まれているのは:
1 親
6812807530
コミット
f465a52fb3
1ファイル変更
+10
-18
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Graphics;
|
||||
using ComputeSharp.Graphics.Buffers;
|
||||
using ComputeSharp.Graphics.Buffers.Abstract;
|
||||
@@ -35,13 +36,10 @@ namespace ComputeSharp
|
||||
/// <returns>A constant <see cref="ConstantBuffer{T}"/> instance with the contents of the input 2D array</returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
|
||||
{
|
||||
fixed (T* p = array)
|
||||
{
|
||||
Span<T> span = new Span<T>(p, array.Length);
|
||||
return device.AllocateConstantBuffer(span);
|
||||
}
|
||||
Span<T> span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length);
|
||||
return device.AllocateConstantBuffer(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -115,13 +113,10 @@ namespace ComputeSharp
|
||||
/// <returns>A read write <see cref="ReadOnlyBuffer{T}"/> instance with the contents of the input 2D array</returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
|
||||
{
|
||||
fixed (T* p = array)
|
||||
{
|
||||
Span<T> span = new Span<T>(p, array.Length);
|
||||
return device.AllocateReadOnlyBuffer(span);
|
||||
}
|
||||
Span<T> span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length);
|
||||
return device.AllocateReadOnlyBuffer(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -195,13 +190,10 @@ namespace ComputeSharp
|
||||
/// <returns>A read write <see cref="ReadWriteBuffer{T}"/> instance with the contents of the input 2D array</returns>
|
||||
[Pure]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
|
||||
{
|
||||
fixed (T* p = array)
|
||||
{
|
||||
Span<T> span = new Span<T>(p, array.Length);
|
||||
return device.AllocateReadWriteBuffer(span);
|
||||
}
|
||||
Span<T> span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length);
|
||||
return device.AllocateReadWriteBuffer(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする