diff --git a/src/ComputeSharp.Shaders/Renderer/HlslShaderRenderer.cs b/src/ComputeSharp.Shaders/Renderer/HlslShaderRenderer.cs
index be62d81b..82912f3b 100644
--- a/src/ComputeSharp.Shaders/Renderer/HlslShaderRenderer.cs
+++ b/src/ComputeSharp.Shaders/Renderer/HlslShaderRenderer.cs
@@ -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(");
diff --git a/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.cs b/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.cs
index fbb2076f..4ae7849b 100644
--- a/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.cs
+++ b/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.cs
@@ -25,7 +25,7 @@ namespace ComputeSharp.Shaders.Translation
///
/// The associated instance for the current shader type.
///
- private static IComputeShaderSourceAttribute Attribute = IComputeShaderSourceAttribute.GetForType();
+ private static readonly IComputeShaderSourceAttribute Attribute = IComputeShaderSourceAttribute.GetForType();
///
/// The number of constant buffers to define in the shader.
@@ -238,7 +238,14 @@ namespace ComputeSharp.Shaders.Translation
///
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;
+ }
+ }
}
}
}