diff --git a/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs new file mode 100644 index 00000000..e50902d4 --- /dev/null +++ b/src/ComputeSharp.Core/Attributes/AutoConstructorAttribute.cs @@ -0,0 +1,12 @@ +using System; + +namespace ComputeSharp +{ + /// + /// A shader that indicates that a target shader type should get an automatic constructor for all fields. + /// + [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] + public sealed class AutoConstructorAttribute : Attribute + { + } +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs b/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs index 972a7e15..667d9df7 100644 --- a/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs +++ b/src/ComputeSharp.SourceGenerators/AutoConstructorAttributeGenerator.cs @@ -21,25 +21,6 @@ namespace ComputeSharp.SourceGenerators /// public void Execute(GeneratorExecutionContext context) { - const string attributeText = @" - using System; - - namespace ComputeSharp - { - /// - /// A shader that indicates that a target shader type should get an automatic constructor for all fields. - /// - [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)] - public sealed class AutoConstructorAttribute : Attribute - { - } - }"; - - var attributeSource = SourceText.From(ParseCompilationUnit(attributeText).NormalizeWhitespace().ToFullString(), Encoding.UTF8); - - // Add the [AutoConstructor] attribute - context.AddSource("__ComputeSharp_AutoConstructorAttribute", attributeSource); - // Find all the [AutoConstructor] usages ImmutableArray attributes = ( from tree in context.Compilation.SyntaxTrees