From bf9b1231b0f5ded42b8650e7e3dc5d40035a2a66 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 19 Oct 2023 17:13:51 +0200 Subject: [PATCH] Remove [AutoConstructor] attributes --- .../Primitives/ComplexVector4.cs | 7 ++--- .../Attributes/AutoConstructorAttribute.cs | 17 ------------ .../Internals/AutoConstructorBehavior.cs | 12 --------- .../AutoConstructorBehaviorAttribute.cs | 26 ------------------- .../Resources/D2D1ResourceTexture1D{T}.cs | 1 - .../Resources/D2D1ResourceTexture2D{T}.cs | 1 - .../Resources/D2D1ResourceTexture3D{T}.cs | 1 - 7 files changed, 4 insertions(+), 61 deletions(-) delete mode 100644 src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs delete mode 100644 src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs delete mode 100644 src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs diff --git a/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs b/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs index d8dabc18..a2e10c84 100644 --- a/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs +++ b/samples/ComputeSharp.ImageProcessing/Primitives/ComplexVector4.cs @@ -4,8 +4,6 @@ using System.Numerics; using System.Runtime.CompilerServices; -#pragma warning disable IDE0022 - namespace SixLabors.ImageSharp; /// @@ -30,5 +28,8 @@ internal struct ComplexVector4 /// The 'b' parameter, for the imaginary component /// The resulting value [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly Vector4 WeightedSum(float a, float b) => (this.Real * a) + (this.Imaginary * b); + public readonly Vector4 WeightedSum(float a, float b) + { + return (this.Real * a) + (this.Imaginary * b); + } } \ No newline at end of file diff --git a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs deleted file mode 100644 index c71aeaa2..00000000 --- a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.ComponentModel; - -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.Core/Attributes/Internals/AutoConstructorBehavior.cs b/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs deleted file mode 100644 index 465bc2b7..00000000 --- a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehavior.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ComputeSharp; - -/// -/// Indicates the behavior of fields annotated with . -/// -internal enum AutoConstructorBehavior -{ - /// - /// Causes to ignore fields and set their values to . - /// - IgnoreAndSetToDefault -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs b/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs deleted file mode 100644 index 3c1c696a..00000000 --- a/src/ComputeSharp.Core/Attributes/Internals/AutoConstructorBehaviorAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -#pragma warning disable IDE0290 - -namespace ComputeSharp; - -/// -/// An attribute that indicates that a target shader type should get an automatic constructor for all fields. -/// -[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)] -internal sealed class AutoConstructorBehaviorAttribute : Attribute -{ - /// - /// Creates a new instance with the specified parameters. - /// - /// The value for the current instance. - public AutoConstructorBehaviorAttribute(AutoConstructorBehavior behavior) - { - Behavior = behavior; - } - - /// - /// Gets the value for the current instance. - /// - public AutoConstructorBehavior Behavior { get; } -} \ No newline at end of file diff --git a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs index e9fdc34d..7a321e10 100644 --- a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs +++ b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture1D{T}.cs @@ -7,7 +7,6 @@ namespace ComputeSharp.D2D1; /// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them. /// /// The type of items stored on the texture (only and are supported). -[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)] public readonly struct D2D1ResourceTexture1D where T : unmanaged { diff --git a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs index 2df57a16..c2f1c8c4 100644 --- a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs +++ b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture2D{T}.cs @@ -7,7 +7,6 @@ namespace ComputeSharp.D2D1; /// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them. /// /// The type of items stored on the texture (only and are supported). -[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)] public readonly struct D2D1ResourceTexture2D where T : unmanaged { diff --git a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs index b953356d..32cc272c 100644 --- a/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs +++ b/src/ComputeSharp.D2D1/Resources/D2D1ResourceTexture3D{T}.cs @@ -7,7 +7,6 @@ namespace ComputeSharp.D2D1; /// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them. /// /// The type of items stored on the texture (only and are supported). -[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)] public readonly struct D2D1ResourceTexture3D where T : unmanaged {