diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateNumericProperties.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateNumericProperties.Syntax.cs index 1a45c069..1bb81881 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateNumericProperties.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateNumericProperties.Syntax.cs @@ -35,5 +35,17 @@ partial class ID2D1ShaderGenerator writer.WriteGeneratedAttributes(typeof(ID2D1ShaderGenerator)); writer.WriteLine($"readonly int global::ComputeSharp.D2D1.__Internals.ID2D1Shader.InputCount => {info.InputTypes.Length};"); } + + /// + /// Writes the ResourceTextureCount property. + /// + /// The input instance with gathered shader info. + /// The instance to write into. + public static void WriteResourceTextureCountSyntax(D2D1ShaderInfo info, IndentedTextWriter writer) + { + writer.WriteLine("/// "); + writer.WriteGeneratedAttributes(typeof(ID2D1ShaderGenerator)); + writer.WriteLine($"readonly int global::ComputeSharp.D2D1.__Internals.ID2D1Shader.ResourceTextureCount => {info.ResourceTextureDescriptions.Length};"); + } } } \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs index 5561deae..ec56e55b 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs @@ -203,6 +203,7 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator declaredMembers.Add(EffectMetadata.WriteEffectAuthorSyntax); declaredMembers.Add(NumericProperties.WriteConstantBufferSizeSyntax); declaredMembers.Add(NumericProperties.WriteInputCountSyntax); + declaredMembers.Add(NumericProperties.WriteResourceTextureCountSyntax); declaredMembers.Add(InputTypes.WriteSyntax); declaredMembers.Add(InputDescriptions.WriteSyntax); declaredMembers.Add(ResourceTextureDescriptions.WriteSyntax); diff --git a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs index 0cff2231..4fb00ab4 100644 --- a/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs +++ b/src/ComputeSharp.D2D1/Interfaces/__Internals/ID2D1Shader.cs @@ -81,6 +81,13 @@ public interface ID2D1Shader [Obsolete("This method is not intended to be used directly by user code")] int InputCount { get; } + /// + /// Gets the number of resource textures for the current shader. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This method is not intended to be used directly by user code")] + int ResourceTextureCount { get; } + /// /// Gets the input types for the current shader. ///