diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.cs
index 57592daf..6ea3e81d 100644
--- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.cs
+++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.cs
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics.Contracts;
using ComputeSharp.__Internals;
+using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Resources;
using ComputeSharp.Shaders;
@@ -239,7 +240,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The allocation mode to use for the new resource.
- /// A zeroed instance of size [, ].
+ /// A zeroed instance of size [, ].
[Pure]
public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm
@@ -257,7 +258,7 @@ namespace ComputeSharp
/// The input array with the data to copy on the allocated texture.
/// The width of the texture.
/// The height of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int width, int height)
where T : unmanaged, IUnorm
@@ -276,7 +277,7 @@ namespace ComputeSharp
/// The starting offset within to read data from.
/// The width of the texture.
/// The height of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height)
where T : unmanaged, IUnorm
@@ -292,7 +293,7 @@ namespace ComputeSharp
/// The type of pixels used on the GPU side.
/// The instance to use to allocate the texture.
/// The input array with the data to copy on the allocated texture.
- /// A read write instance with the contents of the input array.
+ /// A read write instance with the contents of the input array.
[Pure]
public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] source)
where T : unmanaged, IUnorm
@@ -314,7 +315,7 @@ namespace ComputeSharp
/// The input with the data to copy on the allocated texture.
/// The width of the texture.
/// The height of the texture.
- /// A instance with the contents of the input .
+ /// A instance with the contents of the input .
[Pure]
public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height)
where T : unmanaged, IUnorm
@@ -327,6 +328,22 @@ namespace ComputeSharp
return texture;
}
+ ///
+ /// Allocates a new readonly 2D texture with the contents of the specified file.
+ ///
+ /// The type of items to store in the texture.
+ /// The type of pixels used on the GPU side.
+ /// The instance to use to allocate the texture.
+ /// The filename of the image file to load and decode into the texture.
+ /// A instance with the contents of the specified file.
+ [Pure]
+ public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan filename)
+ where T : unmanaged, IUnorm
+ where TPixel : unmanaged
+ {
+ return WICHelper.Instance.LoadTexture(device, filename);
+ }
+
///
/// Allocates a new readonly 3D texture with the specified parameters.
///
@@ -432,7 +449,7 @@ namespace ComputeSharp
/// The height of the texture.
/// The depth of the texture.
/// The allocation mode to use for the new resource.
- /// A zeroed instance of size [, , ].
+ /// A zeroed instance of size [, , ].
[Pure]
public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm
@@ -451,7 +468,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The depth of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth)
where T : unmanaged, IUnorm
@@ -471,7 +488,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The depth of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth)
where T : unmanaged, IUnorm
@@ -487,7 +504,7 @@ namespace ComputeSharp
/// The type of pixels used on the GPU side.
/// The instance to use to allocate the texture.
/// The input array with the data to copy on the allocated texture.
- /// A read write instance with the contents of the input array.
+ /// A read write instance with the contents of the input array.
///
/// The source 3D array needs to have each 2D plane stacked on the depth axis.
/// That is, the expected layout of the input array has to be [depth, height, width].
@@ -514,7 +531,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The depth of the texture.
- /// A instance with the contents of the input .
+ /// A instance with the contents of the input .
[Pure]
public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth)
where T : unmanaged, IUnorm
@@ -688,7 +705,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The allocation mode to use for the new resource.
- /// A zeroed instance of size [, ].
+ /// A zeroed instance of size [, ].
[Pure]
public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm
@@ -706,7 +723,7 @@ namespace ComputeSharp
/// The input array with the data to copy on the allocated texture.
/// The width of the texture.
/// The height of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int width, int height)
where T : unmanaged, IUnorm
@@ -725,7 +742,7 @@ namespace ComputeSharp
/// The starting offset within to read data from.
/// The width of the texture.
/// The height of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height)
where T : unmanaged, IUnorm
@@ -741,7 +758,7 @@ namespace ComputeSharp
/// The type of pixels used on the GPU side.
/// The instance to use to allocate the texture.
/// The input array with the data to copy on the allocated texture.
- /// A read write instance with the contents of the input array.
+ /// A read write instance with the contents of the input array.
[Pure]
public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] source)
where T : unmanaged, IUnorm
@@ -763,7 +780,7 @@ namespace ComputeSharp
/// The input with the data to copy on the allocated texture.
/// The width of the texture.
/// The height of the texture.
- /// A instance with the contents of the input .
+ /// A instance with the contents of the input .
[Pure]
public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height)
where T : unmanaged, IUnorm
@@ -881,7 +898,7 @@ namespace ComputeSharp
/// The height of the texture.
/// The depth of the texture.
/// The allocation mode to use for the new resource.
- /// A instance of size [, , ].
+ /// A instance of size [, , ].
[Pure]
public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm
@@ -900,7 +917,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The depth of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth)
where T : unmanaged, IUnorm
@@ -920,7 +937,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The depth of the texture.
- /// A instance with the contents of the input array.
+ /// A instance with the contents of the input array.
[Pure]
public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth)
where T : unmanaged, IUnorm
@@ -936,7 +953,7 @@ namespace ComputeSharp
/// The type of pixels used on the GPU side.
/// The instance to use to allocate the texture.
/// The input array with the data to copy on the allocated texture.
- /// A read write instance with the contents of the input array.
+ /// A read write instance with the contents of the input array.
///
/// The source 3D array needs to have each 2D plane stacked on the depth axis.
/// That is, the expected layout of the input array has to be [depth, height, width].
@@ -963,7 +980,7 @@ namespace ComputeSharp
/// The width of the texture.
/// The height of the texture.
/// The depth of the texture.
- /// A instance with the contents of the input .
+ /// A instance with the contents of the input .
[Pure]
public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth)
where T : unmanaged, IUnorm
diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs
index 42b5c06b..984ba086 100644
--- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs
+++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs
@@ -22,7 +22,7 @@ namespace ComputeSharp
where TPixel : unmanaged
{
///
- /// Creates a new instance with the specified parameters.
+ /// Creates a new instance with the specified parameters.
///
/// The associated with the current instance.
/// The width of the texture.
diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs
index 2871cfd0..f29774ce 100644
--- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs
+++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs
@@ -22,7 +22,7 @@ namespace ComputeSharp
where TPixel : unmanaged
{
///
- /// Creates a new instance with the specified parameters.
+ /// Creates a new instance with the specified parameters.
///
/// The associated with the current instance.
/// The width of the texture.
diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs
index 84acb879..caa6def5 100644
--- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs
+++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs
@@ -22,7 +22,7 @@ namespace ComputeSharp
where TPixel : unmanaged
{
///
- /// Creates a new instance with the specified parameters.
+ /// Creates a new instance with the specified parameters.
///
/// The associated with the current instance.
/// The width of the texture.
diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs
index cb452315..19d2fe45 100644
--- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs
+++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs
@@ -22,7 +22,7 @@ namespace ComputeSharp
where TPixel : unmanaged
{
///
- /// Creates a new instance with the specified parameters.
+ /// Creates a new instance with the specified parameters.
///
/// The associated with the current instance.
/// The width of the texture.