compiler/types: Remove use of references
authorCaio Oliveira <caio.oliveira@intel.com>
Wed, 27 Sep 2023 22:54:42 +0000 (15:54 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 28 Sep 2023 22:43:45 +0000 (22:43 +0000)
This is a preparation for moving compiler/types from C++ to C.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25445>

src/compiler/glsl_types.cpp

index b6c60f6..bf8ac07 100644 (file)
@@ -3302,8 +3302,8 @@ glsl_type::cl_alignment() const
 
       unsigned res = 1;
       for (unsigned i = 0; i < this->length; ++i) {
-         const struct glsl_struct_field &field = this->fields.structure[i];
-         res = MAX2(res, field.type->cl_alignment());
+         const struct glsl_struct_field *field = &this->fields.structure[i];
+         res = MAX2(res, field->type->cl_alignment());
       }
       return res;
    }
@@ -3323,14 +3323,14 @@ glsl_type::cl_size() const
       unsigned size = 0;
       unsigned max_alignment = 1;
       for (unsigned i = 0; i < this->length; ++i) {
-         const struct glsl_struct_field &field = this->fields.structure[i];
+         const struct glsl_struct_field *field = &this->fields.structure[i];
          /* if a struct is packed, members don't get aligned */
          if (!this->packed) {
-            unsigned alignment = field.type->cl_alignment();
+            unsigned alignment = field->type->cl_alignment();
             max_alignment = MAX2(max_alignment, alignment);
             size = align(size, alignment);
          }
-         size += field.type->cl_size();
+         size += field->type->cl_size();
       }
 
       /* Size of C structs are aligned to the biggest alignment of its fields */