Minor code tweaks to IShaderGenerator

このコミットが含まれているのは:
Sergio Pedri committed 2021-12-08 11:17:07 +01:00
1 親 689e0e7202
コミット 1216d511a7
2ファイル変更
+6 -5

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

+3 -3
ファイルの表示
@@ -43,7 +43,7 @@ public sealed partial class IShaderGenerator
return null;
}
/// <summary>
/// Creates a <see cref="CompilationUnitSyntax"/> instance wrapping the given method.
/// </summary>
@@ -105,8 +105,8 @@ public sealed partial class IShaderGenerator
.AddMembers(typeDeclarationSyntax);
}
// Create a static method to create the combined hashcode for a given shader type.
// This code takes a block syntax and produces a compilation unit as follows:
// Create the compilation unit with disabled warnings, target namespace and generated type.
// This will produce code as follows:
//
// #pragma warning disable
//
+3 -2
ファイルの表示
@@ -31,12 +31,13 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator
// Get all declared struct types and their type symbols
IncrementalValuesProvider<(StructDeclarationSyntax Syntax, INamedTypeSymbol Symbol)> structDeclarations =
context.SyntaxProvider.CreateSyntaxProvider(
context.SyntaxProvider
.CreateSyntaxProvider(
static (node, token) => node is StructDeclarationSyntax structDeclaration,
static (context, token) => (
(StructDeclarationSyntax)context.Node,
Symbol: (INamedTypeSymbol?)context.SemanticModel.GetDeclaredSymbol(context.Node, token)))
.Where(static pair => pair.Symbol is not null)!;
.Where(static pair => pair.Symbol is { Interfaces.IsEmpty: false })!;
// Get the symbol for the IComputeShader and IPixelShader<TPixel> interfaces
IncrementalValueProvider<(INamedTypeSymbol Compute, INamedTypeSymbol Pixel) > shaderInterfaces =