diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
index 878c9c54..1709d243 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
@@ -68,6 +68,7 @@
+
diff --git a/src/ComputeSharp.D2D1/Attributes/D2DPixelOptions.cs b/src/ComputeSharp.D2D1/Attributes/D2DPixelOptions.cs
new file mode 100644
index 00000000..d4b9ad29
--- /dev/null
+++ b/src/ComputeSharp.D2D1/Attributes/D2DPixelOptions.cs
@@ -0,0 +1,28 @@
+using System;
+
+namespace ComputeSharp.D2D1;
+
+///
+/// An attribute for a D2D1 shader indicating the pixel options to use.
+/// Using this attribute is optional when defining a D2D1 shader.
+///
+///
+/// For more info, see .
+///
+[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
+public sealed class D2DPixelOptionsAttribute : Attribute
+{
+ ///
+ /// Creates a new instance of the type with the specified arguments.
+ ///
+ /// The options to specify for the shader.
+ public D2DPixelOptionsAttribute(D2D1PixelOption options)
+ {
+ Options = options;
+ }
+
+ ///
+ /// Gets the options to specify for the shader.
+ ///
+ public D2D1PixelOption Options { get; }
+}
diff --git a/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOption.cs b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOption.cs
new file mode 100644
index 00000000..d0b52dcb
--- /dev/null
+++ b/src/ComputeSharp.D2D1/Attributes/Enums/D2D1PixelOption.cs
@@ -0,0 +1,22 @@
+namespace ComputeSharp.D2D1;
+
+///
+/// Indicates how the sampling of a D2D1 pixel shader will be restricted. This indicates whether the vertex buffer
+/// is large and tends to change infrequently or smaller and changes frequently (typically frame over frame).
+///
+///
+/// This type exposes the available values in .
+///
+public enum D2D1PixelOption
+{
+ ///
+ /// The pixel shader is not restricted in its sampling.
+ ///
+ None,
+
+ ///
+ /// The pixel shader samples inputs only at the same scene coordinate as the output pixel
+ /// and returns transparent black whenever the input pixels are also transparent black.
+ ///
+ TrivialSampling
+}
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
index 11cd5ae3..0c4fe02c 100644
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
+++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
@@ -19,6 +19,14 @@ public interface ID2D1Shader
[Obsolete("This method is not intended to be called directly by user code")]
void InitializeFromDispatchData(ReadOnlySpan data);
+ ///
+ /// Gets the pixel options for the current shader.
+ ///
+ /// The pixel options for the current shader.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("This method is not intended to be used directly by user code")]
+ uint GetPixelOptions();
+
///
/// Gets the number of inputs for the current shader.
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
index b0ec5b48..49ab6d7b 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
@@ -80,6 +80,19 @@ public static class D2D1PixelShader
return new ReadOnlySpan(bytecodePtr, bytecodeSize).ToArray();
}
+ ///
+ /// Gets the pixel options from an input D2D1 pixel shader.
+ ///
+ /// The type of D2D1 pixel shader to get the pixel options for.
+ /// The pixel options for the D2D1 pixel shader of type .
+ public static D2D1PixelOption GetPixelOptions()
+ where T : unmanaged, ID2D1PixelShader
+ {
+ Unsafe.SkipInit(out T shader);
+
+ return (D2D1PixelOption)shader.GetPixelOptions();
+ }
+
///
/// Gets the number of inputs from an input D2D1 pixel shader.
///