diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
index 9fff66b5..67129912 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
@@ -80,7 +80,6 @@
-
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs
similarity index 97%
rename from src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs
rename to src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs
index 543a46e3..08312b7a 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.Syntax.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs
@@ -15,7 +15,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
partial class ID2D1ShaderGenerator
{
///
- private static partial class LoadInputDescriptions
+ private static partial class InputDescriptions
{
///
/// Creates a instance for the InputDescriptions property.
@@ -39,7 +39,7 @@ partial class ID2D1ShaderGenerator
memoryExpression = MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
IdentifierName("Data"),
- IdentifierName("InputDescriptions"));
+ IdentifierName(nameof(InputDescriptions)));
additionalTypes = new[] { GetArrayDeclaration(inputDescriptionsInfo) };
}
@@ -54,7 +54,7 @@ partial class ID2D1ShaderGenerator
PropertyDeclaration(
GenericName(Identifier("global::System.ReadOnlyMemory"))
.AddTypeArgumentListArguments(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1InputDescription")),
- Identifier("InputDescriptions"))
+ Identifier(nameof(InputDescriptions)))
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
.WithExpressionBody(ArrowExpressionClause(memoryExpression))
@@ -118,7 +118,7 @@ partial class ID2D1ShaderGenerator
ArrayType(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1InputDescription"))
.AddRankSpecifiers(ArrayRankSpecifier(SingletonSeparatedList(OmittedArraySizeExpression()))))
.AddVariables(
- VariableDeclarator(Identifier("InputDescriptions"))
+ VariableDeclarator(Identifier(nameof(InputDescriptions)))
.WithInitializer(EqualsValueClause(
InitializerExpression(SyntaxKind.ArrayInitializerExpression)
.AddExpressions(inputDescriptionExpressions.ToArray())))))
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.cs
similarity index 96%
rename from src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs
rename to src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.cs
index 7dafa78b..dbe31d17 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadInputDescriptionsMethod.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.cs
@@ -13,9 +13,9 @@ namespace ComputeSharp.D2D1.SourceGenerators;
partial class ID2D1ShaderGenerator
{
///
- /// A helper with all logic to generate the LoadInputDescriptions method.
+ /// A helper with all logic to generate the InputDescriptions property.
///
- private static partial class LoadInputDescriptions
+ private static partial class InputDescriptions
{
///
/// Extracts the input descriptions for the current shader.
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
index 54787358..93f432e5 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
@@ -131,8 +131,8 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
token.ThrowIfCancellationRequested();
- // Get the info for LoadInputDescriptions()
- LoadInputDescriptions.GetInfo(
+ // Get the info for InputDescriptions
+ InputDescriptions.GetInfo(
diagnostics,
typeSymbol,
out ImmutableArray inputDescriptions);
@@ -400,19 +400,19 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(GetOutputBuffer)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
});
- // Get the LoadInputDescriptions() info (hierarchy and input descriptions)
+ // Get the InputDescriptions info (hierarchy and input descriptions)
IncrementalValuesProvider<((HierarchyInfo Hierarchy, InputDescriptionsInfo InputDescriptions) Info, bool CanUseSkipLocalsInit)> inputDescriptionsInfo =
shaderInfoWithErrors
.Select(static (item, _) => (item.Hierarchy, item.InputDescriptions))
.Combine(canUseSkipLocalsInit);
- // Generate the LoadInputDescriptions() methods
+ // Generate the InputDescriptions properties
context.RegisterSourceOutput(inputDescriptionsInfo, static (context, item) =>
{
- PropertyDeclarationSyntax inputDescriptionsProperty = LoadInputDescriptions.GetSyntax(item.Info.InputDescriptions, out TypeDeclarationSyntax[] additionalTypes);
+ PropertyDeclarationSyntax inputDescriptionsProperty = InputDescriptions.GetSyntax(item.Info.InputDescriptions, out TypeDeclarationSyntax[] additionalTypes);
CompilationUnitSyntax compilationUnit = GetCompilationUnitFromMember(item.Info.Hierarchy, inputDescriptionsProperty, item.CanUseSkipLocalsInit, additionalMemberDeclarations: additionalTypes);
- context.AddSource($"{item.Info.Hierarchy.FullyQualifiedMetadataName}.{nameof(LoadInputDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
+ context.AddSource($"{item.Info.Hierarchy.FullyQualifiedMetadataName}.{nameof(InputDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
});
// Get the GetPixelOptions() info (hierarchy and pixel options)
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs
deleted file mode 100644
index d1795a3f..00000000
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1InputDescriptionsLoader.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.ComponentModel;
-
-namespace ComputeSharp.D2D1.__Internals;
-
-///
-/// A base representing a loader for input descriptions in a D2D1 shader.
-///
-[EditorBrowsable(EditorBrowsableState.Never)]
-[Obsolete("This interface is not intended to be used directly by user code")]
-public interface ID2D1InputDescriptionsLoader
-{
- ///
- /// Loads the available input descriptions for the shader.
- ///
- /// The sequence of serialized input descriptions.
- void LoadInputDescriptions(ReadOnlySpan data);
-}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
index 25eb8a4b..f5ca18f5 100644
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
+++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
@@ -91,16 +91,6 @@ public interface ID2D1Shader
[Obsolete("This method is not intended to be used directly by user code")]
ReadOnlyMemory InputDescriptions { get; }
- ///
- /// Loads the input descriptions for the shader, if any.
- ///
- /// The type of input descriptions loader being used.
- /// The instance to use to load the input descriptions.
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
- void LoadInputDescriptions(ref TLoader loader)
- where TLoader : struct, ID2D1InputDescriptionsLoader;
-
///
/// Loads the resource texture descriptions for the shader, if any.
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
index b146d8ac..d968c8c6 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
@@ -279,13 +279,9 @@ public static class D2D1PixelShader
public static ReadOnlyMemory GetInputDescriptions()
where T : unmanaged, ID2D1PixelShader
{
- D2D1ByteArrayInputDescriptionsLoader inputDescriptionsLoader = default;
-
Unsafe.SkipInit(out T shader);
- shader.LoadInputDescriptions(ref inputDescriptionsLoader);
-
- return inputDescriptionsLoader.GetResultingInputDescriptions();
+ return shader.InputDescriptions;
}
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs
deleted file mode 100644
index 88c714f7..00000000
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayInputDescriptionsLoader.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using ComputeSharp.D2D1.__Internals;
-using ComputeSharp.D2D1.Interop;
-
-#pragma warning disable CS0618
-
-namespace ComputeSharp.D2D1.Shaders.Loaders;
-
-///
-/// An input descriptions loader for D2D1 pixel shaders.
-///
-internal struct D2D1ByteArrayInputDescriptionsLoader : ID2D1InputDescriptionsLoader
-{
- ///
- /// The resulting array.
- ///
- private D2D1InputDescription[]? inputDescriptions;
-
- ///
- /// Gets the resulting input descriptions.
- ///
- /// A array with the available input descriptions.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly D2D1InputDescription[] GetResultingInputDescriptions()
- {
- return this.inputDescriptions!;
- }
-
- ///
- void ID2D1InputDescriptionsLoader.LoadInputDescriptions(ReadOnlySpan data)
- {
- this.inputDescriptions = MemoryMarshal.Cast(data).ToArray();
- }
-}
\ No newline at end of file