Renamed GetData/SetData to CopyTo/CopyFrom
このコミットが含まれているのは:
1 親
da19f87276
コミット
f8d0ac5b87
23ファイル変更
+183
-183
検索条件に一致するファイルはありません
@@ -157,7 +157,7 @@ namespace ComputeSharp.Benchmark.Blas
|
||||
|
||||
BlasHelpers.FullyConnectedForwardGpu(Gpu.Default, C, N, M, P, x, w, b, y);
|
||||
|
||||
y.GetData(Y);
|
||||
y.CopyTo(Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ namespace ComputeSharp.BokehBlur.Processors
|
||||
{
|
||||
Vector4 parameters = KernelParameters[j];
|
||||
|
||||
kernel.SetData(Kernels[j]);
|
||||
kernel.CopyFrom(Kernels[j]);
|
||||
|
||||
Gpu.Default.For<VerticalConvolutionProcessor>(
|
||||
source.Width,
|
||||
@@ -287,7 +287,7 @@ namespace ComputeSharp.BokehBlur.Processors
|
||||
Gpu.Default.For<InverseGammaHighlightProcessor>(source.Height, new(temporary, texture));
|
||||
|
||||
// Write the final pixel data
|
||||
texture.GetData(span);
|
||||
texture.CopyTo(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace ComputeSharp.BokehBlur.Processors
|
||||
Gpu.Default.For<VerticalConvolutionProcessor>(source.Width, source.Height, new(sourceTexture, firstPassTexture, kernelBuffer));
|
||||
Gpu.Default.For<HorizontalConvolutionProcessor>(source.Width, source.Height, new(firstPassTexture, sourceTexture, kernelBuffer));
|
||||
|
||||
sourceTexture.GetData(span);
|
||||
sourceTexture.CopyTo(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ComputeSharp.Sample
|
||||
Gpu.Default.For(100, new MainKernel(gpuBuffer));
|
||||
|
||||
// Get the data back
|
||||
gpuBuffer.GetData(array);
|
||||
gpuBuffer.CopyTo(array);
|
||||
|
||||
// Print the updated matrix
|
||||
Console.WriteLine("===================== AFTER ======================");
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="destination">The input memory area to write data to.</param>
|
||||
/// <param name="length">The length of the memory area to write data to.</param>
|
||||
/// <param name="offset">The offset to start reading data from.</param>
|
||||
internal abstract void GetData(ref T destination, int length, int offset);
|
||||
internal abstract void CopyTo(ref T destination, int length, int offset);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given memory area to a specified area of the current <see cref="Buffer{T}"/> instance.
|
||||
@@ -120,19 +120,19 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="source">The input memory area to read data from.</param>
|
||||
/// <param name="length">The length of the input memory area to read data from.</param>
|
||||
/// <param name="offset">The offset to start writing data to.</param>
|
||||
internal abstract void SetData(ref T source, int length, int offset);
|
||||
internal abstract void CopyFrom(ref T source, int length, int offset);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="Buffer{T}"/> to the current <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> to read data from.</param>
|
||||
public abstract void SetData(Buffer<T> source);
|
||||
public abstract void CopyFrom(Buffer<T> source);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="Buffer{T}"/> to the current <see cref="Buffer{T}"/> instance, using a temporary CPU buffer.
|
||||
/// </summary>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> to read data from.</param>
|
||||
protected void SetDataWithCpuBuffer(Buffer<T> source)
|
||||
protected void CopyFromWithCpuBuffer(Buffer<T> source)
|
||||
{
|
||||
T[] array = ArrayPool<T>.Shared.Rent(source.Length);
|
||||
|
||||
@@ -140,9 +140,9 @@ namespace ComputeSharp.Resources
|
||||
{
|
||||
ref T r0 = ref MemoryMarshal.GetArrayDataReference(array);
|
||||
|
||||
source.GetData(ref r0, source.Length, 0);
|
||||
source.CopyTo(ref r0, source.Length, 0);
|
||||
|
||||
SetData(ref r0, source.Length, 0);
|
||||
CopyFrom(ref r0, source.Length, 0);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ComputeSharp.Resources
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override unsafe void GetData(ref T destination, int length, int offset)
|
||||
internal override unsafe void CopyTo(ref T destination, int length, int offset)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="length">The number of items to read.</param>
|
||||
/// <param name="offset">The offset to start reading data from.</param>
|
||||
internal unsafe void GetData(ReadBackBuffer<T> destination, int destinationOffset, int length, int offset)
|
||||
internal unsafe void CopyTo(ReadBackBuffer<T> destination, int destinationOffset, int length, int offset)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace ComputeSharp.Resources
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override unsafe void SetData(ref T source, int length, int offset)
|
||||
internal override unsafe void CopyFrom(ref T source, int length, int offset)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="sourceOffset">The starting offset within <paramref name="source"/> to read data from.</param>
|
||||
/// <param name="length">The number of items to read.</param>
|
||||
/// <param name="offset">The offset to start reading writing data to.</param>
|
||||
internal unsafe void SetData(UploadBuffer<T> source, int sourceOffset, int length, int offset)
|
||||
internal unsafe void CopyFrom(UploadBuffer<T> source, int sourceOffset, int length, int offset)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace ComputeSharp.Resources
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void SetData(Buffer<T> source)
|
||||
public override unsafe void CopyFrom(Buffer<T> source)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace ComputeSharp.Resources
|
||||
copyCommandList.CopyBufferRegion(D3D12Resource, 0, source.D3D12Resource, 0,(ulong)SizeInBytes);
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
else SetDataWithCpuBuffer(source);
|
||||
else CopyFromWithCpuBuffer(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="y">The vertical offset in the source texture.</param>
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
internal void GetData(ref T destination, int size, int x, int y, int width, int height)
|
||||
internal void CopyTo(ref T destination, int size, int x, int y, int width, int height)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="y">The vertical offset in the destination texture.</param>
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
internal void SetData(ref T source, int size, int x, int y, int width, int height)
|
||||
internal void CopyFrom(ref T source, int size, int x, int y, int width, int height)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
/// <param name="depth">The depth of the memory area to copy.</param>
|
||||
internal void GetData(ref T destination, int size, int x, int y, int z, int width, int height, int depth)
|
||||
internal void CopyTo(ref T destination, int size, int x, int y, int z, int width, int height, int depth)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
/// <param name="depth">The depth of the memory area to write to.</param>
|
||||
internal void SetData(ref T source, int size, int x, int y, int z, int width, int height, int depth)
|
||||
internal void CopyFrom(ref T source, int size, int x, int y, int z, int width, int height, int depth)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace ComputeSharp
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override unsafe void GetData(ref T destination, int size, int offset)
|
||||
internal override unsafe void CopyTo(ref T destination, int size, int offset)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace ComputeSharp
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override unsafe void SetData(ref T source, int size, int offset)
|
||||
internal override unsafe void CopyFrom(ref T source, int size, int offset)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace ComputeSharp
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void SetData(Buffer<T> source)
|
||||
public override unsafe void CopyFrom(Buffer<T> source)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace ComputeSharp
|
||||
copyCommandList.CopyBufferRegion(D3D12Resource, 0, source.D3D12Resource, 0,(ulong)SizeInBytes);
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
else SetDataWithCpuBuffer(source);
|
||||
else CopyFromWithCpuBuffer(source);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace ComputeSharp.Resources.Views
|
||||
{
|
||||
var items = GC.AllocateUninitializedArray<T>(buffer.Length);
|
||||
|
||||
buffer.GetData(ref items[0], buffer.Length, 0);
|
||||
buffer.CopyTo(ref items[0], buffer.Length, 0);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ComputeSharp.Resources.Views
|
||||
{
|
||||
var items = new T[texture.Height, texture.Width];
|
||||
|
||||
texture.GetData(ref items[0, 0], items.Length, 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyTo(ref items[0, 0], items.Length, 0, 0, texture.Width, texture.Height);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ComputeSharp.Resources.Views
|
||||
{
|
||||
var items = new T[texture.Depth, texture.Height, texture.Width];
|
||||
|
||||
texture.GetData(ref items[0, 0, 0], items.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyTo(ref items[0, 0, 0], items.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ConstantBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
buffer.SetData(source);
|
||||
buffer.CopyFrom(source);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ConstantBuffer<T> constantBuffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
constantBuffer.SetData(source);
|
||||
constantBuffer.CopyFrom(source);
|
||||
|
||||
return constantBuffer;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
buffer.SetData(source);
|
||||
buffer.CopyFrom(source);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyBuffer<T> readWriteBuffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
readWriteBuffer.SetData(source, 0, source.Length, 0);
|
||||
readWriteBuffer.CopyFrom(source, 0, source.Length, 0);
|
||||
|
||||
return readWriteBuffer;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyBuffer<T> readWriteBuffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
readWriteBuffer.SetData(source);
|
||||
readWriteBuffer.CopyFrom(source);
|
||||
|
||||
return readWriteBuffer;
|
||||
}
|
||||
@@ -223,7 +223,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture2D<T> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture2D<T> texture = new(device, width, height, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture2D<T, TPixel> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -340,7 +340,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture2D<T, TPixel> texture = new(device, width, height, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture3D<T> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -435,7 +435,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture3D<T> texture = new(device, width, height, depth, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -517,7 +517,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture3D<T, TPixel> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -540,7 +540,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadOnlyTexture3D<T, TPixel> texture = new(device, width, height, depth, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
buffer.SetData(source);
|
||||
buffer.CopyFrom(source);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -605,7 +605,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteBuffer<T> readWriteBuffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
readWriteBuffer.SetData(source, 0, source.Length, 0);
|
||||
readWriteBuffer.CopyFrom(source, 0, source.Length, 0);
|
||||
|
||||
return readWriteBuffer;
|
||||
}
|
||||
@@ -623,7 +623,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteBuffer<T> readWriteBuffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
readWriteBuffer.SetData(source);
|
||||
readWriteBuffer.CopyFrom(source);
|
||||
|
||||
return readWriteBuffer;
|
||||
}
|
||||
@@ -690,7 +690,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture2D<T> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -710,7 +710,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture2D<T> texture = new(device, width, height, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -785,7 +785,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture2D<T, TPixel> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -807,7 +807,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture2D<T, TPixel> texture = new(device, width, height, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -881,7 +881,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture3D<T> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -902,7 +902,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture3D<T> texture = new(device, width, height, depth, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -984,7 +984,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture3D<T, TPixel> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -1007,7 +1007,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadWriteTexture3D<T, TPixel> texture = new(device, width, height, depth, AllocationMode.Default);
|
||||
|
||||
texture.SetData(source);
|
||||
texture.CopyFrom(source);
|
||||
|
||||
return texture;
|
||||
}
|
||||
@@ -1105,7 +1105,7 @@ namespace ComputeSharp
|
||||
{
|
||||
ReadBackBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
|
||||
|
||||
source.GetData(buffer, 0, buffer.Length, 0);
|
||||
source.CopyTo(buffer, 0, buffer.Length, 0);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace ComputeSharp
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <returns>A <typeparamref name="T"/> array with the contents of the input buffer.</returns>
|
||||
[Pure]
|
||||
public static T[] GetData<T>(this Buffer<T> buffer)
|
||||
public static T[] ToArray<T>(this Buffer<T> buffer)
|
||||
where T : unmanaged
|
||||
{
|
||||
return buffer.GetData(0, buffer.Length);
|
||||
return buffer.ToArray(0, buffer.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -33,14 +33,14 @@ namespace ComputeSharp
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
/// <returns>A <typeparamref name="T"/> array with the contents of the specified range from the current buffer.</returns>
|
||||
[Pure]
|
||||
public static T[] GetData<T>(this Buffer<T> buffer, int offset, int count)
|
||||
public static T[] ToArray<T>(this Buffer<T> buffer, int offset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsGreaterThanOrEqualTo(count, 0, nameof(count));
|
||||
|
||||
T[] data = GC.AllocateUninitializedArray<T>(count);
|
||||
|
||||
buffer.GetData(data.AsSpan(), offset);
|
||||
buffer.CopyTo(data.AsSpan(), offset);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -51,10 +51,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
public static void GetData<T>(this Buffer<T> buffer, T[] destination)
|
||||
public static void CopyTo<T>(this Buffer<T> buffer, T[] destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.GetData(destination.AsSpan(), 0);
|
||||
buffer.CopyTo(destination.AsSpan(), 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,12 +66,12 @@ namespace ComputeSharp
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="bufferOffset">The offset to start reading data from.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void GetData<T>(this Buffer<T> buffer, T[] destination, int destinationOffset, int bufferOffset, int count)
|
||||
public static void CopyTo<T>(this Buffer<T> buffer, T[] destination, int destinationOffset, int bufferOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Span<T> span = destination.AsSpan(destinationOffset, count);
|
||||
|
||||
buffer.GetData(span, bufferOffset);
|
||||
buffer.CopyTo(span, bufferOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,10 +80,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
public static void GetData<T>(this Buffer<T> buffer, Span<T> destination)
|
||||
public static void CopyTo<T>(this Buffer<T> buffer, Span<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.GetData(destination, 0);
|
||||
buffer.CopyTo(destination, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,10 +93,10 @@ namespace ComputeSharp
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
/// <param name="offset">The offset to start reading data from.</param>
|
||||
public static void GetData<T>(this Buffer<T> buffer, Span<T> destination, int offset)
|
||||
public static void CopyTo<T>(this Buffer<T> buffer, Span<T> destination, int offset)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.GetData(ref MemoryMarshal.GetReference(destination), destination.Length, offset);
|
||||
buffer.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,10 +105,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="buffer">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public static void SetData<T>(this Buffer<T> buffer, T[] source)
|
||||
public static void CopyFrom<T>(this Buffer<T> buffer, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.SetData(source.AsSpan(), 0);
|
||||
buffer.CopyFrom(source.AsSpan(), 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -120,12 +120,12 @@ namespace ComputeSharp
|
||||
/// <param name="sourceOffset">The starting offset within <paramref name="source"/> to read data from.</param>
|
||||
/// <param name="bufferOffset">The offset to start writing data to.</param>
|
||||
/// <param name="count">The number of items to write.</param>
|
||||
public static void SetData<T>(this Buffer<T> buffer, T[] source, int sourceOffset, int bufferOffset, int count)
|
||||
public static void CopyFrom<T>(this Buffer<T> buffer, T[] source, int sourceOffset, int bufferOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
ReadOnlySpan<T> span = source.AsSpan(sourceOffset, count);
|
||||
|
||||
buffer.SetData(span, bufferOffset);
|
||||
buffer.CopyFrom(span, bufferOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -134,10 +134,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="buffer">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
public static void SetData<T>(this Buffer<T> buffer, ReadOnlySpan<T> source)
|
||||
public static void CopyFrom<T>(this Buffer<T> buffer, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.SetData(source, 0);
|
||||
buffer.CopyFrom(source, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,10 +147,10 @@ namespace ComputeSharp
|
||||
/// <param name="buffer">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
/// <param name="offset">The offset to start writing data to.</param>
|
||||
public static void SetData<T>(this Buffer<T> buffer, ReadOnlySpan<T> source, int offset)
|
||||
public static void CopyFrom<T>(this Buffer<T> buffer, ReadOnlySpan<T> source, int offset)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.SetData(ref MemoryMarshal.GetReference(source), source.Length, offset);
|
||||
buffer.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace ComputeSharp
|
||||
public static void CopyTo<T>(this StructuredBuffer<T> buffer, ReadBackBuffer<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.GetData(destination, 0, buffer.Length, 0);
|
||||
buffer.CopyTo(destination, 0, buffer.Length, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -33,7 +33,7 @@ namespace ComputeSharp
|
||||
public static void CopyTo<T>(this StructuredBuffer<T> buffer, ReadBackBuffer<T> destination, int destinationOffset, int bufferOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
buffer.GetData(destination, destinationOffset, count, bufferOffset);
|
||||
buffer.CopyTo(destination, destinationOffset, count, bufferOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,12 @@ namespace ComputeSharp
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance to read data from.</param>
|
||||
/// <returns>A <typeparamref name="T"/> array with the contents of the current texture.</returns>
|
||||
[Pure]
|
||||
public static T[,] GetData<T>(this Texture2D<T> texture)
|
||||
public static T[,] ToArray<T>(this Texture2D<T> texture)
|
||||
where T : unmanaged
|
||||
{
|
||||
T[,] data = new T[texture.Height, texture.Width];
|
||||
|
||||
texture.GetData(data);
|
||||
texture.CopyTo(data);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -34,13 +34,13 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[,] destination)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[,] destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsEqualTo(destination.GetLength(0), texture.Height, nameof(destination));
|
||||
Guard.IsEqualTo(destination.GetLength(1), texture.Width, nameof(destination));
|
||||
|
||||
texture.GetData(ref destination[0, 0], destination.Length, 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyTo(ref destination[0, 0], destination.Length, 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,10 +49,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[] destination)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[] destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(), 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyTo(destination.AsSpan(), 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -63,10 +63,10 @@ namespace ComputeSharp
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
/// <param name="x">The horizontal range of items to copy.</param>
|
||||
/// <param name="y">The vertical range of items to copy.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[] destination, Range x, Range y)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[] destination, Range x, Range y)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(), x, y);
|
||||
texture.CopyTo(destination.AsSpan(), x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,10 +79,10 @@ namespace ComputeSharp
|
||||
/// <param name="y">The vertical offset in the source texture.</param>
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[] destination, int x, int y, int width, int height)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[] destination, int x, int y, int width, int height)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(), x, y, width, height);
|
||||
texture.CopyTo(destination.AsSpan(), x, y, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,10 +92,10 @@ namespace ComputeSharp
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
/// <param name="offset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[] destination, int offset)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[] destination, int offset)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(offset), 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyTo(destination.AsSpan(offset), 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -107,10 +107,10 @@ namespace ComputeSharp
|
||||
/// <param name="offset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="x">The horizontal range of items to copy.</param>
|
||||
/// <param name="y">The vertical range of items to copy.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[] destination, int offset, Range x, Range y)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[] destination, int offset, Range x, Range y)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(offset), x, y);
|
||||
texture.CopyTo(destination.AsSpan(offset), x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -124,10 +124,10 @@ namespace ComputeSharp
|
||||
/// <param name="y">The vertical offset in the source texture.</param>
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, T[] destination, int offset, int x, int y, int width, int height)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, T[] destination, int offset, int x, int y, int width, int height)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(offset), x, y, width, height);
|
||||
texture.CopyTo(destination.AsSpan(offset), x, y, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -137,10 +137,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, Span<T> destination)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, Span<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination, 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyTo(destination, 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -151,13 +151,13 @@ namespace ComputeSharp
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
/// <param name="x">The horizontal range of items to copy.</param>
|
||||
/// <param name="y">The vertical range of items to copy.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, Span<T> destination, Range x, Range y)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, Span<T> destination, Range x, Range y)
|
||||
where T : unmanaged
|
||||
{
|
||||
var (offsetX, width) = x.GetOffsetAndLength(texture.Width);
|
||||
var (offsetY, height) = y.GetOffsetAndLength(texture.Height);
|
||||
|
||||
texture.GetData(destination, offsetX, offsetY, width, height);
|
||||
texture.CopyTo(destination, offsetX, offsetY, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -170,10 +170,10 @@ namespace ComputeSharp
|
||||
/// <param name="y">The vertical offset in the source texture.</param>
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
public static void GetData<T>(this Texture2D<T> texture, Span<T> destination, int x, int y, int width, int height)
|
||||
public static void CopyTo<T>(this Texture2D<T> texture, Span<T> destination, int x, int y, int width, int height)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, width, height);
|
||||
texture.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -182,13 +182,13 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The target <see cref="Texture2D{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public static unsafe void SetData<T>(this Texture2D<T> texture, T[,] source)
|
||||
public static unsafe void CopyFrom<T>(this Texture2D<T> texture, T[,] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsEqualTo(source.GetLength(0), texture.Height, nameof(source));
|
||||
Guard.IsEqualTo(source.GetLength(1), texture.Width, nameof(source));
|
||||
|
||||
texture.SetData(ref source[0, 0], source.Length, 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyFrom(ref source[0, 0], source.Length, 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -197,10 +197,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The target <see cref="Texture2D{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, T[] source)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(), 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyFrom(source.AsSpan(), 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -211,10 +211,10 @@ namespace ComputeSharp
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
/// <param name="x">The horizontal range of items to write.</param>
|
||||
/// <param name="y">The vertical range of items to write.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, T[] source, Range x, Range y)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, T[] source, Range x, Range y)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(), x, y);
|
||||
texture.CopyFrom(source.AsSpan(), x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -227,10 +227,10 @@ namespace ComputeSharp
|
||||
/// <param name="y">The vertical offset in the destination texture.</param>
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, T[] source, int x, int y, int width, int height)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, T[] source, int x, int y, int width, int height)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(), x, y, width, height);
|
||||
texture.CopyFrom(source.AsSpan(), x, y, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,10 +242,10 @@ namespace ComputeSharp
|
||||
/// <param name="offset">The starting offset within <paramref name="source"/> to read data from.</param>
|
||||
/// <param name="x">The horizontal range of items to write.</param>
|
||||
/// <param name="y">The vertical range of items to write.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, T[] source, int offset, Range x, Range y)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, T[] source, int offset, Range x, Range y)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(offset), x, y);
|
||||
texture.CopyFrom(source.AsSpan(offset), x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -259,10 +259,10 @@ namespace ComputeSharp
|
||||
/// <param name="y">The vertical offset in the destination texture.</param>
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, T[] source, int offset, int x, int y, int width, int height)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, T[] source, int offset, int x, int y, int width, int height)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(offset), x, y, width, height);
|
||||
texture.CopyFrom(source.AsSpan(offset), x, y, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -272,10 +272,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The target <see cref="Texture2D{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, ReadOnlySpan<T> source)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source, 0, 0, texture.Width, texture.Height);
|
||||
texture.CopyFrom(source, 0, 0, texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -286,13 +286,13 @@ namespace ComputeSharp
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
/// <param name="x">The horizontal range of items to write.</param>
|
||||
/// <param name="y">The vertical range of items to write.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, ReadOnlySpan<T> source, Range x, Range y)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, ReadOnlySpan<T> source, Range x, Range y)
|
||||
where T : unmanaged
|
||||
{
|
||||
var (offsetX, width) = x.GetOffsetAndLength(texture.Width);
|
||||
var (offsetY, height) = y.GetOffsetAndLength(texture.Height);
|
||||
|
||||
texture.SetData(source, offsetX, offsetY, width, height);
|
||||
texture.CopyFrom(source, offsetX, offsetY, width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -305,10 +305,10 @@ namespace ComputeSharp
|
||||
/// <param name="y">The vertical offset in the destination texture.</param>
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
public static void SetData<T>(this Texture2D<T> texture, ReadOnlySpan<T> source, int x, int y, int width, int height)
|
||||
public static void CopyFrom<T>(this Texture2D<T> texture, ReadOnlySpan<T> source, int x, int y, int width, int height)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(ref MemoryMarshal.GetReference(source), source.Length, x, y, width, height);
|
||||
texture.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, x, y, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,12 @@ namespace ComputeSharp
|
||||
/// the depth dimension. This means that the resulting 3D array will have a size of [D, H, W].
|
||||
/// </remarks>
|
||||
[Pure]
|
||||
public static T[,,] GetData<T>(this Texture3D<T> texture)
|
||||
public static T[,,] ToArray<T>(this Texture3D<T> texture)
|
||||
where T : unmanaged
|
||||
{
|
||||
T[,,] data = new T[texture.Depth, texture.Height, texture.Width];
|
||||
|
||||
texture.GetData(data);
|
||||
texture.CopyTo(data);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -43,14 +43,14 @@ namespace ComputeSharp
|
||||
/// The input 3D array needs to have each 2D plane stacked on the depth axis. That is, the expected
|
||||
/// layout of the input array has to be of shape [depth, height, width].
|
||||
/// </remarks>
|
||||
public static void GetData<T>(this Texture3D<T> texture, T[,,] destination)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, T[,,] destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsEqualTo(destination.GetLength(0), texture.Depth, nameof(destination));
|
||||
Guard.IsEqualTo(destination.GetLength(1), texture.Height, nameof(destination));
|
||||
Guard.IsEqualTo(destination.GetLength(2), texture.Width, nameof(destination));
|
||||
|
||||
texture.GetData(ref destination[0, 0, 0], destination.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyTo(ref destination[0, 0, 0], destination.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,10 +60,10 @@ namespace ComputeSharp
|
||||
/// <param name="texture">The input <see cref="Texture3D{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
/// <param name="offset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
public static void GetData<T>(this Texture3D<T> texture, T[] destination, int offset)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, T[] destination, int offset)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(offset), 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyTo(destination.AsSpan(offset), 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,10 +76,10 @@ namespace ComputeSharp
|
||||
/// <param name="x">The horizontal range of items to copy.</param>
|
||||
/// <param name="y">The vertical range of items to copy.</param>
|
||||
/// <param name="z">The depthwise range of items to copy.</param>
|
||||
public static void GetData<T>(this Texture3D<T> texture, T[] destination, int offset, Range x, Range y, Range z)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, T[] destination, int offset, Range x, Range y, Range z)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(offset), x, y, z);
|
||||
texture.CopyTo(destination.AsSpan(offset), x, y, z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -95,10 +95,10 @@ namespace ComputeSharp
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
/// <param name="depth">The depth of the memory area to copy.</param>
|
||||
public static void GetData<T>(this Texture3D<T> texture, T[] destination, int offset, int x, int y, int z, int width, int height, int depth)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, T[] destination, int offset, int x, int y, int z, int width, int height, int depth)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination.AsSpan(offset), x, y, z, width, height, depth);
|
||||
texture.CopyTo(destination.AsSpan(offset), x, y, z, width, height, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -107,10 +107,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The input <see cref="Texture3D{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
public static void GetData<T>(this Texture3D<T> texture, Span<T> destination)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, Span<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(destination, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyTo(destination, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,14 +122,14 @@ namespace ComputeSharp
|
||||
/// <param name="x">The horizontal range in the source texture.</param>
|
||||
/// <param name="y">The vertical range in the source texture.</param>
|
||||
/// <param name="z">The depthwise range in the source texture.</param>
|
||||
public static void GetData<T>(this Texture3D<T> texture, Span<T> destination, Range x, Range y, Range z)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, Span<T> destination, Range x, Range y, Range z)
|
||||
where T : unmanaged
|
||||
{
|
||||
var (offsetX, width) = x.GetOffsetAndLength(texture.Width);
|
||||
var (offsetY, height) = y.GetOffsetAndLength(texture.Height);
|
||||
var (offsetZ, depth) = z.GetOffsetAndLength(texture.Depth);
|
||||
|
||||
texture.GetData(destination, offsetX, offsetY, offsetZ, width, height, depth);
|
||||
texture.CopyTo(destination, offsetX, offsetY, offsetZ, width, height, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -144,10 +144,10 @@ namespace ComputeSharp
|
||||
/// <param name="width">The width of the memory area to copy.</param>
|
||||
/// <param name="height">The height of the memory area to copy.</param>
|
||||
/// <param name="depth">The depth of the memory area to copy.</param>
|
||||
public static void GetData<T>(this Texture3D<T> texture, Span<T> destination, int x, int y, int z, int width, int height, int depth)
|
||||
public static void CopyTo<T>(this Texture3D<T> texture, Span<T> destination, int x, int y, int z, int width, int height, int depth)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.GetData(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, z, width, height, depth);
|
||||
texture.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, z, width, height, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -160,14 +160,14 @@ namespace ComputeSharp
|
||||
/// The source 3D array needs to have each 2D plane stacked on the depth axis. That is, the expected
|
||||
/// layout of the input array has to be of shape [depth, height, width].
|
||||
/// </remarks>
|
||||
public static void SetData<T>(this Texture3D<T> texture, T[,,] source)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, T[,,] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsEqualTo(source.GetLength(0), texture.Depth, nameof(source));
|
||||
Guard.IsEqualTo(source.GetLength(1), texture.Height, nameof(source));
|
||||
Guard.IsEqualTo(source.GetLength(2), texture.Width, nameof(source));
|
||||
|
||||
texture.SetData(ref source[0, 0, 0], source.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyFrom(ref source[0, 0, 0], source.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -176,10 +176,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The target <see cref="Texture3D{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, T[] source)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(), 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyFrom(source.AsSpan(), 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -191,10 +191,10 @@ namespace ComputeSharp
|
||||
/// <param name="x">The horizontal range of items to write.</param>
|
||||
/// <param name="y">The vertical range of items to write.</param>
|
||||
/// <param name="z">The depthwise range of items to write.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, T[] source, Range x, Range y, Range z)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, T[] source, Range x, Range y, Range z)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(), x, y, z);
|
||||
texture.CopyFrom(source.AsSpan(), x, y, z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -209,10 +209,10 @@ namespace ComputeSharp
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
/// <param name="depth">The depth of the memory area to write to.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, T[] source, int x, int y, int z, int width, int height, int depth)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, T[] source, int x, int y, int z, int width, int height, int depth)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(), x, y, z, width, height, depth);
|
||||
texture.CopyFrom(source.AsSpan(), x, y, z, width, height, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -225,10 +225,10 @@ namespace ComputeSharp
|
||||
/// <param name="x">The horizontal range of items to write.</param>
|
||||
/// <param name="y">The vertical range of items to write.</param>
|
||||
/// <param name="z">The depthwise range of items to write.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, T[] source, int offset, Range x, Range y, Range z)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, T[] source, int offset, Range x, Range y, Range z)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(offset), x, y, z);
|
||||
texture.CopyFrom(source.AsSpan(offset), x, y, z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -244,10 +244,10 @@ namespace ComputeSharp
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
/// <param name="depth">The depth of the memory area to write to.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, T[] source, int offset, int x, int y, int z, int width, int height, int depth)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, T[] source, int offset, int x, int y, int z, int width, int height, int depth)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source.AsSpan(offset), x, y, z, width, height, depth);
|
||||
texture.CopyFrom(source.AsSpan(offset), x, y, z, width, height, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -257,10 +257,10 @@ namespace ComputeSharp
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="texture">The target <see cref="Texture3D{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, ReadOnlySpan<T> source)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(source, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
texture.CopyFrom(source, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -272,14 +272,14 @@ namespace ComputeSharp
|
||||
/// <param name="x">The horizontal range of items to write.</param>
|
||||
/// <param name="y">The vertical range of items to write.</param>
|
||||
/// <param name="z">The depthwise range of items to write.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, ReadOnlySpan<T> source, Range x, Range y, Range z)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, ReadOnlySpan<T> source, Range x, Range y, Range z)
|
||||
where T : unmanaged
|
||||
{
|
||||
var (offsetX, width) = x.GetOffsetAndLength(texture.Width);
|
||||
var (offsetY, height) = y.GetOffsetAndLength(texture.Height);
|
||||
var (offsetZ, depth) = z.GetOffsetAndLength(texture.Depth);
|
||||
|
||||
texture.SetData(source, offsetX, offsetY, offsetZ, width, height, depth);
|
||||
texture.CopyFrom(source, offsetX, offsetY, offsetZ, width, height, depth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -294,10 +294,10 @@ namespace ComputeSharp
|
||||
/// <param name="width">The width of the memory area to write to.</param>
|
||||
/// <param name="height">The height of the memory area to write to.</param>
|
||||
/// <param name="depth">The depth of the memory area to write to.</param>
|
||||
public static void SetData<T>(this Texture3D<T> texture, ReadOnlySpan<T> source, int x, int y, int z, int width, int height, int depth)
|
||||
public static void CopyFrom<T>(this Texture3D<T> texture, ReadOnlySpan<T> source, int x, int y, int z, int width, int height, int depth)
|
||||
where T : unmanaged
|
||||
{
|
||||
texture.SetData(ref MemoryMarshal.GetReference(source), source.Length, x, y, z, width, height, depth);
|
||||
texture.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, x, y, z, width, height, depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace ComputeSharp
|
||||
public static void CopyTo<T>(this UploadBuffer<T> buffer, StructuredBuffer<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
destination.SetData(buffer, 0, buffer.Length, 0);
|
||||
destination.CopyFrom(buffer, 0, buffer.Length, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -33,7 +33,7 @@ namespace ComputeSharp
|
||||
public static void CopyTo<T>(this UploadBuffer<T> buffer, StructuredBuffer<T> destination, int destinationOffset, int bufferOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
destination.SetData(buffer, bufferOffset, count, destinationOffset);
|
||||
destination.CopyFrom(buffer, bufferOffset, count, destinationOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ namespace ComputeSharp.Tests
|
||||
Assert.AreEqual(buffer.Length, 128);
|
||||
Assert.AreSame(buffer.GraphicsDevice, Gpu.Default);
|
||||
|
||||
float[] result = buffer.GetData();
|
||||
float[] result = buffer.ToArray();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(data.Length, result.Length);
|
||||
@@ -78,7 +78,7 @@ namespace ComputeSharp.Tests
|
||||
Assert.AreEqual(destination.Length, 128);
|
||||
Assert.AreSame(destination.GraphicsDevice, Gpu.Default);
|
||||
|
||||
float[] result = destination.GetData();
|
||||
float[] result = destination.ToArray();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(data.Length, result.Length);
|
||||
@@ -96,7 +96,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
buffer.Dispose();
|
||||
|
||||
_ = buffer.GetData();
|
||||
_ = buffer.ToArray();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -109,13 +109,13 @@ namespace ComputeSharp.Tests
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 0, 4096)]
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 128, 512)]
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 2048, 2048)]
|
||||
public void GetData_RangeToArray_Ok(Type bufferType, int offset, int count)
|
||||
public void CopyTo_RangeToArray_Ok(Type bufferType, int offset, int count)
|
||||
{
|
||||
float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray();
|
||||
|
||||
using Buffer<float> buffer = Gpu.Default.AllocateBuffer(bufferType, array);
|
||||
|
||||
float[] result = buffer.GetData(offset, count);
|
||||
float[] result = buffer.ToArray(offset, count);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(result.Length, count);
|
||||
@@ -136,13 +136,13 @@ namespace ComputeSharp.Tests
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 512, 4096)]
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 512, -128)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void GetData_RangeToArray_Fail(Type bufferType, int offset, int count)
|
||||
public void CopyTo_RangeToArray_Fail(Type bufferType, int offset, int count)
|
||||
{
|
||||
float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray();
|
||||
|
||||
using Buffer<float> buffer = Gpu.Default.AllocateBuffer(bufferType, array);
|
||||
|
||||
_ = buffer.GetData(offset, count);
|
||||
_ = buffer.ToArray(offset, count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -158,7 +158,7 @@ namespace ComputeSharp.Tests
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 512, 0, 2048)]
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 0, 512, 2048)]
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 127, 1024, 587)]
|
||||
public void GetData_RangeToVoid_Ok(Type bufferType, int destinationOffset, int bufferOffset, int count)
|
||||
public void CopyTo_RangeToVoid_Ok(Type bufferType, int destinationOffset, int bufferOffset, int count)
|
||||
{
|
||||
float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray();
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] result = new float[4096];
|
||||
|
||||
buffer.GetData(result, destinationOffset, bufferOffset, count);
|
||||
buffer.CopyTo(result, destinationOffset, bufferOffset, count);
|
||||
|
||||
Assert.IsTrue(array.AsSpan(bufferOffset, count).SequenceEqual(result.AsSpan(destinationOffset, count)));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ namespace ComputeSharp.Tests
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 12, 1024, 3600)]
|
||||
[DataRow(typeof(ReadWriteBuffer<>), 12, 1024, -2096)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void GetData_RangeToVoid_Fail(Type bufferType, int destinationOffset, int bufferOffset, int count)
|
||||
public void CopyTo_RangeToVoid_Fail(Type bufferType, int destinationOffset, int bufferOffset, int count)
|
||||
{
|
||||
float[] array = Enumerable.Range(0, 4096).Select(static i => (float)i).ToArray();
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] result = new float[4096];
|
||||
|
||||
buffer.GetData(result, destinationOffset, bufferOffset, count);
|
||||
buffer.CopyTo(result, destinationOffset, bufferOffset, count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -212,7 +212,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(source.Length, new ConstantBufferKernel(source, destination));
|
||||
|
||||
int[] result = destination.GetData();
|
||||
int[] result = destination.ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(source.Length, new ReadOnlyBufferKernel(source, destination));
|
||||
|
||||
int[] result = destination.GetData();
|
||||
int[] result = destination.ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(source.Length, new ReadWriteBufferKernel(source, destination));
|
||||
|
||||
int[] result = destination.GetData();
|
||||
int[] result = destination.ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(buffer.Width, buffer.Height, buffer.Depth, new ThreadIdsShader(buffer));
|
||||
|
||||
Int4[,,] data = buffer.GetData();
|
||||
Int4[,,] data = buffer.ToArray();
|
||||
|
||||
for (int z = 0; z < 50; z++)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(buffer.Width, buffer.Height, buffer.Depth, 4, 4, 4, new GroupIdsShader(buffer));
|
||||
|
||||
Int4[,,] data = buffer.GetData();
|
||||
Int4[,,] data = buffer.ToArray();
|
||||
|
||||
for (int z = 0; z < 50; z++)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(1, 1, 1, 4, 15, 7, new GroupSizeShader(buffer));
|
||||
|
||||
int[] data = buffer.GetData();
|
||||
int[] data = buffer.ToArray();
|
||||
|
||||
Assert.AreEqual(4, data[0]);
|
||||
Assert.AreEqual(15, data[1]);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
device.For(128, new SampleShader(buffer));
|
||||
|
||||
int[] data = buffer.GetData();
|
||||
int[] data = buffer.ToArray();
|
||||
|
||||
Assert.IsTrue(data.SequenceEqual(Enumerable.Range(0, 128)));
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
device.For(128, new SampleShader(buffer));
|
||||
|
||||
int[] data = buffer.GetData();
|
||||
int[] data = buffer.ToArray();
|
||||
|
||||
Assert.IsTrue(data.SequenceEqual(Enumerable.Range(0, 128)));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace ComputeSharp.Tests
|
||||
Assert.AreEqual(texture.Height, 128);
|
||||
Assert.AreSame(texture.GraphicsDevice, Gpu.Default);
|
||||
|
||||
float[,] result = texture.GetData();
|
||||
float[,] result = texture.ToArray();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(data.Length, result.Length);
|
||||
@@ -70,7 +70,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
texture.Dispose();
|
||||
|
||||
_ = texture.GetData();
|
||||
_ = texture.ToArray();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -100,7 +100,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] result = new float[width * height];
|
||||
|
||||
texture.GetData(result, x, y, width, height);
|
||||
texture.CopyTo(result, x, y, width, height);
|
||||
|
||||
Span2D<float>
|
||||
expected = new Span2D<float>(array, 64, 64).Slice(y, x, height, width),
|
||||
@@ -135,7 +135,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] result = new float[4096];
|
||||
|
||||
texture.GetData(result, x, y, width, height);
|
||||
texture.CopyTo(result, x, y, width, height);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -148,7 +148,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(source.Width, source.Height, new ReadOnlyTexture2DKernel(source, destination));
|
||||
|
||||
int[] result = destination.GetData();
|
||||
int[] result = destination.ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
int[] result = new int[data.Length];
|
||||
|
||||
destination.GetData(result);
|
||||
destination.CopyTo(result);
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace ComputeSharp.Tests
|
||||
Assert.AreEqual(texture.Depth, depth);
|
||||
Assert.AreSame(texture.GraphicsDevice, Gpu.Default);
|
||||
|
||||
float[,,] result = texture.GetData();
|
||||
float[,,] result = texture.ToArray();
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
Assert.AreEqual(result.GetLength(0), depth);
|
||||
@@ -79,7 +79,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] flat = new float[result.Length];
|
||||
|
||||
texture.GetData(flat);
|
||||
texture.CopyTo(flat);
|
||||
|
||||
CollectionAssert.AreEqual(flat, data);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
texture.Dispose();
|
||||
|
||||
_ = texture.GetData();
|
||||
_ = texture.ToArray();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -129,7 +129,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
int[,,] result = new int[depth, height, width];
|
||||
|
||||
texture.GetData(result.AsSpan(), x, y, z, width, height, depth);
|
||||
texture.CopyTo(result.AsSpan(), x, y, z, width, height, depth);
|
||||
|
||||
for (int k = 0; k < depth; k++)
|
||||
{
|
||||
@@ -169,7 +169,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] result = new float[array.Length];
|
||||
|
||||
texture.GetData(result, x, y, z, width, height, depth);
|
||||
texture.CopyTo(result, x, y, z, width, height, depth);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -182,7 +182,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Gpu.Default.For(source.Width, source.Height, source.Depth, new ReadOnlyTexture3DKernel(source, destination));
|
||||
|
||||
int[] result = destination.GetData();
|
||||
int[] result = destination.ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
@@ -211,7 +211,7 @@ namespace ComputeSharp.Tests
|
||||
|
||||
int[] result = new int[data.Length];
|
||||
|
||||
destination.GetData(result);
|
||||
destination.CopyTo(result);
|
||||
|
||||
CollectionAssert.AreEqual(data, result);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする