Merge remote-tracking branch 'mesa-public/master' into vulkan
[mesa.git] / src / glsl / nir / nir_types.cpp
index 4a1250e546c70f3a87c4b045a3b9baf38e4fe121..f4408def9a000f0a28e54b758c7309586d8ec715 100644 (file)
@@ -124,6 +124,13 @@ glsl_get_aoa_size(const struct glsl_type *type)
    return type->arrays_of_arrays_size();
 }
 
+unsigned
+glsl_count_attribute_slots(const struct glsl_type *type,
+                           bool vertex_input_slots)
+{
+   return type->count_attribute_slots(vertex_input_slots);
+}
+
 const char *
 glsl_get_struct_elem_name(const struct glsl_type *type, unsigned index)
 {
@@ -133,14 +140,14 @@ glsl_get_struct_elem_name(const struct glsl_type *type, unsigned index)
 glsl_sampler_dim
 glsl_get_sampler_dim(const struct glsl_type *type)
 {
-   assert(glsl_type_is_sampler(type));
+   assert(glsl_type_is_sampler(type) || glsl_type_is_image(type));
    return (glsl_sampler_dim)type->sampler_dimensionality;
 }
 
 glsl_base_type
 glsl_get_sampler_result_type(const struct glsl_type *type)
 {
-   assert(glsl_type_is_sampler(type));
+   assert(glsl_type_is_sampler(type) || glsl_type_is_image(type));
    return (glsl_base_type)type->sampler_type;
 }
 
@@ -157,6 +164,12 @@ glsl_type_is_void(const glsl_type *type)
    return type->is_void();
 }
 
+bool
+glsl_type_is_error(const glsl_type *type)
+{
+   return type->is_error();
+}
+
 bool
 glsl_type_is_vector(const struct glsl_type *type)
 {
@@ -199,6 +212,12 @@ glsl_type_is_sampler(const struct glsl_type *type)
    return type->is_sampler();
 }
 
+bool
+glsl_type_is_image(const struct glsl_type *type)
+{
+   return type->is_image();
+}
+
 bool
 glsl_sampler_type_is_shadow(const struct glsl_type *type)
 {
@@ -209,7 +228,7 @@ glsl_sampler_type_is_shadow(const struct glsl_type *type)
 bool
 glsl_sampler_type_is_array(const struct glsl_type *type)
 {
-   assert(glsl_type_is_sampler(type));
+   assert(glsl_type_is_sampler(type) || glsl_type_is_image(type));
    return type->sampler_array;
 }
 
@@ -225,6 +244,18 @@ glsl_float_type(void)
    return glsl_type::float_type;
 }
 
+const glsl_type *
+glsl_vec_type(unsigned n)
+{
+   return glsl_type::vec(n);
+}
+
+const glsl_type *
+glsl_vec4_type(void)
+{
+   return glsl_type::vec4_type;
+}
+
 const glsl_type *
 glsl_int_type(void)
 {
@@ -243,12 +274,6 @@ glsl_bool_type(void)
    return glsl_type::bool_type;
 }
 
-const glsl_type *
-glsl_vec4_type(void)
-{
-   return glsl_type::vec4_type;
-}
-
 const glsl_type *
 glsl_scalar_type(enum glsl_base_type base_type)
 {
@@ -289,6 +314,13 @@ glsl_sampler_type(enum glsl_sampler_dim dim, bool is_shadow, bool is_array,
    return glsl_type::get_sampler_instance(dim, is_shadow, is_array, base_type);
 }
 
+const struct glsl_type *
+glsl_image_type(enum glsl_sampler_dim dim, bool is_array,
+                enum glsl_base_type base_type)
+{
+   return glsl_type::get_image_instance(dim, is_array, base_type);
+}
+
 const glsl_type *
 glsl_function_type(const glsl_type *return_type,
                    const glsl_function_param *params, unsigned num_params)