More bug fixes, added TransferTexture2D<T> tests

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-06 14:28:37 +01:00
1 親 53012a5667
コミット 5f6efb0811
5ファイル変更
+184 -15

検索条件に一致するファイルはありません

+17 -11
ファイルの表示
@@ -345,11 +345,13 @@ namespace ComputeSharp.Resources
/// Writes the contents of a given <see cref="UploadTexture2D{T}"/> instance to a specified area of the current <see cref="Texture2D{T}"/> instance.
/// </summary>
/// <param name="source">The input <see cref="UploadTexture2D{T}"/> instance to read data from.</param>
/// <param name="x">The horizontal offset in the destination texture.</param>
/// <param name="y">The vertical offset in the destination texture.</param>
/// <param name="sourceX">The horizontal offset within <paramref name="source"/>.</param>
/// <param name="sourceY">The vertical offset within <paramref name="source"/>.</param>
/// <param name="destinationX">The horizontal offset in the destination texture.</param>
/// <param name="destinationY">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 CopyFrom(UploadTexture2D<T> source, int x, int y, int width, int height)
internal void CopyFrom(UploadTexture2D<T> source, int sourceX, int sourceY, int destinationX, int destinationY, int width, int height)
{
GraphicsDevice.ThrowIfDisposed();
@@ -358,14 +360,18 @@ namespace ComputeSharp.Resources
source.ThrowIfDeviceMismatch(GraphicsDevice);
source.ThrowIfDisposed();
Guard.IsInRange(x, 0, Width, nameof(x));
Guard.IsInRange(y, 0, Height, nameof(y));
Guard.IsInRange(sourceX, 0, source.Width, nameof(sourceX));
Guard.IsInRange(sourceY, 0, source.Width, nameof(sourceY));
Guard.IsInRange(destinationX, 0, Width, nameof(destinationX));
Guard.IsInRange(destinationY, 0, Height, nameof(destinationY));
Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height));
Guard.IsBetweenOrEqualTo(width, 1, source.Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, source.Height, nameof(height));
Guard.IsLessThanOrEqualTo(x + width, Width, nameof(x));
Guard.IsLessThanOrEqualTo(y + height, Height, nameof(y));
Guard.IsLessThanOrEqualTo(sourceX + width, source.Width, nameof(sourceX));
Guard.IsLessThanOrEqualTo(sourceY + height, source.Height, nameof(sourceY));
Guard.IsLessThanOrEqualTo(destinationX + width, Width, nameof(destinationX));
Guard.IsLessThanOrEqualTo(destinationY + height, Height, nameof(destinationY));
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
@@ -378,13 +384,13 @@ namespace ComputeSharp.Resources
{
copyCommandList.D3D12GraphicsCommandList->CopyTextureRegion(
d3D12ResourceDestination: D3D12Resource,
destinationX: (uint)x,
destinationY: (uint)y,
(uint)destinationX,
(uint)destinationY,
destinationZ: 0,
d3D12ResourceSource: source.D3D12Resource,
d3D12PlacedSubresourceFootprintSource,
sourceX: 0,
sourceY: 0,
(uint)sourceX,
(uint)sourceY,
sourceZ: 0,
(uint)width,
(uint)height,
+1 -1
ファイルの表示
@@ -102,7 +102,7 @@ namespace ComputeSharp.Resources
{
ThrowIfDisposed();
return new(this.mappedData, Height, Width, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
return new(this.mappedData, Width, Height, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
}
+1 -1
ファイルの表示
@@ -110,7 +110,7 @@ namespace ComputeSharp.Resources
{
ThrowIfDisposed();
return new(this.mappedData, Height, Width, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
return new(this.mappedData, Width, Height, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
}