Add and generate IShader.IsStaticSamplerRequired API
このコミットが含まれているのは:
1 親
d90266fc61
コミット
30414faf40
3ファイル変更
+22
-1
検索条件に一致するファイルはありません
+12
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする