Rename BuildHlslString to BuildHlslSource

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:04:09 +02:00
1 親 573e6ba546
コミット 6f39eee106
9ファイル変更
+20 -20

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

@@ -23,7 +23,7 @@ partial class ID2D1ShaderGenerator
/// </summary>
/// <param name="bytecodeInfo">The input bytecode info.</param>
/// <param name="fixup">An opaque <see cref="Func{TResult}"/> instance to transform the final tree into text.</param>
/// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslString</c> method.</returns>
/// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslSource</c> method.</returns>
public static MethodDeclarationSyntax GetSyntax(EmbeddedBytecodeInfo bytecodeInfo, out Func<SyntaxNode, string> fixup)
{
BlockSyntax block = GetShaderBytecodeBody(bytecodeInfo, out string? bytecodeLiterals);
+1 -1
ファイルの表示
@@ -104,7 +104,7 @@ public static class ReflectionServices
private static unsafe ShaderInfo GetNonGenericShaderInfo<T>(in T shader)
where T : struct, IShader
{
Unsafe.AsRef(in shader).BuildHlslString(out ArrayPoolStringBuilder shaderSource, 1, 1, 1);
Unsafe.AsRef(in shader).BuildHlslSource(out ArrayPoolStringBuilder shaderSource, 1, 1, 1);
using ComPtr<IDxcBlob> dxcBlobBytecode = Shaders.Translation.ShaderCompiler.Instance.Compile(shaderSource.WrittenSpan);
+1 -1
ファイルの表示
@@ -27,7 +27,7 @@ public static class ShaderCompiler
where TLoader : struct, IBytecodeLoader
where T : struct, IShader
{
Unsafe.AsRef(in shader).BuildHlslString(out ArrayPoolStringBuilder builder, threadsX, threadsY, threadsZ);
Unsafe.AsRef(in shader).BuildHlslSource(out ArrayPoolStringBuilder builder, threadsX, threadsY, threadsZ);
using ComPtr<IDxcBlob> dxcBlobBytecode = Shaders.Translation.ShaderCompiler.Instance.Compile(builder.WrittenSpan);
@@ -15,14 +15,14 @@ namespace ComputeSharp.SourceGenerators;
public sealed partial class IShaderGenerator
{
/// <inheritdoc/>
internal static partial class BuildHlslString
internal static partial class BuildHlslSource
{
/// <summary>
/// Creates a <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslString</c> method.
/// Creates a <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslSource</c> method.
/// </summary>
/// <param name="hlslSourceInfo">The input <see cref="HlslShaderSourceInfo"/> instance to use.</param>
/// <param name="supportsDynamicShaders">Indicates whether or not dynamic shaders are supported.</param>
/// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslString</c> method.</returns>
/// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslSource</c> method.</returns>
public static MethodDeclarationSyntax GetSyntax(HlslShaderSourceInfo hlslSourceInfo, bool supportsDynamicShaders)
{
// Generate the necessary body statements depending on whether dynamic shaders are supported
@@ -32,14 +32,14 @@ public sealed partial class IShaderGenerator
// This code produces a method declaration as follows:
//
// readonly void global::ComputeSharp.__Internals.IShader.BuildHlslString(out global::ComputeSharp.__Internals.ArrayPoolStringBuilder builder, int threadsX, int threadsY, int threadsZ)
// readonly void global::ComputeSharp.__Internals.IShader.BuildHlslSource(out global::ComputeSharp.__Internals.ArrayPoolStringBuilder builder, int threadsX, int threadsY, int threadsZ)
// {
// <BODY>
// }
return
MethodDeclaration(
PredefinedType(Token(SyntaxKind.VoidKeyword)),
Identifier("BuildHlslString"))
Identifier("BuildHlslSource"))
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.__Internals.{nameof(IShader)}")))
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
.AddParameterListParameters(
@@ -23,9 +23,9 @@ namespace ComputeSharp.SourceGenerators;
public sealed partial class IShaderGenerator
{
/// <summary>
/// A helper with all logic to generate the <c>BuildHlslString</c> method.
/// A helper with all logic to generate the <c>BuildHlslSource</c> method.
/// </summary>
internal static partial class BuildHlslString
internal static partial class BuildHlslSource
{
/// <summary>
/// Gathers all necessary information on a transpiled HLSL source for a given shader type.
+1 -1
ファイルの表示
@@ -22,7 +22,7 @@ public sealed partial class IShaderGenerator
/// <param name="bytecodeInfo">The input <see cref="EmbeddedBytecodeInfo"/> instance.</param>
/// <param name="supportsDynamicShaders">Indicates whether or not dynamic shaders are supported.</param>
/// <param name="fixup">An opaque <see cref="Func{TResult}"/> instance to transform the final tree into text.</param>
/// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslString</c> method.</returns>
/// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>BuildHlslSource</c> method.</returns>
public static MethodDeclarationSyntax GetSyntax(EmbeddedBytecodeInfo bytecodeInfo, bool supportsDynamicShaders, out Func<SyntaxNode, string> fixup)
{
BlockSyntax block = GetShaderBytecodeBody(bytecodeInfo, supportsDynamicShaders, out string? bytecodeLiterals);
+6 -6
ファイルの表示
@@ -100,8 +100,8 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator
token.ThrowIfCancellationRequested();
// BuildHlslString() info
HlslShaderSourceInfo hlslSourceInfo = BuildHlslString.GetInfo(
// BuildHlslSource() info
HlslShaderSourceInfo hlslSourceInfo = BuildHlslSource.GetInfo(
item.Right,
item.Left.Left.Syntax,
item.Left.Left.Symbol,
@@ -161,13 +161,13 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator
.Select(static (item, token) => (item.Left.Dispatch.Hierarchy, item.Left.Hlsl, item.Right))
.WithComparers(HierarchyInfo.Comparer.Default, HlslShaderSourceInfo.Comparer.Default, EqualityComparer<bool>.Default);
// Generate the BuildHlslString() methods
// Generate the BuildHlslSource() methods
context.RegisterSourceOutput(hlslSourceInfo.Combine(canUseSkipLocalsInit), static (context, item) =>
{
MethodDeclarationSyntax buildHlslStringMethod = BuildHlslString.GetSyntax(item.Left.SourceInfo, item.Left.SupportsDynamicShaders);
MethodDeclarationSyntax buildHlslStringMethod = BuildHlslSource.GetSyntax(item.Left.SourceInfo, item.Left.SupportsDynamicShaders);
CompilationUnitSyntax compilationUnit = GetCompilationUnitFromMethod(item.Left.Hierarchy, buildHlslStringMethod, item.Right);
context.AddSource($"{item.Left.Hierarchy.FilenameHint}.{nameof(BuildHlslString)}", compilationUnit.ToFullString());
context.AddSource($"{item.Left.Hierarchy.FilenameHint}.{nameof(BuildHlslSource)}", compilationUnit.ToFullString());
});
// Get the dispatch metadata info
@@ -199,7 +199,7 @@ public sealed partial class IShaderGenerator : IIncrementalGenerator
// Transform the raw HLSL source to compile
IncrementalValuesProvider<(HierarchyInfo Hierarchy, string Hlsl, ThreadIdsInfo ThreadIds)> shaderBytecodeInfo =
shaderInfo
.Select(static (item, token) => (item.Dispatch.Hierarchy, BuildHlslString.GetNonDynamicHlslSource(item.Hlsl), item.ThreadIds))
.Select(static (item, token) => (item.Dispatch.Hierarchy, BuildHlslSource.GetNonDynamicHlslSource(item.Hlsl), item.ThreadIds))
.WithComparers(HierarchyInfo.Comparer.Default, EqualityComparer<string>.Default, ThreadIdsInfo.Comparer.Default);
// Compile the requested shader bytecodes
+2 -2
ファイルの表示
@@ -96,8 +96,8 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator
// Explore the syntax tree and extract the processed info
var semanticModel = new SemanticModelProvider(compilation);
var (entryPoint, dependentMethods) = GetProcessedMethods(methodDeclaration, semanticModel, discoveredTypes, constantDefinitions, out diagnostics);
var definedTypes = IShaderGenerator.BuildHlslString.GetDeclaredTypes(discoveredTypes);
var definedConstants = IShaderGenerator.BuildHlslString.GetDefinedConstants(constantDefinitions);
var definedTypes = IShaderGenerator.BuildHlslSource.GetDeclaredTypes(discoveredTypes);
var definedConstants = IShaderGenerator.BuildHlslSource.GetDefinedConstants(constantDefinitions);
return new(
methodSymbol.GetFullMetadataName(includeParameters: true),
+1 -1
ファイルの表示
@@ -73,7 +73,7 @@ public interface IShader
/// <param name="threadsZ">The number of threads in each thread group for the Z axis.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be called directly by user code")]
void BuildHlslString(out ArrayPoolStringBuilder builder, int threadsX, int threadsY, int threadsZ)
void BuildHlslSource(out ArrayPoolStringBuilder builder, int threadsX, int threadsY, int threadsZ)
#if NET6_0_OR_GREATER
{
throw new NotImplementedException();