diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.CreateFromConstantBuffer.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.CreateFromConstantBuffer.Syntax.cs index 33386412..14511432 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.CreateFromConstantBuffer.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.CreateFromConstantBuffer.Syntax.cs @@ -2,6 +2,7 @@ using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGeneration.Mappings; +using ComputeSharp.SourceGeneration.Models; namespace ComputeSharp.D2D1.SourceGenerators; diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.Syntax.cs index a6232d49..42d8754b 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.Syntax.cs @@ -2,6 +2,7 @@ using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGeneration.Mappings; +using ComputeSharp.SourceGeneration.Models; namespace ComputeSharp.D2D1.SourceGenerators; diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.cs index 7f7dd538..7e1e5bc4 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.LoadConstantBuffer.cs @@ -4,7 +4,6 @@ using System.Collections.Immutable; using System.Linq; using System.Runtime.CompilerServices; using ComputeSharp.Core.Helpers; -using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGeneration.Mappings; diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems b/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems index f8c64c28..5c009c45 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems +++ b/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems @@ -21,6 +21,7 @@ + diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Models/FieldInfo.cs similarity index 50% rename from src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs rename to src/ComputeSharp.SourceGeneration.Hlsl/Models/FieldInfo.cs index c49ba8b6..10da8292 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/FieldInfo.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Models/FieldInfo.cs @@ -1,25 +1,27 @@ using ComputeSharp.SourceGeneration.Helpers; -namespace ComputeSharp.D2D1.SourceGenerators.Models; +namespace ComputeSharp.SourceGeneration.Models; /// /// A base type for a model describing a given captured field in a shader. /// -internal abstract record FieldInfo +/// The path of the field with respect to the shader instance. +/// The full metadata name for the primitive type. +internal abstract record FieldInfo(EquatableArray FieldPath, string TypeName) { /// /// A captured primitive value (either a scalar, a vector, or a linear matrix). /// - /// The path of the field with respect to the shader instance. - /// The full metadata name for the primitive type. + /// + /// /// The byte offset of the value within the root signature. - public sealed record Primitive(EquatableArray FieldPath, string TypeName, int Offset) : FieldInfo; + public sealed record Primitive(EquatableArray FieldPath, string TypeName, int Offset) : FieldInfo(FieldPath, TypeName); /// /// A captured non linear matrix value. /// - /// The path of the field with respect to the shader instance. - /// The full metadata name for the matrix type. + /// + /// /// The name of each element in the matrix type. /// The number of rows in the matrix. /// The number of columns in the matrix. @@ -30,5 +32,5 @@ internal abstract record FieldInfo string ElementName, int Rows, int Columns, - EquatableArray Offsets) : FieldInfo; + EquatableArray Offsets) : FieldInfo(FieldPath, TypeName); } \ No newline at end of file diff --git a/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.DispatchDataLoading.Syntax.cs b/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.DispatchDataLoading.Syntax.cs index b6d0e318..7a8669d7 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.DispatchDataLoading.Syntax.cs +++ b/src/ComputeSharp.SourceGenerators/ComputeShaderDescriptorGenerator.DispatchDataLoading.Syntax.cs @@ -1,5 +1,6 @@ using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; +using ComputeSharp.SourceGeneration.Models; using ComputeSharp.SourceGenerators.Models; namespace ComputeSharp.SourceGenerators; diff --git a/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs b/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs deleted file mode 100644 index 8b9fba53..00000000 --- a/src/ComputeSharp.SourceGenerators/Models/FieldInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -using ComputeSharp.SourceGeneration.Helpers; - -namespace ComputeSharp.SourceGenerators.Models; - -/// -/// A base type for a model describing a given captured field in a shader. -/// -internal abstract record FieldInfo -{ - /// - /// A captured primitive value (either a scalar, a vector, or a linear matrix). - /// - /// The path of the field with respect to the shader instance. - /// The full metadata name for the primitive type. - /// The byte offset of the value within the root signature. - public sealed record Primitive(EquatableArray FieldPath, string TypeName, int Offset) : FieldInfo; - - /// - /// A captured non linear matrix value. - /// - /// The path of the field with respect to the shader instance. - /// The full metadata name for the matrix type. - /// The name of each element in the matrix type. - /// The number of rows in the matrix. - /// The number of columns in the matrix. - /// The sequence of byte offsets for each row within the root signature. - public sealed record NonLinearMatrix( - EquatableArray FieldPath, - string TypeName, - string ElementName, - int Rows, - int Columns, - EquatableArray Offsets) : FieldInfo; -} \ No newline at end of file