diff --git a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs
index 330a81d2..440b160e 100644
--- a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs
+++ b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs
@@ -16,15 +16,15 @@ public static class Texture2DExtensions
/// Reads the contents of the current instance and returns an array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// A array with the contents of the current texture.
[Pure]
- public static T[,] ToArray(this Texture2D texture)
+ public static T[,] ToArray(this Texture2D source)
where T : unmanaged
{
- T[,] data = new T[texture.Height, texture.Width];
+ T[,] data = new T[source.Height, source.Width];
- texture.CopyTo(data);
+ source.CopyTo(data);
return data;
}
@@ -33,102 +33,102 @@ public static class Texture2DExtensions
/// Reads the contents of the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
- public static void CopyTo(this Texture2D texture, T[,] destination)
+ public static void CopyTo(this Texture2D source, T[,] destination)
where T : unmanaged
{
- Guard.IsEqualTo(destination.GetLength(0), texture.Height, nameof(destination));
- Guard.IsEqualTo(destination.GetLength(1), texture.Width, nameof(destination));
+ Guard.IsEqualTo(destination.GetLength(0), source.Height, nameof(destination));
+ Guard.IsEqualTo(destination.GetLength(1), source.Width, nameof(destination));
- texture.CopyTo(ref destination[0, 0], destination.Length, 0, 0, texture.Width, texture.Height);
+ source.CopyTo(ref destination[0, 0], destination.Length, 0, 0, source.Width, source.Height);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
- public static void CopyTo(this Texture2D texture, T[] destination)
+ public static void CopyTo(this Texture2D source, T[] destination)
where T : unmanaged
{
- texture.CopyTo(destination.AsSpan(), 0, 0, texture.Width, texture.Height);
+ source.CopyTo(destination.AsSpan(), 0, 0, source.Width, source.Height);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
/// The horizontal range of items to copy.
/// The vertical range of items to copy.
- public static void CopyTo(this Texture2D texture, T[] destination, Range x, Range y)
+ public static void CopyTo(this Texture2D source, T[] destination, Range x, Range y)
where T : unmanaged
{
- texture.CopyTo(destination.AsSpan(), x, y);
+ source.CopyTo(destination.AsSpan(), x, y);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- public static void CopyTo(this Texture2D texture, T[] destination, int x, int y, int width, int height)
+ public static void CopyTo(this Texture2D source, T[] destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyTo(destination.AsSpan(), x, y, width, height);
+ source.CopyTo(destination.AsSpan(), sourceOffsetX, sourceOffsetY, width, height);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
- /// The starting offset within to write data to.
- public static void CopyTo(this Texture2D texture, T[] destination, int offset)
+ /// The starting offset within to write data to.
+ public static void CopyTo(this Texture2D source, T[] destination, int destinationOffset)
where T : unmanaged
{
- texture.CopyTo(destination.AsSpan(offset), 0, 0, texture.Width, texture.Height);
+ source.CopyTo(destination.AsSpan(destinationOffset), 0, 0, source.Width, source.Height);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
- /// The starting offset within to write data to.
+ /// The starting offset within to write data to.
/// The horizontal range of items to copy.
/// The vertical range of items to copy.
- public static void CopyTo(this Texture2D texture, T[] destination, int offset, Range x, Range y)
+ public static void CopyTo(this Texture2D source, T[] destination, int destinationOffset, Range x, Range y)
where T : unmanaged
{
- texture.CopyTo(destination.AsSpan(offset), x, y);
+ source.CopyTo(destination.AsSpan(destinationOffset), x, y);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target array.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input array to write data to.
- /// The starting offset within to write data to.
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The starting offset within to write data to.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- public static void CopyTo(this Texture2D texture, T[] destination, int offset, int x, int y, int width, int height)
+ public static void CopyTo(this Texture2D source, T[] destination, int destinationOffset, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyTo(destination.AsSpan(offset), x, y, width, height);
+ source.CopyTo(destination.AsSpan(destinationOffset), sourceOffsetX, sourceOffsetY, width, height);
}
///
@@ -136,162 +136,162 @@ public static class Texture2DExtensions
/// The input data will be read from the start of the texture.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input to write data to.
- public static void CopyTo(this Texture2D texture, Span destination)
+ public static void CopyTo(this Texture2D source, Span destination)
where T : unmanaged
{
- texture.CopyTo(destination, 0, 0, texture.Width, texture.Height);
+ source.CopyTo(destination, 0, 0, source.Width, source.Height);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target .
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input to write data to.
/// The horizontal range of items to copy.
/// The vertical range of items to copy.
- public static void CopyTo(this Texture2D texture, Span destination, Range x, Range y)
+ public static void CopyTo(this Texture2D source, Span destination, Range x, Range y)
where T : unmanaged
{
- var (offsetX, width) = x.GetOffsetAndLength(texture.Width);
- var (offsetY, height) = y.GetOffsetAndLength(texture.Height);
+ var (offsetX, width) = x.GetOffsetAndLength(source.Width);
+ var (offsetY, height) = y.GetOffsetAndLength(source.Height);
- texture.CopyTo(destination, offsetX, offsetY, width, height);
+ source.CopyTo(destination, offsetX, offsetY, width, height);
}
///
/// Reads the contents of the specified range from the current instance and writes them into a target .
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The input to write data to.
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- public static void CopyTo(this Texture2D texture, Span destination, int x, int y, int width, int height)
+ public static void CopyTo(this Texture2D source, Span destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, width, height);
+ source.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, sourceOffsetX, sourceOffsetY, width, height);
}
///
/// Reads the contents of a instance and writes them into a target instance.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The target instance to write data to.
- public static void CopyTo(this Texture2D texture, ReadBackTexture2D destination)
+ public static void CopyTo(this Texture2D source, ReadBackTexture2D destination)
where T : unmanaged
{
- texture.CopyTo(destination, 0, 0, 0, 0, texture.Width, texture.Height);
+ source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height);
}
///
/// Reads the contents of a instance and writes them into a target instance.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The target instance to write data to.
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- public static void CopyTo(this Texture2D texture, ReadBackTexture2D destination, int x, int y, int width, int height)
+ public static void CopyTo(this Texture2D source, ReadBackTexture2D destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyTo(destination, 0, 0, x, y, width, height);
+ source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
///
/// Writes the contents of a given array to the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input array to read data from.
- public static unsafe void CopyFrom(this Texture2D texture, T[,] source)
+ public static unsafe void CopyFrom(this Texture2D destination, T[,] source)
where T : unmanaged
{
- Guard.IsEqualTo(source.GetLength(0), texture.Height, nameof(source));
- Guard.IsEqualTo(source.GetLength(1), texture.Width, nameof(source));
+ Guard.IsEqualTo(source.GetLength(0), destination.Height, nameof(source));
+ Guard.IsEqualTo(source.GetLength(1), destination.Width, nameof(source));
- texture.CopyFrom(ref source[0, 0], source.Length, 0, 0, texture.Width, texture.Height);
+ destination.CopyFrom(ref source[0, 0], source.Length, 0, 0, destination.Width, destination.Height);
}
///
/// Writes the contents of a given array to the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input array to read data from.
- public static void CopyFrom(this Texture2D texture, T[] source)
+ public static void CopyFrom(this Texture2D destination, T[] source)
where T : unmanaged
{
- texture.CopyFrom(source.AsSpan(), 0, 0, texture.Width, texture.Height);
+ destination.CopyFrom(source.AsSpan(), 0, 0, destination.Width, destination.Height);
}
///
/// Writes the contents of a given array to a specified area of the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input array to read data from.
/// The horizontal range of items to write.
/// The vertical range of items to write.
- public static void CopyFrom(this Texture2D texture, T[] source, Range x, Range y)
+ public static void CopyFrom(this Texture2D destination, T[] source, Range x, Range y)
where T : unmanaged
{
- texture.CopyFrom(source.AsSpan(), x, y);
+ destination.CopyFrom(source.AsSpan(), x, y);
}
///
/// Writes the contents of a given array to a specified area of the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input array to read data from.
- /// The horizontal offset in the destination texture.
- /// The vertical offset in the destination texture.
+ /// The horizontal offset in the destination texture.
+ /// The vertical offset in the destination texture.
/// The width of the memory area to write to.
/// The height of the memory area to write to.
- public static void CopyFrom(this Texture2D texture, T[] source, int x, int y, int width, int height)
+ public static void CopyFrom(this Texture2D destination, T[] source, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyFrom(source.AsSpan(), x, y, width, height);
+ destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, width, height);
}
///
/// Writes the contents of a given array to a specified area of the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input array to read data from.
- /// The starting offset within to read data from.
+ /// The starting offset within to read data from.
/// The horizontal range of items to write.
/// The vertical range of items to write.
- public static void CopyFrom(this Texture2D texture, T[] source, int offset, Range x, Range y)
+ public static void CopyFrom(this Texture2D destination, T[] source, int sourceOffset, Range x, Range y)
where T : unmanaged
{
- texture.CopyFrom(source.AsSpan(offset), x, y);
+ destination.CopyFrom(source.AsSpan(sourceOffset), x, y);
}
///
/// Writes the contents of a given array to a specified area of the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input array to read data from.
- /// The starting offset within to read data from.
- /// The horizontal offset in the destination texture.
- /// The vertical offset in the destination texture.
+ /// The starting offset within to read data from.
+ /// The horizontal offset in the destination texture.
+ /// The vertical offset in the destination texture.
/// The width of the memory area to write to.
/// The height of the memory area to write to.
- public static void CopyFrom(this Texture2D texture, T[] source, int offset, int x, int y, int width, int height)
+ public static void CopyFrom(this Texture2D destination, T[] source, int sourceOffset, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyFrom(source.AsSpan(offset), x, y, width, height);
+ destination.CopyFrom(source.AsSpan(sourceOffset), destinationOffsetX, destinationOffsetY, width, height);
}
///
@@ -299,45 +299,45 @@ public static class Texture2DExtensions
/// The input data will be written to the start of the texture, and all input items will be copied.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input to read data from.
- public static void CopyFrom(this Texture2D texture, ReadOnlySpan source)
+ public static void CopyFrom(this Texture2D destination, ReadOnlySpan source)
where T : unmanaged
{
- texture.CopyFrom(source, 0, 0, texture.Width, texture.Height);
+ destination.CopyFrom(source, 0, 0, destination.Width, destination.Height);
}
///
/// Writes the contents of a given to a specified area of the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input to read data from.
/// The horizontal range of items to write.
/// The vertical range of items to write.
- public static void CopyFrom(this Texture2D texture, ReadOnlySpan source, Range x, Range y)
+ public static void CopyFrom(this Texture2D destination, ReadOnlySpan source, Range x, Range y)
where T : unmanaged
{
- var (offsetX, width) = x.GetOffsetAndLength(texture.Width);
- var (offsetY, height) = y.GetOffsetAndLength(texture.Height);
+ var (offsetX, width) = x.GetOffsetAndLength(destination.Width);
+ var (offsetY, height) = y.GetOffsetAndLength(destination.Height);
- texture.CopyFrom(source, offsetX, offsetY, width, height);
+ destination.CopyFrom(source, offsetX, offsetY, width, height);
}
///
/// Writes the contents of a given to a specified area of the current instance.
///
/// The type of items stored on the texture.
- /// The target instance to write data to.
+ /// The target instance to write data to.
/// The input to read data from.
- /// The horizontal offset in the destination texture.
- /// The vertical offset in the destination texture.
+ /// The horizontal offset in the destination texture.
+ /// The vertical offset in the destination texture.
/// The width of the memory area to write to.
/// The height of the memory area to write to.
- public static void CopyFrom(this Texture2D texture, ReadOnlySpan source, int x, int y, int width, int height)
+ public static void CopyFrom(this Texture2D destination, ReadOnlySpan source, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
- texture.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, x, y, width, height);
+ destination.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, destinationOffsetX, destinationOffsetY, width, height);
}
///
diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs
index ffb6b4d6..96599509 100644
--- a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs
+++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs
@@ -11,27 +11,27 @@ public static class UploadTexture2DExtensions
/// Reads the contents of a instance and writes them into a target instance.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The target instance to write data to.
- public static void CopyTo(this UploadTexture2D texture, Texture2D destination)
+ public static void CopyTo(this UploadTexture2D source, Texture2D destination)
where T : unmanaged
{
- destination.CopyFrom(texture, 0, 0, 0, 0, texture.Width, texture.Height);
+ destination.CopyFrom(source, 0, 0, 0, 0, source.Width, source.Height);
}
///
/// Reads the contents of a instance and writes them into a target instance.
///
/// The type of items stored on the texture.
- /// The input instance to read data from.
+ /// The input instance to read data from.
/// The target instance to write data to.
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- public static void CopyTo(this UploadTexture2D texture, Texture2D destination, int x, int y, int width, int height)
+ public static void CopyTo(this UploadTexture2D source, Texture2D destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
- destination.CopyFrom(texture, x, y, 0, 0, width, height);
+ destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
}
diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs
index f6935282..b83a618c 100644
--- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs
+++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs
@@ -147,22 +147,22 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
///
/// The target memory area to write data to.
/// The size of the target memory area to write data to.
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- internal void CopyTo(ref T destination, int size, int x, int y, int width, int height)
+ internal void CopyTo(ref T destination, int size, int sourceOffsetX, int sourceOffsetY, int width, int height)
{
GraphicsDevice.ThrowIfDisposed();
ThrowIfDisposed();
- Guard.IsInRange(x, 0, Width, nameof(x));
- Guard.IsInRange(y, 0, Height, nameof(y));
+ Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX));
+ Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY));
Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height));
- Guard.IsLessThanOrEqualTo(x + width, Width, nameof(x));
- Guard.IsLessThanOrEqualTo(y + height, Height, nameof(y));
+ Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
+ Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
Guard.IsGreaterThanOrEqualTo(size, (nint)width * height, nameof(size));
GraphicsDevice.D3D12Device->GetCopyableFootprint(
@@ -195,8 +195,8 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
destinationY: 0,
destinationZ: 0,
d3D12ResourceSource: D3D12Resource,
- sourceX: (uint)x,
- sourceY: (uint)y,
+ sourceX: (uint)sourceOffsetX,
+ sourceY: (uint)sourceOffsetY,
sourceZ: 0,
(uint)width,
(uint)height,
@@ -227,13 +227,13 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
/// Reads the contents of the specified range from the current instance and writes them into a target instance.
///
/// The target instance to write data to.
- /// The horizontal offset within .
- /// The vertical offset within .
- /// The horizontal offset in the source texture.
- /// The vertical offset in the source texture.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
+ /// The horizontal offset within .
+ /// The vertical offset within .
/// The width of the memory area to copy.
/// The height of the memory area to copy.
- internal void CopyTo(ReadBackTexture2D destination, int destinationX, int destinationY, int sourceX, int sourceY, int width, int height)
+ internal void CopyTo(ReadBackTexture2D destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
{
GraphicsDevice.ThrowIfDisposed();
@@ -242,18 +242,18 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
destination.ThrowIfDeviceMismatch(GraphicsDevice);
destination.ThrowIfDisposed();
- Guard.IsInRange(destinationX, 0, destination.Width, nameof(destinationX));
- Guard.IsInRange(destinationY, 0, destination.Height, nameof(destinationY));
- Guard.IsInRange(sourceX, 0, Width, nameof(sourceX));
- Guard.IsInRange(sourceY, 0, Height, nameof(sourceY));
+ Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX));
+ Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY));
+ Guard.IsInRange(destinationOffsetX, 0, destination.Width, nameof(destinationOffsetX));
+ Guard.IsInRange(destinationOffsetY, 0, destination.Height, nameof(destinationOffsetY));
Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height));
Guard.IsBetweenOrEqualTo(width, 1, destination.Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, destination.Height, nameof(height));
- Guard.IsBetweenOrEqualTo(destinationX + width, 1, destination.Width, nameof(destinationX));
- Guard.IsBetweenOrEqualTo(destinationY + height, 1, destination.Height, nameof(destinationY));
- Guard.IsLessThanOrEqualTo(sourceX + width, Width, nameof(sourceX));
- Guard.IsLessThanOrEqualTo(sourceY + height, Height, nameof(sourceY));
+ Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX));
+ Guard.IsBetweenOrEqualTo(destinationOffsetY + height, 1, destination.Height, nameof(destinationOffsetY));
+ Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
+ Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
@@ -267,12 +267,12 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
copyCommandList.D3D12GraphicsCommandList->CopyTextureRegion(
d3D12ResourceDestination: destination.D3D12Resource,
d3D12PlacedSubresourceFootprintDestination,
- (uint)destinationX,
- (uint)destinationY,
+ (uint)destinationOffsetX,
+ (uint)destinationOffsetY,
destinationZ: 0,
d3D12ResourceSource: D3D12Resource,
- (uint)sourceX,
- (uint)sourceY,
+ (uint)sourceOffsetX,
+ (uint)sourceOffsetY,
sourceZ: 0,
(uint)width,
(uint)height,
@@ -292,22 +292,22 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
///
/// The input memory area to read data from.
/// The size of the memory area to read data from.
- /// The horizontal offset in the destination texture.
- /// The vertical offset in the destination texture.
+ /// The horizontal offset in the destination texture.
+ /// The vertical offset in the destination texture.
/// The width of the memory area to write to.
/// The height of the memory area to write to.
- internal void CopyFrom(ref T source, int size, int x, int y, int width, int height)
+ internal void CopyFrom(ref T source, int size, int destinationOffsetX, int destinationOffsetY, int width, int height)
{
GraphicsDevice.ThrowIfDisposed();
ThrowIfDisposed();
- Guard.IsInRange(x, 0, Width, nameof(x));
- Guard.IsInRange(y, 0, Height, nameof(y));
+ Guard.IsInRange(destinationOffsetX, 0, Width, nameof(destinationOffsetX));
+ Guard.IsInRange(destinationOffsetY, 0, Height, nameof(destinationOffsetY));
Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height));
- Guard.IsLessThanOrEqualTo(x + width, Width, nameof(x));
- Guard.IsLessThanOrEqualTo(y + height, Height, nameof(y));
+ Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX));
+ Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY));
Guard.IsGreaterThanOrEqualTo(size, (nint)width * height, nameof(size));
GraphicsDevice.D3D12Device->GetCopyableFootprint(
@@ -346,8 +346,8 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
copyCommandList.D3D12GraphicsCommandList->CopyTextureRegion(
d3D12ResourceDestination: D3D12Resource,
- destinationX: (uint)x,
- destinationY: (uint)y,
+ destinationX: (uint)destinationOffsetX,
+ destinationY: (uint)destinationOffsetY,
destinationZ: 0,
d3D12ResourceSource: d3D12Resource.Get(),
&d3D12PlacedSubresourceFootprintSource,
@@ -370,13 +370,13 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
/// Writes the contents of a given instance to a specified area of the current instance.
///
/// The input instance to read data from.
- /// The horizontal offset within .
- /// The vertical offset within .
- /// The horizontal offset in the destination texture.
- /// The vertical offset in the destination texture.
+ /// The horizontal offset within .
+ /// The vertical offset within .
+ /// The horizontal offset in the destination texture.
+ /// The vertical offset in the destination texture.
/// The width of the memory area to write to.
/// The height of the memory area to write to.
- internal void CopyFrom(UploadTexture2D source, int sourceX, int sourceY, int destinationX, int destinationY, int width, int height)
+ internal void CopyFrom(UploadTexture2D source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
{
GraphicsDevice.ThrowIfDisposed();
@@ -385,18 +385,18 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
source.ThrowIfDeviceMismatch(GraphicsDevice);
source.ThrowIfDisposed();
- Guard.IsInRange(sourceX, 0, source.Width, nameof(sourceX));
- Guard.IsInRange(sourceY, 0, source.Height, nameof(sourceY));
- Guard.IsInRange(destinationX, 0, Width, nameof(destinationX));
- Guard.IsInRange(destinationY, 0, Height, nameof(destinationY));
+ Guard.IsInRange(sourceOffsetX, 0, source.Width, nameof(sourceOffsetX));
+ Guard.IsInRange(sourceOffsetY, 0, source.Height, nameof(sourceOffsetY));
+ Guard.IsInRange(destinationOffsetX, 0, Width, nameof(destinationOffsetX));
+ Guard.IsInRange(destinationOffsetY, 0, Height, nameof(destinationOffsetY));
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(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));
+ Guard.IsLessThanOrEqualTo(sourceOffsetX + width, source.Width, nameof(sourceOffsetX));
+ Guard.IsLessThanOrEqualTo(sourceOffsetY + height, source.Height, nameof(sourceOffsetY));
+ Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX));
+ Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY));
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
@@ -409,13 +409,13 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper
{
copyCommandList.D3D12GraphicsCommandList->CopyTextureRegion(
d3D12ResourceDestination: D3D12Resource,
- (uint)destinationX,
- (uint)destinationY,
+ (uint)destinationOffsetX,
+ (uint)destinationOffsetY,
destinationZ: 0,
d3D12ResourceSource: source.D3D12Resource,
d3D12PlacedSubresourceFootprintSource,
- (uint)sourceX,
- (uint)sourceY,
+ (uint)sourceOffsetX,
+ (uint)sourceOffsetY,
sourceZ: 0,
(uint)width,
(uint)height,