From eb5a1d4acff19aee949a8a9c2dab5ee4b5fcf439 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 16 Dec 2023 02:14:58 +0100 Subject: [PATCH] Add D2DEnableRuntimeCompilationAttribute type --- .../Attributes/D2DEnableRuntimeCompilation.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/ComputeSharp.D2D1/Attributes/D2DEnableRuntimeCompilation.cs diff --git a/src/ComputeSharp.D2D1/Attributes/D2DEnableRuntimeCompilation.cs b/src/ComputeSharp.D2D1/Attributes/D2DEnableRuntimeCompilation.cs new file mode 100644 index 00000000..503bf6fe --- /dev/null +++ b/src/ComputeSharp.D2D1/Attributes/D2DEnableRuntimeCompilation.cs @@ -0,0 +1,27 @@ +using System; + +namespace ComputeSharp.D2D1; + +/// +/// An attribute that indicates that runtime compilation of D2D shaders is enabled. +/// This attribute is required for all shaders that are not compiled at build time. +/// +/// +/// +/// Precompiling shaders at build time is recommended, as it enables additional validation +/// and diagnostics, and provides better performance at runtime when dispatching the shaders. +/// +/// +/// This option can be used in advanced scenarios, for instance when trying to minimize +/// binary size (which should only be done after carefully measuring the actual difference). +/// +/// +/// Note that not using this attribute does not mean that trying to compile shaders at runtime will +/// fail. The purpose of this attribute is to allow declaring shader types that are not precompiled. +/// All other features, such as manually compiling a shader type with specific compile options or +/// with a different shader profile, or manually compiling a shader from source at runtime, are +/// always supported, regardless of whether nor not this attribute is used. +/// +/// +[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = false)] +public sealed class D2DEnableRuntimeCompilationAttribute : Attribute; \ No newline at end of file