summaryrefslogtreecommitdiff
path: root/src/compiler/nir_types.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-02-11 21:54:55 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2016-02-13 17:22:36 -0800
commitd140b13fd54bedff9f961b891c6904bf106ced0e (patch)
tree86f7fb16dc1fced71d645146abc13e701a556c31 /src/compiler/nir_types.cpp
parentb9e94ad8060348faf40ba30722148b5c7e865a1c (diff)
nir/types: Add helpers for function types
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/compiler/nir_types.cpp')
-rw-r--r--src/compiler/nir_types.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index a87dcd8dc6a..17950ccb5f9 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -70,6 +70,18 @@ glsl_get_struct_field(const glsl_type *type, unsigned index)
return type->fields.structure[index].type;
}
+const glsl_type *
+glsl_get_function_return_type(const glsl_type *type)
+{
+ return type->fields.parameters[0].type;
+}
+
+const glsl_function_param *
+glsl_get_function_param(const glsl_type *type, unsigned index)
+{
+ return &type->fields.parameters[index + 1];
+}
+
const struct glsl_type *
glsl_get_column_type(const struct glsl_type *type)
{
@@ -190,3 +202,10 @@ glsl_array_type(const glsl_type *base, unsigned elements)
{
return glsl_type::get_array_instance(base, elements);
}
+
+const glsl_type *
+glsl_function_type(const glsl_type *return_type,
+ const glsl_function_param *params, unsigned num_params)
+{
+ return glsl_type::get_function_instance(return_type, params, num_params);
+}