public ShaderFunction Build() { if (finalized) { return(new ShaderFunction(Container, functionHandle)); } finalized = true; FoundryHandle parentBlockHandle = parentBlockBuilder?.blockHandle ?? FoundryHandle.Invalid(); var returnTypeHandle = container.AddShaderType(returnType, true); var builtFunction = new ShaderFunction(container, functionHandle, name, ConvertToString(), returnTypeHandle, parameters, parentBlockHandle); if (parentBlockBuilder != null) { // Register the new function with the parent block parentBlockBuilder.AddFunction(builtFunction); } return(builtFunction); }