[Mesa-dev] [PATCH 1/3] nir: Add a couple of helpers for glsl types.

Eric Anholt eric at anholt.net
Wed Jan 28 17:08:20 PST 2015


This will be used by tgsi_to_nir, which needs to get vec4 types for
declaring shader input/output variables.
---
 src/glsl/nir/nir_types.cpp | 12 ++++++++++++
 src/glsl/nir/nir_types.h   |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/src/glsl/nir/nir_types.cpp b/src/glsl/nir/nir_types.cpp
index fe00015..60760a2 100644
--- a/src/glsl/nir/nir_types.cpp
+++ b/src/glsl/nir/nir_types.cpp
@@ -141,3 +141,15 @@ 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 6f91e2d..494051a 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
 }
-- 
2.1.4



More information about the mesa-dev mailing list