Added support for implicit local functions

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-05 18:09:58 +02:00
1 親 e512c5839e
コミット 4f58fe4f1f
5ファイル変更
+54 -1

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

+29
ファイルの表示
@@ -0,0 +1,29 @@
using System;
namespace ComputeSharp.Shaders.Renderer.Models.Functions
{
/// <summary>
/// A <see langword="class"/> that contains info on a local shader function
/// </summary>
internal sealed class LocalFunctionInfo
{
/// <summary>
/// Gets the prototype for the current function
/// </summary>
public string FunctionPrototype => FunctionDeclaration.Split(Environment.NewLine)[0];
/// <summary>
/// Gets the declaration of the current function
/// </summary>
public string FunctionDeclaration { get; }
/// <summary>
/// Creates a new <see cref="LocalFunctionInfo"/> instance with the specified parameters
/// </summary>
/// <param name="functionDeclaration">The declaration of the current function</param>
public LocalFunctionInfo(string functionDeclaration)
{
FunctionDeclaration = functionDeclaration;
}
}
}
+5
ファイルの表示
@@ -51,5 +51,10 @@ namespace ComputeSharp.Shaders.Renderer.Models
/// Gets or sets the list of static functions used by the shader
/// </summary>
public IReadOnlyList<FunctionInfo> FunctionsList { get; set; }
/// <summary>
/// Gets or sets the list of local (implicit) functions used by the shader
/// </summary>
public IReadOnlyList<LocalFunctionInfo> LocalFunctionsList { get; set; }
}
}
+6
ファイルの表示
@@ -45,6 +45,12 @@ cbuffer _{{FieldName}} : register(b{{BufferIndex}})
{{ReturnType}} {{FunctionName}}({{#ParametersList}}{{ParameterModifier}} {{ParameterType}} {{ParameterName}}{{^IsLastParameter}}, {{/IsLastParameter}}{{/ParametersList}})
{{FunctionBody}}
{{/FunctionsList}}
{{#LocalFunctionsList}}
{{!Shader implicit functions}}
// {{FunctionPrototype}}
{{FunctionDeclaration}}
{{/LocalFunctionsList}}
{{!Shader entry point}}
// Shader body