From 495bd89f408f5613b4d770ee423f86c61679bc37 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 8 Oct 2023 23:04:43 +0200 Subject: [PATCH] Add obsolete annotations to APIs removed in 3.0 --- .../Attributes/AutoConstructorAttribute.cs | 6 ++++++ .../Attributes/ShaderMethodAttribute.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs index 20737a4c..c71aeaa2 100644 --- a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs +++ b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; namespace ComputeSharp; @@ -6,6 +7,11 @@ namespace ComputeSharp; /// An attribute that indicates that a target shader type should get an automatic constructor for all fields. /// [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] +[EditorBrowsable(EditorBrowsableState.Never)] +[Obsolete( + "This API (and its accompanying source generator) is being removed in a future version of ComputeSharp. " + + "If you're relying on this functionality, consider switching to primary constructors, once they are supported. " + + "Otherwise, consider using alternative source generators providing similar functionality available on NuGet.")] public sealed class AutoConstructorAttribute : Attribute { } \ No newline at end of file diff --git a/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs b/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs index fc3b6415..84a5afbd 100644 --- a/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs +++ b/src/ComputeSharp.Dynamic/Attributes/ShaderMethodAttribute.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; namespace ComputeSharp; @@ -10,6 +11,11 @@ namespace ComputeSharp; /// Methods also need to be static, though this can only be tested at runtime. /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] +[EditorBrowsable(EditorBrowsableState.Never)] +[Obsolete( + "This API (and shader metaprogramming in general) is being removed in a future version of ComputeSharp. " + + "If you're relying on this functionality, consider manually implementing different shader variants. " + + "It is possible to still reuse code by moving it to helper methods that are used by multiple shaders.")] public sealed class ShaderMethodAttribute : Attribute { } \ No newline at end of file