Add and generate IShader.IsStaticSamplerRequired API

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-14 10:28:57 +02:00
1 親 d90266fc61
コミット 30414faf40
3ファイル変更
+22 -1

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

@@ -23,6 +23,18 @@ partial class IShaderGenerator
writer.WriteLine($"readonly int global::ComputeSharp.__Internals.IShader.ConstantBufferSize => {info.ConstantBufferSizeInBytes};");
}
/// <summary>
/// Writes the <c>IsStaticSamplerRequired</c> property.
/// </summary>
/// <param name="info">The input <see cref="ShaderInfo"/> instance with gathered shader info.</param>
/// <param name="writer">The <see cref="IndentedTextWriter"/> instance to write into.</param>
public static void WriteIsStaticSamplerRequiredSyntax(ShaderInfo info, IndentedTextWriter writer)
{
writer.WriteLine("/// <inheritdoc/>");
writer.WriteGeneratedAttributes(GeneratorName);
writer.WriteLine($"readonly bool global::ComputeSharp.__Internals.IShader.IsStaticSamplerRequired => {info.IsSamplerUsed.ToString().ToLowerInvariant()};");
}
/// <summary>
/// Writes the <c>LoadDispatchMetadata</c> method.
/// </summary>
+2 -1
ファイルの表示
@@ -149,10 +149,11 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator
declaredMembers.Add(LoadBytecode.WriteThreadsYSyntax);
declaredMembers.Add(LoadBytecode.WriteThreadsZSyntax);
declaredMembers.Add(LoadDispatchMetadata.WriteConstantBufferSizeSyntax);
declaredMembers.Add(LoadDispatchMetadata.WriteIsStaticSamplerRequiredSyntax);
declaredMembers.Add(BuildHlslSource.WriteSyntax);
declaredMembers.Add(LoadBytecode.WriteHlslBytecodeSyntax);
declaredMembers.Add(LoadDispatchData.WriteSyntax);
declaredMembers.Add(LoadDispatchMetadata.WriteSyntax);
declaredMembers.Add(BuildHlslSource.WriteSyntax);
using ImmutableArrayBuilder<IndentedTextWriter.Callback<ShaderInfo>> additionalTypes = new();
using ImmutableHashSetBuilder<string> usingDirectives = new();
+8
ファイルの表示
@@ -35,6 +35,14 @@ public interface IShader
/// </remarks>
int ConstantBufferSize { get; }
/// <summary>
/// Gets whether the shader requires a static sampler being declared and initialized.
/// </summary>
/// <remarks>
/// When requested, a static sampler with linear sampling and mirror addressing will be bound to <c>register(s)</c>.
/// </remarks>
bool IsStaticSamplerRequired { get; }
/// <summary>
/// Gets the HLSL source code for the current shader instance.
/// </summary>