diff --git a/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs index 9bd4c07f..bf27291f 100644 --- a/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs +++ b/src/ComputeSharp.D2D1/Attributes/D2DCompileOptionsAttribute.cs @@ -24,12 +24,12 @@ namespace ComputeSharp.D2D1; /// This attribute can also be added to a whole assembly, and will be used by default if not overridden by a shader type. /// /// -/// The compiler options to use to compile the shader. +/// The compile options to use to compile the shader. [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Method, AllowMultiple = false)] public sealed class D2DCompileOptionsAttribute(D2D1CompileOptions options) : Attribute { /// - /// Gets the number of threads in each thread group for the X axis + /// Gets the compile options to use to compile the shader. /// public D2D1CompileOptions Options { get; } = options; } \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Attributes/D2DRequiresDoublePrecisionSupportAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DRequiresDoublePrecisionSupportAttribute.cs new file mode 100644 index 00000000..dde64edd --- /dev/null +++ b/src/ComputeSharp.D2D1/Attributes/D2DRequiresDoublePrecisionSupportAttribute.cs @@ -0,0 +1,23 @@ +using System; + +namespace ComputeSharp.D2D1; + +/// +/// An attribute for a D2D1 shader indicating that the shader requires support for double precision operations. +/// +/// +/// +/// This attribute does not map to any HLSL feature or compile option directly, but it is needed to make using double +/// precision operations opt-in. It is easy to accidentally introduce them in a shader when that is not intented, and +/// doing so can make the shader run slower and not being compatible with some GPUs (eg. many arm64 GPUs lack support +/// for double precision operations). To avoid this, support is disabled by default, and it is necessary to add this +/// attribute over a shader type to explicitly allow using these operations. +/// +/// +/// Validation can only be performed when the shader is being precompiled. If that is not the case (ie. if the shader +/// is using and not ), then +/// no build time check for double precision operations can be done. Using this attribute in that scenarios is not valid. +/// +/// +[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] +public sealed class D2DRequiresDoublePrecisionSupportAttribute : Attribute; \ No newline at end of file