Moar bug fixes and API tweaks

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-06 16:06:45 +01:00
1 親 5f6efb0811
コミット 1eeb059622
4ファイル変更
+29 -20

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

+1 -1
ファイルの表示
@@ -361,7 +361,7 @@ namespace ComputeSharp.Resources
source.ThrowIfDisposed();
Guard.IsInRange(sourceX, 0, source.Width, nameof(sourceX));
Guard.IsInRange(sourceY, 0, source.Width, nameof(sourceY));
Guard.IsInRange(sourceY, 0, source.Height, nameof(sourceY));
Guard.IsInRange(destinationX, 0, Width, nameof(destinationX));
Guard.IsInRange(destinationY, 0, Height, nameof(destinationY));
Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width));
+25 -16
ファイルの表示
@@ -377,13 +377,16 @@ namespace ComputeSharp.Resources
/// Writes the contents of a given <see cref="UploadTexture3D{T}"/> instance to a specified area of the current <see cref="Texture3D{T}"/> instance.
/// </summary>
/// <param name="source">The input <see cref="UploadTexture3D{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="z">The depthwise 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="sourceZ">The depthwise 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="destinationZ">The depthwise 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>
/// <param name="depth">The depth of the memory area to write to.</param>
internal void CopyFrom(UploadTexture3D<T> source, int x, int y, int z, int width, int height, int depth)
internal void CopyFrom(UploadTexture3D<T> source, int sourceX, int sourceY, int sourceZ, int destinationX, int destinationY, int destinationZ, int width, int height, int depth)
{
GraphicsDevice.ThrowIfDisposed();
@@ -392,18 +395,24 @@ namespace ComputeSharp.Resources
source.ThrowIfDeviceMismatch(GraphicsDevice);
source.ThrowIfDisposed();
Guard.IsInRange(x, 0, Width, nameof(x));
Guard.IsInRange(y, 0, Height, nameof(y));
Guard.IsInRange(z, 0, Depth, nameof(z));
Guard.IsInRange(sourceX, 0, source.Width, nameof(sourceX));
Guard.IsInRange(sourceY, 0, source.Height, nameof(sourceY));
Guard.IsInRange(sourceZ, 0, source.Depth, nameof(sourceZ));
Guard.IsInRange(destinationX, 0, Width, nameof(destinationX));
Guard.IsInRange(destinationY, 0, Height, nameof(destinationY));
Guard.IsInRange(destinationZ, 0, Depth, nameof(destinationZ));
Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height));
Guard.IsBetweenOrEqualTo(depth, 1, Depth, nameof(depth));
Guard.IsBetweenOrEqualTo(width, 1, source.Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, source.Height, nameof(height));
Guard.IsBetweenOrEqualTo(depth, 1, source.Depth, nameof(depth));
Guard.IsLessThanOrEqualTo(x + width, Width, nameof(x));
Guard.IsLessThanOrEqualTo(y + height, Height, nameof(y));
Guard.IsLessThanOrEqualTo(z + depth, Depth, nameof(z));
Guard.IsLessThanOrEqualTo(sourceX + width, source.Width, nameof(sourceX));
Guard.IsLessThanOrEqualTo(sourceY + height, source.Height, nameof(sourceY));
Guard.IsLessThanOrEqualTo(sourceZ + depth, source.Depth, nameof(sourceZ));
Guard.IsLessThanOrEqualTo(destinationX + width, Width, nameof(destinationX));
Guard.IsLessThanOrEqualTo(destinationY + height, Height, nameof(destinationY));
Guard.IsLessThanOrEqualTo(destinationZ + depth, Depth, nameof(destinationZ));
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
@@ -416,14 +425,14 @@ namespace ComputeSharp.Resources
{
copyCommandList.D3D12GraphicsCommandList->CopyTextureRegion(
d3D12ResourceDestination: D3D12Resource,
destinationX: (uint)x,
destinationY: (uint)y,
destinationZ: (ushort)z,
(uint)destinationX,
(uint)destinationY,
(ushort)destinationZ,
d3D12ResourceSource: source.D3D12Resource,
d3D12PlacedSubresourceFootprintSource,
sourceX: 0,
sourceY: 0,
sourceZ: 0,
(uint)sourceX,
(uint)sourceY,
(ushort)sourceZ,
(uint)width,
(uint)height,
(ushort)depth);
+1 -1
ファイルの表示
@@ -69,7 +69,7 @@ namespace ComputeSharp.Resources
out _,
out ulong totalSizeInBytes);
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(resourceType, allocationMode, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
this.d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(resourceType, allocationMode, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;
}
+2 -2
ファイルの表示
@@ -16,7 +16,7 @@ namespace ComputeSharp
public static void CopyTo<T>(this UploadTexture3D<T> texture, Texture3D<T> destination)
where T : unmanaged
{
destination.CopyFrom(texture, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
destination.CopyFrom(texture, 0, 0, 0, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
}
/// <summary>
@@ -34,7 +34,7 @@ namespace ComputeSharp
public static void CopyTo<T>(this UploadTexture3D<T> texture, Texture3D<T> destination, int x, int y, int z, int width, int height, int depth)
where T : unmanaged
{
destination.CopyFrom(texture, x, y, z, width, height, depth);
destination.CopyFrom(texture, x, y, z, 0, 0, 0, width, height, depth);
}
}
}