aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-10-30 16:49:32 -0700
committerEric Anholt <[email protected]>2015-01-29 11:41:17 -0800
commit36c604c8246ecbd50ee4d7d685201822973df5ec (patch)
tree643ee93b506d2128426d4383262730deecec7b77 /src/glsl
parent765cfe9a90b6d592b232d1647d65d50c983bea2f (diff)
nir: Add a couple of helpers for glsl types.
This will be used by tgsi_to_nir, which needs to get vec4 types for declaring shader input/output variables. v2: Add a missing space. Reviewed-by: Matt Turner <[email protected]> (v2) Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir_types.cpp14
-rw-r--r--src/glsl/nir/nir_types.h3
2 files changed, 16 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_types.cpp b/src/glsl/nir/nir_types.cpp
index fe0001592d1..a13c3e12a86 100644
--- a/src/glsl/nir/nir_types.cpp
+++ b/src/glsl/nir/nir_types.cpp
@@ -136,8 +136,20 @@ glsl_type_is_matrix(const struct glsl_type *type)
return type->is_matrix();
}
-const glsl_type*
+const glsl_type *
glsl_void_type(void)
{
return glsl_type::void_type;
}
+
+const glsl_type *
+glsl_vec4_type(void)
+{
+ return glsl_type::vec4_type;
+}
+
+const glsl_type *
+glsl_array_type(const glsl_type *base, unsigned elements)
+{
+ return glsl_type::get_array_instance(base, elements);
+}
diff --git a/src/glsl/nir/nir_types.h b/src/glsl/nir/nir_types.h
index 6f91e2dce8d..494051a6755 100644
--- a/src/glsl/nir/nir_types.h
+++ b/src/glsl/nir/nir_types.h
@@ -69,6 +69,9 @@ bool glsl_type_is_scalar(const struct glsl_type *type);
bool glsl_type_is_matrix(const struct glsl_type *type);
const struct glsl_type *glsl_void_type(void);
+const struct glsl_type *glsl_vec4_type(void);
+const struct glsl_type *glsl_array_type(const struct glsl_type *base,
+ unsigned elements);
#ifdef __cplusplus
}