diff --git a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs
index 440b160e..db24237f 100644
--- a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs
+++ b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs
@@ -205,6 +205,24 @@ public static class Texture2DExtensions
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, 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 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 destination texture.
+ /// The vertical offset in the destination texture.
+ /// The width of the memory area to copy.
+ /// The height of the memory area to copy.
+ public static void CopyTo(this Texture2D source, ReadBackTexture2D destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
+ where T : unmanaged
+ {
+ source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
+ }
+
///
/// Writes the contents of a given array to the current instance.
///
@@ -340,6 +358,52 @@ public static class Texture2DExtensions
destination.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, destinationOffsetX, destinationOffsetY, width, height);
}
+ ///
+ /// Reads the contents of an instance and writes them into a target instance.
+ ///
+ /// The type of items stored on the texture.
+ /// The target instance to write data to.
+ /// The input instance to read data from.
+ public static void CopyFrom(this Texture2D destination, UploadTexture2D source)
+ where T : unmanaged
+ {
+ destination.CopyFrom(source, 0, 0, 0, 0, source.Width, source.Height);
+ }
+
+ ///
+ /// Reads the contents of an instance and writes them into a target instance.
+ ///
+ /// The type of items stored on the texture.
+ /// The target instance to write data to.
+ /// The input instance to read data from.
+ /// 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 CopyFrom(this Texture2D destination, UploadTexture2D source, int sourceOffsetX, int sourceOffsetY, int width, int height)
+ where T : unmanaged
+ {
+ destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
+ }
+
+ ///
+ /// Reads the contents of an instance and writes them into a target instance.
+ ///
+ /// The type of items stored on the texture.
+ /// The target instance to write data to.
+ /// The input instance to read data from.
+ /// The horizontal offset in the source texture.
+ /// The vertical offset in the source texture.
+ /// The horizontal offset in the destination texture.
+ /// The vertical offset in the destination texture.
+ /// The width of the memory area to copy.
+ /// The height of the memory area to copy.
+ public static void CopyFrom(this Texture2D destination, UploadTexture2D source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
+ where T : unmanaged
+ {
+ destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
+ }
+
///
/// Saves a texture to a specified file.
///