Renamed some API parameters
このコミットが含まれているのは:
1 親
a18a6d249d
コミット
be91da6d05
3ファイル変更
+47
-47
検索条件に一致するファイルはありません
@@ -124,64 +124,64 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
/// <summary>
|
||||
/// Reads the contents of the current <see cref="Buffer{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="span">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
public void GetData(Span<T> span) => GetData(span, 0, Length);
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
public void GetData(Span<T> destination) => GetData(destination, 0, Length);
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Buffer{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="span">The input <see cref="Span{T}"/> to write data to.</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>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public abstract void GetData(Span<T> span, int offset, int count);
|
||||
public abstract void GetData(Span<T> destination, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to the current <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="array">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public void SetData(T[] array) => SetData(array.AsSpan());
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public void SetData(T[] source) => SetData(source.AsSpan());
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="array">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
/// <param name="offset">The offset to start writing data to.</param>
|
||||
/// <param name="count">The number of items to write.</param>
|
||||
public void SetData(T[] array, int offset, int count) => SetData(array.AsSpan(), offset, count);
|
||||
public void SetData(T[] source, int offset, int count) => SetData(source.AsSpan(), offset, count);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to the current <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="span">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
public void SetData(ReadOnlySpan<T> span) => SetData(span, 0, Length);
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
public void SetData(ReadOnlySpan<T> source) => SetData(source, 0, Length);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="span">The input <see cref="ReadOnlySpan{T}"/> to read data from.</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>
|
||||
/// <param name="count">The number of items to write.</param>
|
||||
public abstract void SetData(ReadOnlySpan<T> span, int offset, int count);
|
||||
public abstract void SetData(ReadOnlySpan<T> source, int offset, int count);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="Buffer{T}"/> to the current <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> to read data from.</param>
|
||||
public abstract void SetData(Buffer<T> buffer);
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> to read data from.</param>
|
||||
public abstract void SetData(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="buffer">The input <see cref="Buffer{T}"/> to read data from.</param>
|
||||
protected void SetDataWithCpuBuffer(Buffer<T> buffer)
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> to read data from.</param>
|
||||
protected void SetDataWithCpuBuffer(Buffer<T> source)
|
||||
{
|
||||
T[] array = ArrayPool<T>.Shared.Rent(buffer.Length);
|
||||
T[] array = ArrayPool<T>.Shared.Rent(source.Length);
|
||||
|
||||
try
|
||||
{
|
||||
Span<T> span = array.AsSpan(0, buffer.Length);
|
||||
Span<T> span = array.AsSpan(0, source.Length);
|
||||
|
||||
buffer.GetData(span);
|
||||
source.GetData(span);
|
||||
|
||||
SetData(span);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void GetData(Span<T> span, int offset, int count)
|
||||
public override unsafe void GetData(Span<T> destination, int offset, int count)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
Guard.IsInRange(offset, 0, Length, nameof(offset));
|
||||
Guard.IsInRange(count, 0, Length, nameof(count));
|
||||
Guard.IsLessThanOrEqualTo((uint)offset + count, (uint)Length, nameof(count));
|
||||
Guard.IsInRangeFor(count, span, nameof(count));
|
||||
Guard.IsInRangeFor(count, destination, nameof(count));
|
||||
|
||||
nint
|
||||
byteOffset = (nint)offset * ElementSizeInBytes,
|
||||
@@ -55,11 +55,11 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
|
||||
using ID3D12ResourceMap resource = d3D12Resource.Get()->Map();
|
||||
|
||||
MemoryHelper.Copy(resource.Pointer, 0, span, count);
|
||||
MemoryHelper.Copy(resource.Pointer, 0, destination, count);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void SetData(ReadOnlySpan<T> span, int offset, int count)
|
||||
public override unsafe void SetData(ReadOnlySpan<T> source, int offset, int count)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
Guard.IsInRange(offset, 0, Length, nameof(offset));
|
||||
Guard.IsInRange(count, 0, Length, nameof(count));
|
||||
Guard.IsLessThanOrEqualTo((uint)offset + count, (uint)Length, nameof(count));
|
||||
Guard.IsInRangeFor(count, span, nameof(count));
|
||||
Guard.IsInRangeFor(count, source, nameof(count));
|
||||
|
||||
nint
|
||||
byteOffset = (nint)offset * ElementSizeInBytes,
|
||||
@@ -78,7 +78,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
{
|
||||
MemoryHelper.Copy(span, resource.Pointer, 0, count);
|
||||
MemoryHelper.Copy(source, resource.Pointer, 0, count);
|
||||
}
|
||||
|
||||
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
@@ -88,24 +88,24 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void SetData(Buffer<T> buffer)
|
||||
public override unsafe void SetData(Buffer<T> source)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
buffer.GraphicsDevice.ThrowIfDisposed();
|
||||
source.GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
ThrowIfDisposed();
|
||||
buffer.ThrowIfDisposed();
|
||||
source.ThrowIfDisposed();
|
||||
|
||||
if (!buffer.IsPaddingPresent &&
|
||||
buffer.GraphicsDevice == GraphicsDevice)
|
||||
if (!source.IsPaddingPresent &&
|
||||
source.GraphicsDevice == GraphicsDevice)
|
||||
{
|
||||
// Directly copy the input buffer
|
||||
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
|
||||
copyCommandList.CopyBufferRegion(buffer.D3D12Resource, 0, D3D12Resource, 0, (ulong)SizeInBytes);
|
||||
copyCommandList.CopyBufferRegion(source.D3D12Resource, 0, D3D12Resource, 0, (ulong)SizeInBytes);
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
else SetDataWithCpuBuffer(buffer);
|
||||
else SetDataWithCpuBuffer(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace ComputeSharp
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void GetData(Span<T> span, int offset, int count)
|
||||
public override unsafe void GetData(Span<T> destination, int offset, int count)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -63,13 +63,13 @@ namespace ComputeSharp
|
||||
Guard.IsInRange(offset, 0, Length, nameof(offset));
|
||||
Guard.IsInRange(count, 0, Length, nameof(count));
|
||||
Guard.IsLessThanOrEqualTo((uint)offset + count, (uint)Length, nameof(count));
|
||||
Guard.IsInRangeFor(count, span, nameof(count));
|
||||
Guard.IsInRangeFor(count, destination, nameof(count));
|
||||
|
||||
using ID3D12ResourceMap resource = D3D12Resource->Map();
|
||||
|
||||
if (IsPaddingPresent)
|
||||
{
|
||||
ref T spanRef = ref MemoryMarshal.GetReference(span);
|
||||
ref T spanRef = ref MemoryMarshal.GetReference(destination);
|
||||
ref byte resourceRef = ref Unsafe.AsRef<byte>(resource.Pointer);
|
||||
|
||||
// Move to the initial ref
|
||||
@@ -82,11 +82,11 @@ namespace ComputeSharp
|
||||
Unsafe.Add(ref spanRef, i) = Unsafe.As<byte, T>(ref targetRef);
|
||||
}
|
||||
}
|
||||
else MemoryHelper.Copy(resource.Pointer, offset, span, count);
|
||||
else MemoryHelper.Copy(resource.Pointer, offset, destination, count);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void SetData(ReadOnlySpan<T> span, int offset, int count)
|
||||
public override unsafe void SetData(ReadOnlySpan<T> source, int offset, int count)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
@@ -95,13 +95,13 @@ namespace ComputeSharp
|
||||
Guard.IsInRange(offset, 0, Length, nameof(offset));
|
||||
Guard.IsInRange(count, 0, Length, nameof(count));
|
||||
Guard.IsLessThanOrEqualTo((uint)offset + count, (uint)Length, nameof(count));
|
||||
Guard.IsInRangeFor(count, span, nameof(count));
|
||||
Guard.IsInRangeFor(count, source, nameof(count));
|
||||
|
||||
using ID3D12ResourceMap resource = D3D12Resource->Map();
|
||||
|
||||
if (IsPaddingPresent)
|
||||
{
|
||||
ref T spanRef = ref MemoryMarshal.GetReference(span);
|
||||
ref T spanRef = ref MemoryMarshal.GetReference(source);
|
||||
ref byte resourceRef = ref Unsafe.AsRef<byte>(resource.Pointer);
|
||||
|
||||
// Move to the initial offset
|
||||
@@ -114,28 +114,28 @@ namespace ComputeSharp
|
||||
Unsafe.As<byte, T>(ref targetRef) = Unsafe.Add(ref spanRef, i);
|
||||
}
|
||||
}
|
||||
else MemoryHelper.Copy(span, resource.Pointer, offset, count);
|
||||
else MemoryHelper.Copy(source, resource.Pointer, offset, count);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override unsafe void SetData(Buffer<T> buffer)
|
||||
public override unsafe void SetData(Buffer<T> source)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
buffer.GraphicsDevice.ThrowIfDisposed();
|
||||
source.GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
ThrowIfDisposed();
|
||||
buffer.ThrowIfDisposed();
|
||||
source.ThrowIfDisposed();
|
||||
|
||||
if (buffer is ConstantBuffer<T> &&
|
||||
buffer.GraphicsDevice == GraphicsDevice)
|
||||
if (source is ConstantBuffer<T> &&
|
||||
source.GraphicsDevice == GraphicsDevice)
|
||||
{
|
||||
// Directly copy the input buffer, if possible
|
||||
using CommandList copyCommandList = new CommandList(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY);
|
||||
|
||||
copyCommandList.CopyBufferRegion(buffer.D3D12Resource, 0, D3D12Resource, 0, (ulong)SizeInBytes);
|
||||
copyCommandList.CopyBufferRegion(source.D3D12Resource, 0, D3D12Resource, 0, (ulong)SizeInBytes);
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
else SetDataWithCpuBuffer(buffer);
|
||||
else SetDataWithCpuBuffer(source);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする