Added extensions for texture transfer types

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-04 16:03:50 +01:00
1 親 631f20b31a
コミット 914dd052b7
7ファイル変更
+140 -10

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

+2 -4
ファイルの表示
@@ -214,14 +214,13 @@ namespace ComputeSharp.Resources
/// Reads the contents of the specified range from the current <see cref="Texture3D{T}"/> instance and writes them into a <see cref="ReadBackTexture3D{T}"/> instance.
/// </summary>
/// <param name="destination">The target <see cref="ReadBackTexture3D{T}"/> instance to write data to.</param>
/// <param name="size">The size of the memory area to write data to.</param>
/// <param name="x">The horizontal offset in the source texture.</param>
/// <param name="y">The vertical offset in the source texture.</param>
/// <param name="z">The depthwise 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>
/// <param name="depth">The depth of the memory area to copy.</param>
internal void CopyTo(ReadBackTexture3D<T> destination, int size, int x, int y, int z, int width, int height, int depth)
internal void CopyTo(ReadBackTexture3D<T> destination, int x, int y, int z, int width, int height, int depth)
{
GraphicsDevice.ThrowIfDisposed();
@@ -355,14 +354,13 @@ 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="size">The size of the memory area 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 offseet 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(ReadBackTexture3D<T> source, int size, int x, int y, int z, int width, int height, int depth)
internal void CopyFrom(UploadTexture3D<T> source, int x, int y, int z, int width, int height, int depth)
{
GraphicsDevice.ThrowIfDisposed();
+1 -3
ファイルの表示
@@ -1,5 +1,4 @@
using System.Diagnostics.Contracts;
using ComputeSharp.Resources;
using ComputeSharp.Resources;
namespace ComputeSharp
{
@@ -14,7 +13,6 @@ namespace ComputeSharp
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
/// <param name="buffer">The input <see cref="StructuredBuffer{T}"/> instance to read data from.</param>
/// <param name="destination">The target <see cref="ReadBackBuffer{T}"/> instance to write data to.</param>
[Pure]
public static void CopyTo<T>(this StructuredBuffer<T> buffer, ReadBackBuffer<T> destination)
where T : unmanaged
{
+28
ファイルの表示
@@ -176,6 +176,34 @@ namespace ComputeSharp
texture.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, width, height);
}
/// <summary>
/// Reads the contents of a <see cref="Texture2D{T}"/> instance and writes them into a target <see cref="ReadBackTexture2D{T}"/> instance.
/// </summary>
/// <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 target <see cref="ReadBackTexture2D{T}"/> instance to write data to.</param>
public static void CopyTo<T>(this Texture2D<T> texture, ReadBackTexture2D<T> destination)
where T : unmanaged
{
texture.CopyTo(destination, 0, 0, texture.Width, texture.Height);
}
/// <summary>
/// Reads the contents of a <see cref="Texture2D{T}"/> instance and writes them into a target <see cref="ReadBackTexture2D{T}"/> instance.
/// </summary>
/// <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 target <see cref="ReadBackTexture2D{T}"/> instance to write data to.</param>
/// <param name="x">The horizontal offset in the source texture.</param>
/// <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 CopyTo<T>(this Texture2D<T> texture, ReadBackTexture2D<T> destination, int x, int y, int width, int height)
where T : unmanaged
{
texture.CopyTo(destination, x, y, width, height);
}
/// <summary>
/// Writes the contents of a given <typeparamref name="T"/> array to the current <see cref="Texture2D{T}"/> instance.
/// </summary>
+30
ファイルの表示
@@ -150,6 +150,36 @@ namespace ComputeSharp
texture.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, x, y, z, width, height, depth);
}
/// <summary>
/// Reads the contents of a <see cref="Texture3D{T}"/> instance and writes them into a target <see cref="ReadBackTexture3D{T}"/> instance.
/// </summary>
/// <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 target <see cref="ReadBackTexture3D{T}"/> instance to write data to.</param>
public static void CopyTo<T>(this Texture3D<T> texture, ReadBackTexture3D<T> destination)
where T : unmanaged
{
texture.CopyTo(destination, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
}
/// <summary>
/// Reads the contents of a <see cref="Texture3D{T}"/> instance and writes them into a target <see cref="ReadBackTexture3D{T}"/> instance.
/// </summary>
/// <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 target <see cref="ReadBackTexture3D{T}"/> instance to write data to.</param>
/// <param name="x">The horizontal offset in the source texture.</param>
/// <param name="y">The vertical offset in the source texture.</param>
/// <param name="z">The depthwise 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>
/// <param name="depth">The depth of the memory area to copy.</param>
public static void CopyTo<T>(this Texture3D<T> texture, ReadBackTexture3D<T> destination, int x, int y, int z, int width, int height, int depth)
where T : unmanaged
{
texture.CopyTo(destination, x, y, z, width, height, depth);
}
/// <summary>
/// Writes the contents of a given <typeparamref name="T"/> array to the current <see cref="Texture3D{T}"/> instance.
/// </summary>
+1 -3
ファイルの表示
@@ -1,5 +1,4 @@
using System.Diagnostics.Contracts;
using ComputeSharp.Resources;
using ComputeSharp.Resources;
namespace ComputeSharp
{
@@ -14,7 +13,6 @@ namespace ComputeSharp
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
/// <param name="buffer">The input <see cref="UploadBuffer{T}"/> instance to read data from.</param>
/// <param name="destination">The target <see cref="StructuredBuffer{T}"/> instance to write data to.</param>
[Pure]
public static void CopyTo<T>(this UploadBuffer<T> buffer, StructuredBuffer<T> destination)
where T : unmanaged
{
+38
ファイルの表示
@@ -0,0 +1,38 @@
using ComputeSharp.Resources;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> that contains extension methods for the <see cref="UploadTexture2D{T}"/> type.
/// </summary>
public static class UploadTexture2DExtensions
{
/// <summary>
/// Reads the contents of a <see cref="UploadTexture2D{T}"/> instance and writes them into a target <see cref="Texture2D{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
/// <param name="texture">The input <see cref="UploadTexture2D{T}"/> instance to read data from.</param>
/// <param name="destination">The target <see cref="Texture2D{T}"/> instance to write data to.</param>
public static void CopyTo<T>(this UploadTexture2D<T> texture, Texture2D<T> destination)
where T : unmanaged
{
destination.CopyFrom(texture, 0, 0, texture.Width, texture.Height);
}
/// <summary>
/// Reads the contents of a <see cref="UploadTexture2D{T}"/> instance and writes them into a target <see cref="Texture2D{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
/// <param name="texture">The input <see cref="UploadTexture2D{T}"/> instance to read data from.</param>
/// <param name="destination">The target <see cref="Texture2D{T}"/> instance to write data to.</param>
/// <param name="x">The horizontal offset in the source texture.</param>
/// <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 CopyTo<T>(this UploadTexture2D<T> texture, Texture2D<T> destination, int x, int y, int width, int height)
where T : unmanaged
{
destination.CopyFrom(texture, x, y, width, height);
}
}
}
+40
ファイルの表示
@@ -0,0 +1,40 @@
using ComputeSharp.Resources;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> that contains extension methods for the <see cref="UploadTexture3D{T}"/> type.
/// </summary>
public static class UploadTexture3DExtensions
{
/// <summary>
/// Reads the contents of a <see cref="UploadTexture3D{T}"/> instance and writes them into a target <see cref="Texture3D{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
/// <param name="texture">The input <see cref="UploadTexture3D{T}"/> instance to read data from.</param>
/// <param name="destination">The target <see cref="Texture3D{T}"/> instance to write data to.</param>
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);
}
/// <summary>
/// Reads the contents of a <see cref="UploadTexture3D{T}"/> instance and writes them into a target <see cref="Texture3D{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
/// <param name="texture">The input <see cref="UploadTexture3D{T}"/> instance to read data from.</param>
/// <param name="destination">The target <see cref="Texture3D{T}"/> instance to write data to.</param>
/// <param name="x">The horizontal offset in the source texture.</param>
/// <param name="y">The vertical offset in the source texture.</param>
/// <param name="z">The depthwise 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>
/// <param name="depth">The depth of the memory area to copy.</param>
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);
}
}
}