Add and adopt IndentedTextWriterExtensions
このコミットが含まれているのは:
1 親
5d859266d8
コミット
eba861e20e
7ファイル変更
+76
-43
検索条件に一致するファイルはありません
+5
-9
@@ -1,6 +1,9 @@
|
||||
using ComputeSharp.D2D1.SourceGenerators.Models;
|
||||
using ComputeSharp.SourceGeneration.Extensions;
|
||||
using ComputeSharp.SourceGeneration.Helpers;
|
||||
|
||||
#pragma warning disable IDE0053
|
||||
|
||||
namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -99,17 +102,10 @@ partial class ID2D1ShaderGenerator
|
||||
writer.IncreaseIndent();
|
||||
|
||||
// Initialize all input descriptions
|
||||
for (int i = 0; i < info.InputDescriptions.Length; i++)
|
||||
writer.WriteInitializationExpressions(info.InputDescriptions.AsSpan(), static (description, writer) =>
|
||||
{
|
||||
InputDescription description = info.InputDescriptions[i];
|
||||
|
||||
writer.Write($$"""new global::ComputeSharp.D2D1.Interop.D2D1InputDescription({{description.Index}}, global::ComputeSharp.D2D1.D2D1Filter.{{description.Filter}}) { LevelOfDetailCount = {{description.LevelOfDetailCount}} }""");
|
||||
|
||||
if (i < info.InputDescriptions.Length - 1)
|
||||
{
|
||||
writer.WriteLine(",");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
writer.DecreaseIndent();
|
||||
writer.WriteLine();
|
||||
|
||||
+4
-8
@@ -1,4 +1,5 @@
|
||||
using ComputeSharp.D2D1.SourceGenerators.Models;
|
||||
using ComputeSharp.SourceGeneration.Extensions;
|
||||
using ComputeSharp.SourceGeneration.Helpers;
|
||||
|
||||
namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
@@ -68,16 +69,11 @@ partial class ID2D1ShaderGenerator
|
||||
writer.IncreaseIndent();
|
||||
|
||||
// Input types, one per line in the RVA field initializer
|
||||
for (int i = 0; i < info.InputTypes.Length; i++)
|
||||
writer.WriteInitializationExpressions(info.InputTypes.AsSpan(), static (type, writer) =>
|
||||
{
|
||||
writer.Write("global::ComputeSharp.D2D1.Interop.D2D1PixelShaderInputType.");
|
||||
writer.Write(info.InputTypes[i] == 0 ? "Simple" : "Complex");
|
||||
|
||||
if (i < info.InputTypes.Length - 1)
|
||||
{
|
||||
writer.WriteLine(",");
|
||||
}
|
||||
}
|
||||
writer.Write(type == 0 ? "Simple" : "Complex");
|
||||
});
|
||||
|
||||
writer.DecreaseIndent();
|
||||
writer.WriteLine();
|
||||
|
||||
+4
-8
@@ -1,4 +1,5 @@
|
||||
using ComputeSharp.D2D1.SourceGenerators.Models;
|
||||
using ComputeSharp.SourceGeneration.Extensions;
|
||||
using ComputeSharp.SourceGeneration.Helpers;
|
||||
using ComputeSharp.SourceGeneration.Mappings;
|
||||
|
||||
@@ -93,14 +94,9 @@ partial class ID2D1ShaderGenerator
|
||||
using (writer.WriteBlock())
|
||||
{
|
||||
// Declare fields for every mapped item from the shader layout
|
||||
for (int i = 0; i < info.Fields.Length; i++)
|
||||
writer.WriteLineSeparatedMembers(info.Fields.AsSpan(), (field, writer) =>
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
switch (info.Fields[i])
|
||||
switch (field)
|
||||
{
|
||||
case FieldInfo.Primitive { TypeName: "System.Boolean" } primitive:
|
||||
|
||||
@@ -131,7 +127,7 @@ partial class ID2D1ShaderGenerator
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-9
@@ -1,6 +1,9 @@
|
||||
using ComputeSharp.D2D1.SourceGenerators.Models;
|
||||
using ComputeSharp.SourceGeneration.Extensions;
|
||||
using ComputeSharp.SourceGeneration.Helpers;
|
||||
|
||||
#pragma warning disable IDE0053
|
||||
|
||||
namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -52,17 +55,10 @@ partial class ID2D1ShaderGenerator
|
||||
writer.IncreaseIndent();
|
||||
|
||||
// Initialize all resource texture descriptions
|
||||
for (int i = 0; i < info.ResourceTextureDescriptions.Length; i++)
|
||||
writer.WriteInitializationExpressions(info.ResourceTextureDescriptions.AsSpan(), static (description, writer) =>
|
||||
{
|
||||
ResourceTextureDescription description = info.ResourceTextureDescriptions[i];
|
||||
|
||||
writer.Write($"new global::ComputeSharp.D2D1.Interop.D2D1ResourceTextureDescription({description.Index}, {description.Rank})");
|
||||
|
||||
if (i < info.ResourceTextureDescriptions.Length - 1)
|
||||
{
|
||||
writer.WriteLine(",");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
writer.DecreaseIndent();
|
||||
writer.WriteLine();
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする