Add ID2D1Shader.ConstantBufferSize property

このコミットが含まれているのは:
Sergio Pedri committed 2023-09-30 14:12:49 +02:00
1 親 8de575ce51
コミット f9a73d9b09
4ファイル変更
+48 -28

検索条件に一致するファイルはありません

@@ -1,27 +0,0 @@
using ComputeSharp.D2D1.SourceGenerators.Models;
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.D2D1.SourceGenerators;
/// <inheritdoc/>
partial class ID2D1ShaderGenerator
{
/// <summary>
/// A helper with all logic to generate the <c>InputCount</c> property.
/// </summary>
private static partial class InputCount
{
/// <summary>
/// Writes the <c>InputCount</c> property.
/// </summary>
/// <param name="info">The input <see cref="D2D1ShaderInfo"/> instance with gathered shader info.</param>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
public static void WriteSyntax(D2D1ShaderInfo info, IndentedTextWriter writer)
{
writer.WriteLine("/// <inheritdoc/>");
writer.WriteGeneratedAttributes(typeof(ID2D1ShaderGenerator));
writer.WriteLine($"readonly int global::ComputeSharp.D2D1.__Internals.ID2D1Shader.InputCount => {info.InputTypes.Length};");
}
}
}
@@ -0,0 +1,39 @@
using ComputeSharp.D2D1.SourceGenerators.Models;
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.D2D1.SourceGenerators;
/// <inheritdoc/>
partial class ID2D1ShaderGenerator
{
/// <summary>
/// A helper with all logic to generate the available numeric properties.
/// </summary>
private static partial class NumericProperties
{
/// <summary>
/// Writes the <c>ConstantBufferSize</c> property.
/// </summary>
/// <param name="info">The input <see cref="D2D1ShaderInfo"/> instance with gathered shader info.</param>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
public static void WriteConstantBufferSizeSyntax(D2D1ShaderInfo info, IndentedTextWriter writer)
{
writer.WriteLine("/// <inheritdoc/>");
writer.WriteGeneratedAttributes(typeof(ID2D1ShaderGenerator));
writer.WriteLine($"readonly int global::ComputeSharp.D2D1.__Internals.ID2D1Shader.ConstantBufferSize => {info.ConstantBufferSizeInBytes};");
}
/// <summary>
/// Writes the <c>InputCount</c> property.
/// </summary>
/// <param name="info">The input <see cref="D2D1ShaderInfo"/> instance with gathered shader info.</param>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
public static void WriteInputCountSyntax(D2D1ShaderInfo info, IndentedTextWriter writer)
{
writer.WriteLine("/// <inheritdoc/>");
writer.WriteGeneratedAttributes(typeof(ID2D1ShaderGenerator));
writer.WriteLine($"readonly int global::ComputeSharp.D2D1.__Internals.ID2D1Shader.InputCount => {info.InputTypes.Length};");
}
}
}
+2 -1
ファイルの表示
@@ -201,7 +201,8 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
declaredMembers.Add(EffectMetadata.WriteEffectDescriptionSyntax);
declaredMembers.Add(EffectMetadata.WriteEffectCategorySyntax);
declaredMembers.Add(EffectMetadata.WriteEffectAuthorSyntax);
declaredMembers.Add(InputCount.WriteSyntax);
declaredMembers.Add(NumericProperties.WriteConstantBufferSizeSyntax);
declaredMembers.Add(NumericProperties.WriteInputCountSyntax);
declaredMembers.Add(InputTypes.WriteSyntax);
declaredMembers.Add(InputDescriptions.WriteSyntax);
declaredMembers.Add(ResourceTextureDescriptions.WriteSyntax);
+7
ファイルの表示
@@ -67,6 +67,13 @@ public interface ID2D1Shader
[Obsolete("This method is not intended to be used directly by user code")]
D2D1PixelOptions PixelOptions { get; }
/// <summary>
/// Gets the size in bytes of the constant buffer for the current shader.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be used directly by user code")]
int ConstantBufferSize { get; }
/// <summary>
/// Gets the number of inputs for the current shader.
/// </summary>