Shader FieldInfo models across D2D1/D3D12 generators

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-17 00:47:51 +02:00
1 親 55fd665668
コミット e6f9261d87
7ファイル変更
+14 -43

検索条件に一致するファイルはありません

@@ -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;
@@ -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;
@@ -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;
@@ -21,6 +21,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Mappings\HlslKnownProperties.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Mappings\HlslKnownSizes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Mappings\HlslKnownTypes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Models\FieldInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Models\HlslBytecodeInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SyntaxRewriters\HlslSourceRewriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SyntaxRewriters\HlslSourceRewriter.Diagnostics.cs" />
@@ -1,25 +1,27 @@
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.D2D1.SourceGenerators.Models;
namespace ComputeSharp.SourceGeneration.Models;
/// <summary>
/// A base type for a model describing a given captured field in a shader.
/// </summary>
internal abstract record FieldInfo
/// <param name="FieldPath">The path of the field with respect to the shader instance.</param>
/// <param name="TypeName">The full metadata name for the primitive type.</param>
internal abstract record FieldInfo(EquatableArray<string> FieldPath, string TypeName)
{
/// <summary>
/// A captured primitive value (either a scalar, a vector, or a linear matrix).
/// </summary>
/// <param name="FieldPath">The path of the field with respect to the shader instance.</param>
/// <param name="TypeName">The full metadata name for the primitive type.</param>
/// <param name="FieldPath"><inheritdoc cref="FieldInfo(EquatableArray{string}, string)" path="/param[@name='FieldPath']/node()"/></param>
/// <param name="TypeName"><inheritdoc cref="FieldInfo(EquatableArray{string}, string)" path="/param[@name='TypeName']/node()"/></param>
/// <param name="Offset">The byte offset of the value within the root signature.</param>
public sealed record Primitive(EquatableArray<string> FieldPath, string TypeName, int Offset) : FieldInfo;
public sealed record Primitive(EquatableArray<string> FieldPath, string TypeName, int Offset) : FieldInfo(FieldPath, TypeName);
/// <summary>
/// A captured non linear matrix value.
/// </summary>
/// <param name="FieldPath">The path of the field with respect to the shader instance.</param>
/// <param name="TypeName">The full metadata name for the matrix type.</param>
/// <param name="FieldPath"><inheritdoc cref="FieldInfo(EquatableArray{string}, string)" path="/param[@name='FieldPath']/node()"/></param>
/// <param name="TypeName"><inheritdoc cref="FieldInfo(EquatableArray{string}, string)" path="/param[@name='TypeName']/node()"/></param>
/// <param name="ElementName">The name of each element in the matrix type.</param>
/// <param name="Rows">The number of rows in the matrix.</param>
/// <param name="Columns">The number of columns in the matrix.</param>
@@ -30,5 +32,5 @@ internal abstract record FieldInfo
string ElementName,
int Rows,
int Columns,
EquatableArray<int> Offsets) : FieldInfo;
EquatableArray<int> Offsets) : FieldInfo(FieldPath, TypeName);
}
@@ -1,5 +1,6 @@
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
using ComputeSharp.SourceGeneration.Models;
using ComputeSharp.SourceGenerators.Models;
namespace ComputeSharp.SourceGenerators;
-34
ファイルの表示
@@ -1,34 +0,0 @@
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.SourceGenerators.Models;
/// <summary>
/// A base type for a model describing a given captured field in a shader.
/// </summary>
internal abstract record FieldInfo
{
/// <summary>
/// A captured primitive value (either a scalar, a vector, or a linear matrix).
/// </summary>
/// <param name="FieldPath">The path of the field with respect to the shader instance.</param>
/// <param name="TypeName">The full metadata name for the primitive type.</param>
/// <param name="Offset">The byte offset of the value within the root signature.</param>
public sealed record Primitive(EquatableArray<string> FieldPath, string TypeName, int Offset) : FieldInfo;
/// <summary>
/// A captured non linear matrix value.
/// </summary>
/// <param name="FieldPath">The path of the field with respect to the shader instance.</param>
/// <param name="TypeName">The full metadata name for the matrix type.</param>
/// <param name="ElementName">The name of each element in the matrix type.</param>
/// <param name="Rows">The number of rows in the matrix.</param>
/// <param name="Columns">The number of columns in the matrix.</param>
/// <param name="Offsets">The sequence of byte offsets for each row within the root signature.</param>
public sealed record NonLinearMatrix(
EquatableArray<string> FieldPath,
string TypeName,
string ElementName,
int Rows,
int Columns,
EquatableArray<int> Offsets) : FieldInfo;
}