diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs index 0a42c86a..62251b17 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.cs @@ -84,8 +84,6 @@ public sealed partial class D2DPixelShaderDescriptorGenerator : IIncrementalGene token.ThrowIfCancellationRequested(); - using ImmutableArrayBuilder diagnostics = new(); - // Constant buffer info ConstantBuffer.GetInfo( context.SemanticModel.Compilation, @@ -112,18 +110,6 @@ public sealed partial class D2DPixelShaderDescriptorGenerator : IIncrementalGene token.ThrowIfCancellationRequested(); - // Get HLSL source for HlslSource - string hlslSource = HlslSource.GetHlslSource( - diagnostics, - context.SemanticModel.Compilation, - typeSymbol, - inputCount, - inputSimpleIndices, - inputComplexIndices, - token); - - token.ThrowIfCancellationRequested(); - // Get the info for the output buffer properties OutputBuffer.GetInfo(typeSymbol, out D2D1BufferPrecision bufferPrecision, out D2D1ChannelDepth channelDepth); @@ -150,6 +136,20 @@ public sealed partial class D2DPixelShaderDescriptorGenerator : IIncrementalGene token.ThrowIfCancellationRequested(); + using ImmutableArrayBuilder diagnostics = new(); + + // Get HLSL source for HlslSource + string hlslSource = HlslSource.GetHlslSource( + diagnostics, + context.SemanticModel.Compilation, + typeSymbol, + inputCount, + inputSimpleIndices, + inputComplexIndices, + token); + + token.ThrowIfCancellationRequested(); + // As the last steps in the pipeline, try to compile the shader if needed. // This is done last so that it can be skipped if any errors happened before. HlslBytecodeInfoKey hlslInfoKey = new(