Added support for local shader functions

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-26 15:29:39 +01:00
1 親 010c718383
コミット 5da64a84af
2ファイル変更
+16 -2

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

+7
ファイルの表示
@@ -88,6 +88,13 @@ namespace ComputeSharp.Shaders.Renderer
}
}
// Local functions
foreach (var function in info.LocalFunctionsList)
{
builder.AppendLine();
builder.AppendLine(function);
}
// Entry point
builder.AppendLine();
builder.Append("[NumThreads(");
+9 -2
ファイルの表示
@@ -25,7 +25,7 @@ namespace ComputeSharp.Shaders.Translation
/// <summary>
/// The associated <see cref="IComputeShaderSourceAttribute"/> instance for the current shader type.
/// </summary>
private static IComputeShaderSourceAttribute Attribute = IComputeShaderSourceAttribute.GetForType<T>();
private static readonly IComputeShaderSourceAttribute Attribute = IComputeShaderSourceAttribute.GetForType<T>();
/// <summary>
/// The number of constant buffers to define in the shader.
@@ -238,7 +238,14 @@ namespace ComputeSharp.Shaders.Translation
/// </summary>
private void LoadMethodSource()
{
EntryPoint = Attribute.Methods[nameof(IComputeShader.Execute)];
foreach (var method in Attribute.Methods)
{
switch (method.Key)
{
case nameof(IComputeShader.Execute): EntryPoint = method.Value; break;
default: this.localFunctionsInfo.Add(method.Value); break;
}
}
}
}
}