diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj
index 10b3bff1..09697080 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.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateResourceTextureDescriptionsProperty.Syntax.cs
similarity index 96%
rename from src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs
rename to src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateResourceTextureDescriptionsProperty.Syntax.cs
index a0aff034..9748945f 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.Syntax.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateResourceTextureDescriptionsProperty.Syntax.cs
@@ -15,7 +15,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
partial class ID2D1ShaderGenerator
{
///
- private static partial class LoadResourceTextureDescriptions
+ private static partial class ResourceTextureDescriptions
{
///
/// Creates a instance for the ResourceTextureDescriptions property.
@@ -39,7 +39,7 @@ partial class ID2D1ShaderGenerator
memoryExpression = MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
IdentifierName("Data"),
- IdentifierName("ResourceTextureDescriptions"));
+ IdentifierName(nameof(ResourceTextureDescriptions)));
additionalTypes = new[] { GetArrayDeclaration(resourceTextureDescriptionsInfo) };
}
@@ -51,7 +51,7 @@ partial class ID2D1ShaderGenerator
PropertyDeclaration(
GenericName(Identifier("global::System.ReadOnlyMemory"))
.AddTypeArgumentListArguments(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1ResourceTextureDescription")),
- Identifier("ResourceTextureDescriptions"))
+ Identifier(nameof(ResourceTextureDescriptions)))
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
.WithExpressionBody(ArrowExpressionClause(memoryExpression))
@@ -93,7 +93,7 @@ partial class ID2D1ShaderGenerator
ArrayType(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1ResourceTextureDescription"))
.AddRankSpecifiers(ArrayRankSpecifier(SingletonSeparatedList(OmittedArraySizeExpression()))))
.AddVariables(
- VariableDeclarator(Identifier("ResourceTextureDescriptions"))
+ VariableDeclarator(Identifier(nameof(ResourceTextureDescriptions)))
.WithInitializer(EqualsValueClause(
InitializerExpression(SyntaxKind.ArrayInitializerExpression)
.AddExpressions(resourceTextureDescriptionExpressions.ToArray())))))
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateResourceTextureDescriptionsProperty.cs
similarity index 97%
rename from src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs
rename to src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateResourceTextureDescriptionsProperty.cs
index f5514c82..79dbdce9 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadResourceTextureDescriptionsMethod.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateResourceTextureDescriptionsProperty.cs
@@ -14,9 +14,9 @@ namespace ComputeSharp.D2D1.SourceGenerators;
partial class ID2D1ShaderGenerator
{
///
- /// A helper with all logic to generate the LoadResourceTextureDescriptions method.
+ /// A helper with all logic to generate the ResourceTextureDescriptions property.
///
- private static partial class LoadResourceTextureDescriptions
+ private static partial class ResourceTextureDescriptions
{
///
/// Extracts the resource texture descriptions for the current shader.
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
index 27e7c015..a9b53915 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
@@ -100,8 +100,8 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
out ImmutableArray inputComplexIndices,
out ImmutableArray inputTypes);
- // Get the resource texture info for LoadResourceTextureDescriptions()
- LoadResourceTextureDescriptions.GetInfo(
+ // Get the resource texture info for ResourceTextureDescriptions
+ ResourceTextureDescriptions.GetInfo(
diagnostics,
typeSymbol,
inputCount,
@@ -271,18 +271,18 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(InputTypes)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
});
- // Get the LoadResourceTextureDescriptions() info (hierarchy and resource texture descriptions)
+ // Get the ResourceTextureDescriptions info (hierarchy and resource texture descriptions)
IncrementalValuesProvider<(HierarchyInfo Hierarchy, ResourceTextureDescriptionsInfo ResourceTextureDescriptions)> resourceTextureDescriptionsInfo =
shaderInfoWithErrors
.Select(static (item, _) => (item.Hierarchy, item.ResourceTextureDescriptions));
- // Generate the LoadResourceTextureDescriptions() methods
+ // Generate the ResourceTextureDescriptions properties
context.RegisterSourceOutput(resourceTextureDescriptionsInfo, static (context, item) =>
{
- PropertyDeclarationSyntax resourceTextureDescriptionsProperty = LoadResourceTextureDescriptions.GetSyntax(item.ResourceTextureDescriptions, out TypeDeclarationSyntax[] additionalTypes);
+ PropertyDeclarationSyntax resourceTextureDescriptionsProperty = ResourceTextureDescriptions.GetSyntax(item.ResourceTextureDescriptions, out TypeDeclarationSyntax[] additionalTypes);
CompilationUnitSyntax compilationUnit = GetCompilationUnitFromMember(item.Hierarchy, resourceTextureDescriptionsProperty, canUseSkipLocalsInit: false, additionalMemberDeclarations: additionalTypes);
- context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(LoadResourceTextureDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
+ context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(ResourceTextureDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
});
// Get the info for InitializeFromDispatchData() (hierarchy and dispatch data)
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs
deleted file mode 100644
index c0dc2ec5..00000000
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1ResourceTextureDescriptionsLoader.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.ComponentModel;
-
-namespace ComputeSharp.D2D1.__Internals;
-
-///
-/// A base representing a loader for resource texture descriptions in a D2D1 shader.
-///
-[EditorBrowsable(EditorBrowsableState.Never)]
-[Obsolete("This interface is not intended to be used directly by user code")]
-public interface ID2D1ResourceTextureDescriptionsLoader
-{
- ///
- /// Loads the available resource texture descriptions for the shader.
- ///
- /// The sequence of serialized resource texture descriptions.
- void LoadResourceTextureDescriptions(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 1a3b6d8d..ef33bcde 100644
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
+++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
@@ -98,16 +98,6 @@ public interface ID2D1Shader
[Obsolete("This method is not intended to be used directly by user code")]
ReadOnlyMemory ResourceTextureDescriptions { get; }
- ///
- /// Loads the resource texture descriptions for the shader, if any.
- ///
- /// The type of resource texture descriptions loader being used.
- /// The instance to use to load the resource texture descriptions.
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
- void LoadResourceTextureDescriptions(ref TLoader loader)
- where TLoader : struct, ID2D1ResourceTextureDescriptionsLoader;
-
///
/// Gets the output buffer precision and depth for the shader.
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
index d968c8c6..c10cb2b1 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
@@ -292,13 +292,9 @@ public static class D2D1PixelShader
public static ReadOnlyMemory GetResourceTextureDescriptions()
where T : unmanaged, ID2D1PixelShader
{
- D2D1ByteArrayResourceTextureDescriptionsLoader resourceTextureDescriptionsLoader = default;
-
Unsafe.SkipInit(out T shader);
- shader.LoadResourceTextureDescriptions(ref resourceTextureDescriptionsLoader);
-
- return resourceTextureDescriptionsLoader.GetResultingResourceTextureDescriptions();
+ return shader.ResourceTextureDescriptions;
}
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.cs b/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.cs
deleted file mode 100644
index 76f75c4a..00000000
--- a/src/ComputeSharp.D2D1/Shaders/Loaders/D2D1ByteArrayResourceTextureDescriptionsLoader.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;
-
-///
-/// A resource texture descriptions loader for D2D1 pixel shaders.
-///
-internal struct D2D1ByteArrayResourceTextureDescriptionsLoader : ID2D1ResourceTextureDescriptionsLoader
-{
- ///
- /// The resulting array.
- ///
- private D2D1ResourceTextureDescription[]? resourceTextureDescriptions;
-
- ///
- /// Gets the resulting resource texture descriptions.
- ///
- /// A array with the available resource texture descriptions.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public readonly D2D1ResourceTextureDescription[] GetResultingResourceTextureDescriptions()
- {
- return this.resourceTextureDescriptions!;
- }
-
- ///
- void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan data)
- {
- this.resourceTextureDescriptions = MemoryMarshal.Cast(data).ToArray();
- }
-}
\ No newline at end of file