Module: Mesa
Branch: main
Commit: 4a8918f7e12008a1da3fe3eb37e5f932ce436670
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a8918f7e12008a1da3fe3eb37e5f932ce436670

Author: Caio Oliveira <[email protected]>
Date:   Wed Sep 27 15:54:42 2023 -0700

compiler/types: Remove use of references

This is a preparation for moving compiler/types from C++ to C.

Reviewed-by: Adam Jackson <[email protected]>
Reviewed-by: Emma Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25445>

---

 src/compiler/glsl_types.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index b6c60f69216..bf8ac079acc 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -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 
*/

Reply via email to