diff --git a/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs
index 07fd076e..637905ab 100644
--- a/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs
+++ b/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs
@@ -3,7 +3,7 @@
namespace ComputeSharp.D2D1;
///
-/// An attribute for a field in a D2D1 shader indicating the index of the D2D1 resource.
+/// An attribute for resource fields in a D2D1 shader indicating the index of the D2D1 resource.
/// This is needed to bind an input resource in a shader to the correct input. Using this attribute is mandatory.
///
///
@@ -15,14 +15,14 @@ public sealed class D2DResourceIndexAttribute : Attribute
///
/// Creates a new instance of the type with the specified arguments.
///
- /// The index of the annotated field.
+ /// The index of the annotated resource field.
public D2DResourceIndexAttribute(int index)
{
Index = index;
}
///
- /// Gets the index of the annotated field.
+ /// Gets the index of the annotated resource field.
///
public int Index { get; }
}
diff --git a/src/ComputeSharp.D2D1/Resources/D2D1TextureResource1D.cs b/src/ComputeSharp.D2D1/Resources/D2D1TextureResource1D.cs
new file mode 100644
index 00000000..4483436b
--- /dev/null
+++ b/src/ComputeSharp.D2D1/Resources/D2D1TextureResource1D.cs
@@ -0,0 +1,31 @@
+using ComputeSharp.Exceptions;
+
+namespace ComputeSharp.D2D1;
+
+///
+/// A representing a readonly 1D texture stored on GPU memory.
+/// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them.
+///
+[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)]
+public readonly struct D2D1TextureResource1D
+{
+ ///
+ /// Gets the width of the current texture.
+ ///
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource1D)}.{nameof(Width)}");
+
+ ///
+ /// Gets a single value from the current readonly texture.
+ ///
+ /// The horizontal offset of the value to get.
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public ref readonly Float4 this[int x] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(int)}]");
+
+ ///
+ /// Gets a single value from the current readonly texture with linear sampling.
+ ///
+ /// The horizontal normalized offset of the value to get.
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public ref readonly Float4 this[float u] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(float)}]");
+}
diff --git a/src/ComputeSharp.D2D1/Resources/D2D1TextureResource.cs b/src/ComputeSharp.D2D1/Resources/D2D1TextureResource2D.cs
similarity index 85%
rename from src/ComputeSharp.D2D1/Resources/D2D1TextureResource.cs
rename to src/ComputeSharp.D2D1/Resources/D2D1TextureResource2D.cs
index 3cb5264e..4c7289f8 100644
--- a/src/ComputeSharp.D2D1/Resources/D2D1TextureResource.cs
+++ b/src/ComputeSharp.D2D1/Resources/D2D1TextureResource2D.cs
@@ -7,19 +7,19 @@ namespace ComputeSharp.D2D1;
/// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them.
///
[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)]
-public readonly struct D2D1TextureResource
+public readonly struct D2D1TextureResource2D
{
///
/// Gets the width of the current texture.
///
/// This API can only be used from a compute shader, and will always throw if used anywhere else.
- public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}.{nameof(Width)}");
+ public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}.{nameof(Width)}");
///
/// Gets the height of the current texture.
///
/// This API can only be used from a compute shader, and will always throw if used anywhere else.
- public int Height => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}.{nameof(Height)}");
+ public int Height => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}.{nameof(Height)}");
///
/// Gets a single value from the current readonly texture.
@@ -27,14 +27,14 @@ public readonly struct D2D1TextureResource
/// The horizontal offset of the value to get.
/// The vertical offset of the value to get.
/// This API can only be used from a compute shader, and will always throw if used anywhere else.
- public ref readonly Float4 this[int x, int y] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(int)}, {typeof(int)}]");
+ public ref readonly Float4 this[int x, int y] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(int)}, {typeof(int)}]");
///
/// Gets a single value from the current readonly texture.
///
/// The coordinates of the value to get.
/// This API can only be used from a compute shader, and will always throw if used anywhere else.
- public ref readonly Float4 this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(Int2)}]");
+ public ref readonly Float4 this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(Int2)}]");
///
/// Gets a single value from the current readonly texture with linear sampling.
@@ -42,12 +42,12 @@ public readonly struct D2D1TextureResource
/// The horizontal normalized offset of the value to get.
/// The vertical normalized offset of the value to get.
/// This API can only be used from a compute shader, and will always throw if used anywhere else.
- public ref readonly Float4 this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(float)}, {typeof(float)}]");
+ public ref readonly Float4 this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(float)}, {typeof(float)}]");
///
/// Gets a single value from the current readonly texture with linear sampling.
///
/// The normalized coordinates of the value to get.
/// This API can only be used from a compute shader, and will always throw if used anywhere else.
- public ref readonly Float4 this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(Float2)}]");
+ public ref readonly Float4 this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(Float2)}]");
}
diff --git a/src/ComputeSharp.D2D1/Resources/D2D1TextureResource3D.cs b/src/ComputeSharp.D2D1/Resources/D2D1TextureResource3D.cs
new file mode 100644
index 00000000..788df66a
--- /dev/null
+++ b/src/ComputeSharp.D2D1/Resources/D2D1TextureResource3D.cs
@@ -0,0 +1,61 @@
+using ComputeSharp.Exceptions;
+
+namespace ComputeSharp.D2D1;
+
+///
+/// A representing a readonly 3D texture stored on GPU memory.
+/// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them.
+///
+[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)]
+public readonly struct D2D1TextureResource3D
+{
+ ///
+ /// Gets the width of the current texture.
+ ///
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}.{nameof(Width)}");
+
+ ///
+ /// Gets the height of the current texture.
+ ///
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public int Height => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}.{nameof(Height)}");
+
+ ///
+ /// Gets the depth of the current texture.
+ ///
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public int Depth => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}.{nameof(Depth)}");
+
+ ///
+ /// Gets a single value from the current readonly texture.
+ ///
+ /// The horizontal offset of the value to get.
+ /// The vertical offset of the value to get.
+ /// The depthwise offset of the value to get.
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public ref readonly Float4 this[int x, int y, int z] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(int)}, {typeof(int)}, {typeof(int)}]");
+
+ ///
+ /// Gets a single value from the current readonly texture.
+ ///
+ /// The coordinates of the value to get.
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public ref readonly Float4 this[Int3 xyz] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(Int3)}]");
+
+ ///
+ /// Gets a single value from the current readonly texture with linear sampling.
+ ///
+ /// The horizontal normalized offset of the value to get.
+ /// The vertical normalized offset of the value to get.
+ /// The depthwise offset of the value to get.
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public ref readonly Float4 this[float u, float v, float w] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(float)}, {typeof(float)}, {typeof(float)}]");
+
+ ///
+ /// Gets a single value from the current readonly texture with linear sampling.
+ ///
+ /// The normalized coordinates of the value to get.
+ /// This API can only be used from a compute shader, and will always throw if used anywhere else.
+ public ref readonly Float4 this[Float3 uvw] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(Float3)}]");
+}