diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateOutputBufferProperties.Syntax.cs
similarity index 66%
rename from src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs
rename to src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateOutputBufferProperties.Syntax.cs
index 6f001a18..a7c73bf3 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.Syntax.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateOutputBufferProperties.Syntax.cs
@@ -13,7 +13,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
partial class ID2D1ShaderGenerator
{
///
- partial class GetOutputBuffer
+ partial class OutputBuffer
{
///
/// Creates a instance for the BufferPrecision property.
@@ -84,39 +84,5 @@ partial class ID2D1ShaderGenerator
.WithExpressionBody(ArrowExpressionClause(channelDepthExpression))
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken));
}
-
- ///
- /// Creates a instance for the GetOutputBuffer method.
- ///
- /// The input info for the shader output buffer.
- /// The resulting instance for the GetOutputBuffer method.
- public static MethodDeclarationSyntax GetSyntax(OutputBufferInfo info)
- {
- // This code produces a method declaration as follows:
- //
- // readonly void global::ComputeSharp.D2D1.__Internals.ID2D1Shader.GetOutputBuffer(out uint precision, out uint depth)
- // {
- // precision = ;
- // depth = ;
- // }
- return
- MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(nameof(GetOutputBuffer)))
- .WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
- .AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
- .AddParameterListParameters(
- Parameter(Identifier("precision")).AddModifiers(Token(SyntaxKind.OutKeyword)).WithType(PredefinedType(Token(SyntaxKind.UIntKeyword))),
- Parameter(Identifier("depth")).AddModifiers(Token(SyntaxKind.OutKeyword)).WithType(PredefinedType(Token(SyntaxKind.UIntKeyword))))
- .WithBody(Block(
- ExpressionStatement(
- AssignmentExpression(
- SyntaxKind.SimpleAssignmentExpression,
- IdentifierName("precision"),
- LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal((int)info.BufferPrecision)))),
- ExpressionStatement(
- AssignmentExpression(
- SyntaxKind.SimpleAssignmentExpression,
- IdentifierName("depth"),
- LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal((int)info.ChannelDepth))))));
- }
}
}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateOutputBufferProperties.cs
similarity index 95%
rename from src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs
rename to src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateOutputBufferProperties.cs
index e2f0b848..9c01e195 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateGetOutputBufferMethod.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateOutputBufferProperties.cs
@@ -7,9 +7,9 @@ namespace ComputeSharp.D2D1.SourceGenerators;
partial class ID2D1ShaderGenerator
{
///
- /// A helper with all logic to generate the GetOutputBuffer method.
+ /// A helper with all logic to generate the output buffer properties.
///
- private static partial class GetOutputBuffer
+ private static partial class OutputBuffer
{
///
/// Extracts the output buffer info for the current shader.
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
index dc033c56..034ec0d2 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs
@@ -126,8 +126,8 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
token.ThrowIfCancellationRequested();
- // Get the info for GetOutputBuffer()
- GetOutputBuffer.GetInfo(typeSymbol, out D2D1BufferPrecision bufferPrecision, out D2D1ChannelDepth channelDepth);
+ // Get the info for the output buffer properties
+ OutputBuffer.GetInfo(typeSymbol, out D2D1BufferPrecision bufferPrecision, out D2D1ChannelDepth channelDepth);
token.ThrowIfCancellationRequested();
@@ -386,25 +386,20 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(LoadBytecode)}.g.cs", text);
});
- // Get the GetOutputBuffer() info (hierarchy and output buffers)
+ // Get the output buffer info (hierarchy and output buffers)
IncrementalValuesProvider<(HierarchyInfo Hierarchy, OutputBufferInfo OutputBuffer)> outputBufferInfo =
shaderInfoWithErrors
.Select(static (item, _) => (item.Hierarchy, item.OutputBuffer));
- // Generate the GetOutputBuffer() methods
+ // Generate the output buffer properties
context.RegisterSourceOutput(outputBufferInfo, static (context, item) =>
{
- MethodDeclarationSyntax getOutputBufferMethod = GetOutputBuffer.GetSyntax(item.OutputBuffer);
- CompilationUnitSyntax compilationUnit = GetCompilationUnitFromMember(item.Hierarchy, getOutputBufferMethod, canUseSkipLocalsInit: false);
-
- context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(GetOutputBuffer)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
-
- PropertyDeclarationSyntax bufferPrecisionProperty = GetOutputBuffer.GetBufferPrecisionSyntax(item.OutputBuffer);
+ PropertyDeclarationSyntax bufferPrecisionProperty = OutputBuffer.GetBufferPrecisionSyntax(item.OutputBuffer);
CompilationUnitSyntax bufferPrecisionCompilationUnit = GetCompilationUnitFromMember(item.Hierarchy, bufferPrecisionProperty, canUseSkipLocalsInit: false);
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.BufferPrecision.g.cs", bufferPrecisionCompilationUnit.GetText(Encoding.UTF8));
- PropertyDeclarationSyntax channelDepthProperty = GetOutputBuffer.GetChannelDepthSyntax(item.OutputBuffer);
+ PropertyDeclarationSyntax channelDepthProperty = OutputBuffer.GetChannelDepthSyntax(item.OutputBuffer);
CompilationUnitSyntax channelDepthCompilationUnit = GetCompilationUnitFromMember(item.Hierarchy, channelDepthProperty, canUseSkipLocalsInit: false);
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.ChannelDepth.g.cs", channelDepthCompilationUnit.GetText(Encoding.UTF8));
diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
index 1ae9c1f6..c900b46b 100644
--- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
+++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs
@@ -111,15 +111,6 @@ public interface ID2D1Shader
[Obsolete("This method is not intended to be used directly by user code")]
D2D1ChannelDepth ChannelDepth { get; }
- ///
- /// Gets the output buffer precision and depth for the shader.
- ///
- /// The output buffer precision.
- /// The output buffer channel depth.
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Obsolete("This method is not intended to be used directly by user code")]
- void GetOutputBuffer(out uint precision, out uint depth);
-
///
/// Loads the dispatch data for the shader.
///
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
index 5bd65dff..e2cd3232 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs
@@ -307,9 +307,7 @@ public static class D2D1PixelShader
{
Unsafe.SkipInit(out T shader);
- shader.GetOutputBuffer(out uint precision, out _);
-
- return (D2D1BufferPrecision)precision;
+ return shader.BufferPrecision;
}
///
@@ -322,9 +320,7 @@ public static class D2D1PixelShader
{
Unsafe.SkipInit(out T shader);
- shader.GetOutputBuffer(out _, out uint depth);
-
- return (D2D1ChannelDepth)depth;
+ return shader.ChannelDepth;
}
///