summaryrefslogtreecommitdiff
path: root/src/compiler/nir_types.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-02-11 22:04:14 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2016-02-13 17:22:36 -0800
commit7410c609882f490e62b86a261df860a56379be96 (patch)
tree113c271f599200347b14f0fc38d7dcbbdcc7c995 /src/compiler/nir_types.cpp
parentf05f576803caf939a420d559c78cbf40a455235f (diff)
nir/types: Add more type constructor functions
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/compiler/nir_types.cpp')
-rw-r--r--src/compiler/nir_types.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 2942810f43b..3669cfed360 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -250,18 +250,56 @@ glsl_vec4_type(void)
}
const glsl_type *
+glsl_int_type(void)
+{
+ return glsl_type::int_type;
+}
+
+const glsl_type *
glsl_uint_type(void)
{
return glsl_type::uint_type;
}
const glsl_type *
+glsl_bool_type(void)
+{
+ return glsl_type::bool_type;
+}
+
+const glsl_type *
+glsl_scalar_type(enum glsl_base_type base_type)
+{
+ return glsl_type::get_instance(base_type, 1, 1);
+}
+
+const glsl_type *
+glsl_vector_type(enum glsl_base_type base_type, unsigned components)
+{
+ assert(components > 1 && components <= 4);
+ return glsl_type::get_instance(base_type, components, 1);
+}
+
+const glsl_type *
+glsl_matrix_type(enum glsl_base_type base_type, unsigned rows, unsigned columns)
+{
+ assert(rows > 1 && rows <= 4 && columns >= 1 && columns <= 4);
+ return glsl_type::get_instance(base_type, rows, columns);
+}
+
+const glsl_type *
glsl_array_type(const glsl_type *base, unsigned elements)
{
return glsl_type::get_array_instance(base, elements);
}
const glsl_type *
+glsl_struct_type(const glsl_struct_field *fields,
+ unsigned num_fields, const char *name)
+{
+ return glsl_type::get_record_instance(fields, num_fields, name);
+}
+
const struct glsl_type *
glsl_sampler_type(enum glsl_sampler_dim dim, bool is_shadow, bool is_array,
enum glsl_base_type base_type)
@@ -288,3 +326,11 @@ glsl_function_type(const glsl_type *return_type,
{
return glsl_type::get_function_instance(return_type, params, num_params);
}
+
+const glsl_type *
+glsl_transposed_type(const struct glsl_type *type)
+{
+ assert(glsl_type_is_matrix(type));
+ return glsl_type::get_instance(type->base_type, type->matrix_columns,
+ type->vector_elements);
+}