Add D2DPixelShaderSourceGenerator incrementality tests

このコミットが含まれているのは:
Sergio Pedri committed 2024-01-04 01:47:31 +01:00
1 親 60e10e5bd9
コミット 913c1ec5f6
2ファイル変更
+290 -3

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

+15 -3
ファイルの表示
@@ -1,6 +1,7 @@
using System.Collections.Immutable;
using System.Linq;
using ComputeSharp.D2D1.SourceGenerators.Models;
using ComputeSharp.SourceGeneration.Constants;
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
using ComputeSharp.SourceGeneration.Models;
@@ -77,10 +78,21 @@ public sealed partial class D2DPixelShaderSourceGenerator : IIncrementalGenerato
HlslInfoKey: hlslInfoKey,
HlslInfo: hlslInfo,
Diagnostcs: diagnostics.ToImmutable());
});
})
.WithTrackingName(WellKnownTrackingNames.Execute);
IncrementalValuesProvider<EquatableArray<DiagnosticInfo>> diagnosticInfo = methodInfo.Select(static (item, _) => item.Diagnostcs);
IncrementalValuesProvider<D2D1PixelShaderSourceInfo> outputInfo = methodInfo.Select(static (item, _) => item with { Diagnostcs = default });
// Get the diagnostic incremental collection with filtering (same as in the D2D1 generator)
IncrementalValuesProvider<EquatableArray<DiagnosticInfo>> diagnosticInfo =
methodInfo
.Select(static (item, _) => item.Diagnostcs)
.WithTrackingName(WellKnownTrackingNames.Diagnostics)
.Where(static item => !item.IsEmpty);
// Also get the comparison-friendly incremental collection for the output (same as above)
IncrementalValuesProvider<D2D1PixelShaderSourceInfo> outputInfo =
methodInfo
.Select(static (item, _) => item with { Diagnostcs = default })
.WithTrackingName(WellKnownTrackingNames.Output);
// Output the diagnostics, if any
context.ReportDiagnostics(diagnosticInfo);