glsl: make use of glsl_type::is_array()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 21 Apr 2017 08:25:42 +0000 (10:25 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 21 Apr 2017 17:33:32 +0000 (19:33 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/ir_print_visitor.cpp
src/compiler/glsl/link_varyings.cpp
src/compiler/glsl/tests/uniform_initializer_utils.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 88fff861cc564681cc4058dcc6165f73a3a38406..a4a687f687dd9508caf9a32896a8259eaf18c24a 100644 (file)
@@ -4712,7 +4712,7 @@ ast_declarator_list::hir(exec_list *instructions,
                           "invalid type `%s' in empty declaration",
                           type_name);
       } else {
-         if (decl_type->base_type == GLSL_TYPE_ARRAY) {
+         if (decl_type->is_array()) {
             /* From Section 13.22 (Array Declarations) of the GLSL ES 3.2
              * spec:
              *
index 1c84c1be16e1a350a86195ddc2f47d178dcb7759..0a39459c9256e883fd426198485d0c303c54009f 100644 (file)
@@ -145,7 +145,7 @@ ir_print_visitor::unique_name(ir_variable *var)
 static void
 print_type(FILE *f, const glsl_type *t)
 {
-   if (t->base_type == GLSL_TYPE_ARRAY) {
+   if (t->is_array()) {
       fprintf(f, "(array ");
       print_type(f, t->fields.array);
       fprintf(f, " %u)", t->length);
index f0df3d60a5cd1752e011ac3cf30cd642c3f56840..e6947692affd2a5e5bc349733c883b6f0ce8cf29 100644 (file)
@@ -1678,7 +1678,7 @@ varying_matches::compute_packing_order(const ir_variable *var)
 {
    const glsl_type *element_type = var->type;
 
-   while (element_type->base_type == GLSL_TYPE_ARRAY) {
+   while (element_type->is_array()) {
       element_type = element_type->fields.array;
    }
 
index 2a1a16839b889cfa2fabf000eea2743974821408..9a66ebafbcd108cd9320b8100210114ca330ee5b 100644 (file)
@@ -214,7 +214,7 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size,
             ir_constant *val, unsigned red_zone_size,
             unsigned int boolean_true)
 {
-   if (val->type->base_type == GLSL_TYPE_ARRAY) {
+   if (val->type->is_array()) {
       const glsl_type *const element_type = val->array_elements[0]->type;
 
       for (unsigned i = 0; i < storage_array_size; i++) {
index 96c08a64f31ab677febf564adf740c8229a0238f..9a19167faa03929d5509e075edfb7f638fa6c547 100644 (file)
@@ -4246,7 +4246,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
       component = this->result;
       if (ir->offset) {
          ir->offset->accept(this);
-         if (ir->offset->type->base_type == GLSL_TYPE_ARRAY) {
+         if (ir->offset->type->is_array()) {
             const glsl_type *elt_type = ir->offset->type->fields.array;
             for (i = 0; i < ir->offset->type->length; i++) {
                offset[i] = this->result;