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

Author: Caio Oliveira <[email protected]>
Date:   Thu Dec 14 22:14:03 2023 -0800

intel/compiler: Use glsl_type C helpers

Reviewed-by: Jesse Natalie <[email protected]>
Acked-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26707>

---

 src/intel/compiler/brw_mesh.cpp         |  6 +++---
 src/intel/compiler/brw_vec4.cpp         |  2 +-
 src/intel/compiler/brw_vec4_gs_nir.cpp  |  2 +-
 src/intel/compiler/brw_vec4_nir.cpp     |  4 ++--
 src/intel/compiler/brw_vec4_visitor.cpp | 12 ++++++------
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/intel/compiler/brw_mesh.cpp b/src/intel/compiler/brw_mesh.cpp
index 8d88d929d7f..66a02b2275e 100644
--- a/src/intel/compiler/brw_mesh.cpp
+++ b/src/intel/compiler/brw_mesh.cpp
@@ -1333,9 +1333,9 @@ brw_can_pack_primitive_indices(nir_shader *nir, struct 
index_packing_state *stat
       return true;
 
    ASSERTED const struct glsl_type *type = state->original_prim_indices->type;
-   assert(type->is_array());
-   assert(type->without_array()->is_vector());
-   assert(type->without_array()->vector_elements == 
state->vertices_per_primitive);
+   assert(glsl_type_is_array(type));
+   assert(glsl_type_is_vector(glsl_without_array(type)));
+   assert(glsl_without_array(type)->vector_elements == 
state->vertices_per_primitive);
 
    nir_foreach_function_impl(impl, nir) {
       nir_foreach_block(block, impl) {
diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp
index 63ab52143f4..631050f31e3 100644
--- a/src/intel/compiler/brw_vec4.cpp
+++ b/src/intel/compiler/brw_vec4.cpp
@@ -53,7 +53,7 @@ src_reg::src_reg(enum brw_reg_file file, int nr, const 
glsl_type *type)
 
    this->file = file;
    this->nr = nr;
-   if (type && (type->is_scalar() || type->is_vector() || type->is_matrix()))
+   if (type && (glsl_type_is_scalar(type) || glsl_type_is_vector(type) || 
glsl_type_is_matrix(type)))
       this->swizzle = brw_swizzle_for_size(type->vector_elements);
    else
       this->swizzle = BRW_SWIZZLE_XYZW;
diff --git a/src/intel/compiler/brw_vec4_gs_nir.cpp 
b/src/intel/compiler/brw_vec4_gs_nir.cpp
index 818688de4e5..60b42da87b9 100644
--- a/src/intel/compiler/brw_vec4_gs_nir.cpp
+++ b/src/intel/compiler/brw_vec4_gs_nir.cpp
@@ -43,7 +43,7 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr 
*instr)
       const unsigned input_array_stride = prog_data->urb_read_length * 2;
 
       /* Make up a type...we have no way of knowing... */
-      const glsl_type *const type = glsl_type::ivec(instr->num_components);
+      const glsl_type *const type = glsl_ivec_type(instr->num_components);
 
       src = src_reg(ATTR, input_array_stride * vertex +
                     nir_intrinsic_base(instr) + offset_reg,
diff --git a/src/intel/compiler/brw_vec4_nir.cpp 
b/src/intel/compiler/brw_vec4_nir.cpp
index e72646d361c..9121f8e10f2 100644
--- a/src/intel/compiler/brw_vec4_nir.cpp
+++ b/src/intel/compiler/brw_vec4_nir.cpp
@@ -1908,13 +1908,13 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
          case nir_texop_samples_identical:
             coordinate = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_D,
                                      src_size);
-            coord_type = glsl_type::ivec(src_size);
+            coord_type = glsl_ivec_type(src_size);
             break;
 
          default:
             coordinate = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_F,
                                      src_size);
-            coord_type = glsl_type::vec(src_size);
+            coord_type = glsl_vec_type(src_size);
             break;
          }
          break;
diff --git a/src/intel/compiler/brw_vec4_visitor.cpp 
b/src/intel/compiler/brw_vec4_visitor.cpp
index f96c1891365..ea89b8b6200 100644
--- a/src/intel/compiler/brw_vec4_visitor.cpp
+++ b/src/intel/compiler/brw_vec4_visitor.cpp
@@ -582,10 +582,10 @@ type_size_xvec4(const struct glsl_type *type, bool 
as_vec4, bool bindless)
    case GLSL_TYPE_INT8:
    case GLSL_TYPE_UINT64:
    case GLSL_TYPE_INT64:
-      if (type->is_matrix()) {
-         const glsl_type *col_type = type->column_type();
+      if (glsl_type_is_matrix(type)) {
+         const glsl_type *col_type = glsl_get_column_type(type);
          unsigned col_slots =
-            (as_vec4 && col_type->is_dual_slot()) ? 2 : 1;
+            (as_vec4 && glsl_type_is_dual_slot(col_type)) ? 2 : 1;
          return type->matrix_columns * col_slots;
       } else {
          /* Regardless of size of vector, it gets a vec4. This is bad
@@ -593,7 +593,7 @@ type_size_xvec4(const struct glsl_type *type, bool as_vec4, 
bool bindless)
           * mess.  Hopefully a later pass over the code can pack scalars
           * down if appropriate.
           */
-         return (as_vec4 && type->is_dual_slot()) ? 2 : 1;
+         return (as_vec4 && glsl_type_is_dual_slot(type)) ? 2 : 1;
       }
    case GLSL_TYPE_ARRAY:
       assert(type->length > 0);
@@ -677,7 +677,7 @@ src_reg::src_reg(class vec4_visitor *v, const struct 
glsl_type *type)
    this->file = VGRF;
    this->nr = v->alloc.allocate(type_size_vec4(type, false));
 
-   if (type->is_array() || type->is_struct()) {
+   if (glsl_type_is_array(type) || glsl_type_is_struct(type)) {
       this->swizzle = BRW_SWIZZLE_NOOP;
    } else {
       this->swizzle = brw_swizzle_for_size(type->vector_elements);
@@ -707,7 +707,7 @@ dst_reg::dst_reg(class vec4_visitor *v, const struct 
glsl_type *type)
    this->file = VGRF;
    this->nr = v->alloc.allocate(type_size_vec4(type, false));
 
-   if (type->is_array() || type->is_struct()) {
+   if (glsl_type_is_array(type) || glsl_type_is_struct(type)) {
       this->writemask = WRITEMASK_XYZW;
    } else {
       this->writemask = (1 << type->vector_elements) - 1;

Reply via email to