From 22d281eee80cd72de35e9e6cbba98883e2c4e91c Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 4 Sep 2019 11:58:07 +0200 Subject: [PATCH] Added new template models for static functions --- .../Renderer/Models/Functions/FunctionInfo.cs | 66 +++++++++++++++++++ .../Models/Functions/ParameterInfo.cs | 36 ++++++++++ 2 files changed, 102 insertions(+) create mode 100644 src/ComputeSharp.Shaders/Renderer/Models/Functions/FunctionInfo.cs create mode 100644 src/ComputeSharp.Shaders/Renderer/Models/Functions/ParameterInfo.cs diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Functions/FunctionInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Functions/FunctionInfo.cs new file mode 100644 index 00000000..e0c38deb --- /dev/null +++ b/src/ComputeSharp.Shaders/Renderer/Models/Functions/FunctionInfo.cs @@ -0,0 +1,66 @@ +using System; +using ComputeSharp.Shaders.Extensions; + +namespace ComputeSharp.Shaders.Renderer.Models.Functions +{ + /// + /// A that contains info on a shader function + /// + internal class FunctionInfo + { + /// + /// Gets the return type of the current function in the C# source + /// + public string FunctionCsharpReturnType { get; } + + /// + /// Gets the fullname of the current function in the C# source + /// + public string FunctionFullName { get; } + + /// + /// Gets the parameters of the function in the C# source + /// + public string FunctionCsharpParameters { get; } + + /// + /// Gets the return type of the current function + /// + public string ReturnType { get; } + + /// + /// Gets the name of the current function + /// + public string FunctionName { get; } + + /// + /// Gets the body of the current function + /// + public string FunctionBody { get; } + + /// + /// Creates a new instance with the specified parameters + /// + /// The concrete return type for the function + /// The fullname of the function in the C# source + /// The parameters of the function in the C# source + /// The return type of the current function + /// The name of the current function + /// The current function + public FunctionInfo( + Type functionCsharpType, + string functionFullname, + string functionCsharpParameters, + string returnType, + string functionName, + string functionBody) + { + FunctionCsharpReturnType = functionCsharpType.ToFriendlyString(); + FunctionFullName = functionFullname; + FunctionCsharpParameters = functionCsharpParameters; + ReturnType = returnType; + FunctionName = functionName; + FunctionBody = functionBody; + } + } +} diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Functions/ParameterInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Functions/ParameterInfo.cs new file mode 100644 index 00000000..dce851ef --- /dev/null +++ b/src/ComputeSharp.Shaders/Renderer/Models/Functions/ParameterInfo.cs @@ -0,0 +1,36 @@ +namespace ComputeSharp.Shaders.Renderer.Models.Functions +{ + /// + /// A that contains info on a function parameter + /// + internal class ParameterInfo + { + /// + /// Gets the type of the current parameter + /// + public string ParameterType { get; } + + /// + /// Gets the name to use for the current parameter + /// + public string ParameterName { get; } + + /// + /// Gets whether or not the current parameter is the last one for the parent function + /// + public bool IsLastParameter { get; } + + /// + /// Creates a new instance with the specified parameters + /// + /// The type of the current parameter + /// The name of the current parameter + /// Indicates whether or not the current parameter is the last one + public ParameterInfo(string parameterType, string parameterName, bool last) + { + ParameterType = parameterType; + ParameterName = parameterName; + IsLastParameter = last; + } + } +}