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

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

nir: 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/compiler/nir/tests/builder_tests.cpp |  8 ++++----
 src/compiler/nir/tests/vars_tests.cpp    | 31 +++++++++++++------------------
 2 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/src/compiler/nir/tests/builder_tests.cpp 
b/src/compiler/nir/tests/builder_tests.cpp
index 576f430266f..91dd9ae28ac 100644
--- a/src/compiler/nir/tests/builder_tests.cpp
+++ b/src/compiler/nir/tests/builder_tests.cpp
@@ -30,10 +30,10 @@ private:
    const glsl_type *type_for_def(nir_def *def)
    {
       switch (def->bit_size) {
-      case 8:  return glsl_type::u8vec(def->num_components);
-      case 16: return glsl_type::u16vec(def->num_components);
-      case 32: return glsl_type::uvec(def->num_components);
-      case 64: return glsl_type::u64vec(def->num_components);
+      case 8:  return glsl_u8vec_type(def->num_components);
+      case 16: return glsl_u16vec_type(def->num_components);
+      case 32: return glsl_uvec_type(def->num_components);
+      case 64: return glsl_u64vec_type(def->num_components);
       default: unreachable("Invalid bit size");
       }
    }
diff --git a/src/compiler/nir/tests/vars_tests.cpp 
b/src/compiler/nir/tests/vars_tests.cpp
index 3ff1cc43bd7..e7235b20d69 100644
--- a/src/compiler/nir/tests/vars_tests.cpp
+++ b/src/compiler/nir/tests/vars_tests.cpp
@@ -1302,9 +1302,8 @@ TEST_F(nir_copy_prop_vars_test, restrict_ssbo_bindings)
    field.type = glsl_int_type();
    field.name = "x";
    const glsl_type *ifc_type =
-      glsl_type::get_interface_instance(&field, 1,
-                                        GLSL_INTERFACE_PACKING_STD430,
-                                        false /* row_major */, "b");
+      glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430,
+                          false /* row_major */, "b");
    nir_variable *ssbo0 = create_var(nir_var_mem_ssbo, ifc_type, "ssbo0");
    nir_variable *ssbo1 = create_var(nir_var_mem_ssbo, ifc_type, "ssbo1");
    ssbo0->data.access = ssbo1->data.access = ACCESS_RESTRICT;
@@ -1347,9 +1346,8 @@ TEST_F(nir_copy_prop_vars_test, aliasing_ssbo_bindings)
    field.type = glsl_int_type();
    field.name = "x";
    const glsl_type *ifc_type =
-      glsl_type::get_interface_instance(&field, 1,
-                                        GLSL_INTERFACE_PACKING_STD430,
-                                        false /* row_major */, "b");
+      glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430,
+                          false /* row_major */, "b");
    nir_variable *ssbo0 = create_var(nir_var_mem_ssbo, ifc_type, "ssbo0");
    nir_variable *ssbo1 = create_var(nir_var_mem_ssbo, ifc_type, "ssbo1");
    nir_variable *out = create_var(nir_var_mem_ssbo, ifc_type, "out");
@@ -1386,10 +1384,9 @@ TEST_F(nir_copy_prop_vars_test, 
ssbo_array_binding_indirect)
    field.type = glsl_int_type();
    field.name = "x";
    const glsl_type *ifc_type =
-      glsl_type::get_interface_instance(&field, 1,
-                                        GLSL_INTERFACE_PACKING_STD430,
-                                        false /* row_major */, "b");
-   const glsl_type *arr_ifc_type = glsl_type::get_array_instance(ifc_type, 2);
+      glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430,
+                          false /* row_major */, "b");
+   const glsl_type *arr_ifc_type = glsl_array_type(ifc_type, 2, 0);
    nir_variable *ssbo_arr = create_var(nir_var_mem_ssbo, arr_ifc_type,
                                        "ssbo_arr");
    ssbo_arr->data.access = ACCESS_RESTRICT;
@@ -1430,10 +1427,9 @@ TEST_F(nir_copy_prop_vars_test, 
restrict_ssbo_array_binding)
    field.type = glsl_int_type();
    field.name = "x";
    const glsl_type *ifc_type =
-      glsl_type::get_interface_instance(&field, 1,
-                                        GLSL_INTERFACE_PACKING_STD430,
-                                        false /* row_major */, "b");
-   const glsl_type *arr_ifc_type = glsl_type::get_array_instance(ifc_type, 2);
+      glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430,
+                          false /* row_major */, "b");
+   const glsl_type *arr_ifc_type = glsl_array_type(ifc_type, 2, 0);
    nir_variable *ssbo_arr = create_var(nir_var_mem_ssbo, arr_ifc_type,
                                        "ssbo_arr");
    ssbo_arr->data.access = ACCESS_RESTRICT;
@@ -1478,10 +1474,9 @@ TEST_F(nir_copy_prop_vars_test, 
aliasing_ssbo_array_binding)
    field.type = glsl_int_type();
    field.name = "x";
    const glsl_type *ifc_type =
-      glsl_type::get_interface_instance(&field, 1,
-                                        GLSL_INTERFACE_PACKING_STD430,
-                                        false /* row_major */, "b");
-   const glsl_type *arr_ifc_type = glsl_type::get_array_instance(ifc_type, 2);
+      glsl_interface_type(&field, 1, GLSL_INTERFACE_PACKING_STD430,
+                          false /* row_major */, "b");
+   const glsl_type *arr_ifc_type = glsl_array_type(ifc_type, 2, 0);
    nir_variable *ssbo_arr = create_var(nir_var_mem_ssbo, arr_ifc_type,
                                        "ssbo_arr");
    nir_variable *out = create_var(nir_var_mem_ssbo, ifc_type, "out");

Reply via email to