From 582c20c431934d103821ba81b1fa32e57e9e21bb Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Thu, 14 Dec 2023 22:35:22 -0800 Subject: [PATCH] nir: Use glsl_type C helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jesse Natalie Acked-by: Marek Olšák Part-of: --- 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");