From 54522d05065d6ff1b37005c91e503b4d4f11ed67 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 5 Mar 2019 16:07:12 +1100 Subject: [PATCH] nir: rename glsl_type_is_struct() -> glsl_type_is_struct_or_ifc() Replace done using: find ./src -type f -exec sed -i -- \ 's/glsl_type_is_struct(/glsl_type_is_struct_or_ifc(/g' {} \; Acked-by: Karol Herbst Acked-by: Jason Ekstrand Acked-by: Kenneth Graunke --- src/amd/common/ac_nir_to_llvm.c | 2 +- src/amd/vulkan/radv_nir_to_llvm.c | 2 +- src/compiler/glsl/gl_nir_link_uniform_initializers.c | 4 ++-- src/compiler/glsl/gl_nir_link_uniforms.c | 10 +++++----- src/compiler/glsl/gl_nir_link_xfb.c | 2 +- src/compiler/nir/nir_builder.h | 4 ++-- src/compiler/nir/nir_deref.c | 2 +- src/compiler/nir/nir_gather_info.c | 4 ++-- src/compiler/nir/nir_gather_xfb_info.c | 4 ++-- src/compiler/nir/nir_linking_helpers.c | 2 +- src/compiler/nir/nir_lower_constant_initializers.c | 2 +- src/compiler/nir/nir_lower_io_arrays_to_elements.c | 2 +- src/compiler/nir/nir_lower_io_to_scalar.c | 2 +- src/compiler/nir/nir_lower_vars_to_ssa.c | 2 +- src/compiler/nir/nir_split_per_member_structs.c | 2 +- src/compiler/nir/nir_split_var_copies.c | 2 +- src/compiler/nir/nir_split_vars.c | 6 +++--- src/compiler/nir/nir_validate.c | 4 ++-- src/compiler/nir_types.cpp | 2 +- src/compiler/nir_types.h | 2 +- src/compiler/spirv/vtn_alu.c | 8 ++++---- src/compiler/spirv/vtn_glsl450.c | 4 ++-- src/compiler/spirv/vtn_variables.c | 8 ++++---- src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp | 4 ++-- src/mesa/state_tracker/st_glsl_to_nir.cpp | 4 ++-- 25 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 96dd9c4b96c..4598eeccb20 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3975,7 +3975,7 @@ glsl_to_llvm_type(struct ac_llvm_context *ac, glsl_get_length(type)); } - assert(glsl_type_is_struct(type)); + assert(glsl_type_is_struct_or_ifc(type)); LLVMTypeRef member_types[glsl_get_length(type)]; diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index a589ff41559..20371759a97 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -2268,7 +2268,7 @@ static void mark_16bit_fs_input(struct radv_shader_context *ctx, mark_16bit_fs_input(ctx, glsl_get_array_element(type), location + i * stride); } } else { - assert(glsl_type_is_struct(type)); + assert(glsl_type_is_struct_or_ifc(type)); for (unsigned i = 0; i < glsl_get_length(type); i++) { mark_16bit_fs_input(ctx, glsl_get_struct_field(type, i), location); location += glsl_count_attribute_slots(glsl_get_struct_field(type, i), false); diff --git a/src/compiler/glsl/gl_nir_link_uniform_initializers.c b/src/compiler/glsl/gl_nir_link_uniform_initializers.c index 8eefa71c885..6e38d01269e 100644 --- a/src/compiler/glsl/gl_nir_link_uniform_initializers.c +++ b/src/compiler/glsl/gl_nir_link_uniform_initializers.c @@ -184,7 +184,7 @@ set_uniform_initializer(struct set_uniform_initializer_closure *data, { const struct glsl_type *t_without_array = glsl_without_array(type); - if (glsl_type_is_struct(type)) { + if (glsl_type_is_struct_or_ifc(type)) { for (unsigned int i = 0; i < glsl_get_length(type); i++) { const struct glsl_type *field_type = glsl_get_struct_field(type, i); set_uniform_initializer(data, field_type, val->elements[i]); @@ -192,7 +192,7 @@ set_uniform_initializer(struct set_uniform_initializer_closure *data, return; } - if (glsl_type_is_struct(t_without_array) || + if (glsl_type_is_struct_or_ifc(t_without_array) || (glsl_type_is_array(type) && glsl_type_is_array(glsl_get_array_element(type)))) { const struct glsl_type *element_type = glsl_get_array_element(type); diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index 1a491dc2e5d..e4924df0d03 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -204,7 +204,7 @@ build_type_tree_for_type(const struct glsl_type *type) entry->array_size = glsl_get_length(type); entry->children = build_type_tree_for_type(glsl_get_array_element(type)); entry->children->parent = entry; - } else if (glsl_type_is_struct(type)) { + } else if (glsl_type_is_struct_or_ifc(type)) { struct type_tree_entry *last = NULL; for (unsigned i = 0; i < glsl_get_length(type); i++) { @@ -291,10 +291,10 @@ nir_link_uniform(struct gl_context *ctx, * composite type or an array where each element occupies more than one * location than we need to recursively process it. */ - if (glsl_type_is_struct(type) || + if (glsl_type_is_struct_or_ifc(type) || (glsl_type_is_array(type) && (glsl_type_is_array(glsl_get_array_element(type)) || - glsl_type_is_struct(glsl_get_array_element(type))))) { + glsl_type_is_struct_or_ifc(glsl_get_array_element(type))))) { int location_count = 0; struct type_tree_entry *old_type = state->current_type; @@ -303,7 +303,7 @@ nir_link_uniform(struct gl_context *ctx, for (unsigned i = 0; i < glsl_get_length(type); i++) { const struct glsl_type *field_type; - if (glsl_type_is_struct(type)) + if (glsl_type_is_struct_or_ifc(type)) field_type = glsl_get_struct_field(type, i); else field_type = glsl_get_array_element(type); @@ -318,7 +318,7 @@ nir_link_uniform(struct gl_context *ctx, location += entries; location_count += entries; - if (glsl_type_is_struct(type)) + if (glsl_type_is_struct_or_ifc(type)) state->current_type = state->current_type->next_sibling; } diff --git a/src/compiler/glsl/gl_nir_link_xfb.c b/src/compiler/glsl/gl_nir_link_xfb.c index bcef1e1863d..f75c99ca852 100644 --- a/src/compiler/glsl/gl_nir_link_xfb.c +++ b/src/compiler/glsl/gl_nir_link_xfb.c @@ -148,7 +148,7 @@ add_varying_outputs(nir_variable *var, location_offset += child_outputs; dest_offset += component_slots; } - } else if (glsl_type_is_struct(type)) { + } else if (glsl_type_is_struct_or_ifc(type)) { unsigned length = glsl_get_length(type); for (unsigned i = 0; i < length; i++) { const struct glsl_type *child_type = glsl_get_struct_field(type, i); diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 253ca5941cb..43edf0a9d36 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -871,7 +871,7 @@ static inline nir_deref_instr * nir_build_deref_struct(nir_builder *build, nir_deref_instr *parent, unsigned index) { - assert(glsl_type_is_struct(parent->type)); + assert(glsl_type_is_struct_or_ifc(parent->type)); nir_deref_instr *deref = nir_deref_instr_create(build->shader, nir_deref_type_struct); @@ -950,7 +950,7 @@ nir_build_deref_follower(nir_builder *b, nir_deref_instr *parent, } case nir_deref_type_struct: - assert(glsl_type_is_struct(parent->type)); + assert(glsl_type_is_struct_or_ifc(parent->type)); assert(glsl_get_length(parent->type) == glsl_get_length(leader_parent->type)); diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c index 7b56611915d..752bd7f8673 100644 --- a/src/compiler/nir/nir_deref.c +++ b/src/compiler/nir/nir_deref.c @@ -152,7 +152,7 @@ struct_type_get_field_offset(const struct glsl_type *struct_type, glsl_type_size_align_func size_align, unsigned field_idx) { - assert(glsl_type_is_struct(struct_type)); + assert(glsl_type_is_struct_or_ifc(struct_type)); unsigned offset = 0; for (unsigned i = 0; i <= field_idx; i++) { unsigned elem_size, elem_align; diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 19438912ff0..f2a209028cc 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -340,7 +340,7 @@ glsl_type_get_sampler_count(const struct glsl_type *type) glsl_type_get_sampler_count(glsl_without_array(type))); } - if (glsl_type_is_struct(type)) { + if (glsl_type_is_struct_or_ifc(type)) { unsigned count = 0; for (int i = 0; i < glsl_get_length(type); i++) count += glsl_type_get_sampler_count(glsl_get_struct_field(type, i)); @@ -361,7 +361,7 @@ glsl_type_get_image_count(const struct glsl_type *type) glsl_type_get_image_count(glsl_without_array(type))); } - if (glsl_type_is_struct(type)) { + if (glsl_type_is_struct_or_ifc(type)) { unsigned count = 0; for (int i = 0; i < glsl_get_length(type); i++) count += glsl_type_get_image_count(glsl_get_struct_field(type, i)); diff --git a/src/compiler/nir/nir_gather_xfb_info.c b/src/compiler/nir/nir_gather_xfb_info.c index ee0546ed39f..c06a7667ab8 100644 --- a/src/compiler/nir/nir_gather_xfb_info.c +++ b/src/compiler/nir/nir_gather_xfb_info.c @@ -42,7 +42,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb, const struct glsl_type *child_type = glsl_get_array_element(type); for (unsigned i = 0; i < length; i++) add_var_xfb_outputs(xfb, var, buffer, location, offset, child_type); - } else if (glsl_type_is_struct(type)) { + } else if (glsl_type_is_struct_or_ifc(type)) { unsigned length = glsl_get_length(type); for (unsigned i = 0; i < length; i++) { const struct glsl_type *child_type = glsl_get_struct_field(type, i); @@ -154,7 +154,7 @@ nir_gather_xfb_info(const nir_shader *shader, void *mem_ctx) add_var_xfb_outputs(xfb, var, var->data.xfb_buffer, &location, &offset, var->type); } else if (is_array_block) { - assert(glsl_type_is_struct(var->interface_type)); + assert(glsl_type_is_struct_or_ifc(var->interface_type)); unsigned aoa_size = glsl_get_aoa_size(var->type); const struct glsl_type *itype = var->interface_type; diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index b387d104d58..02b5ae4b066 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -768,7 +768,7 @@ can_replace_varying(nir_variable *out_var) if (glsl_type_is_array(out_var->type) || glsl_type_is_dual_slot(out_var->type) || glsl_type_is_matrix(out_var->type) || - glsl_type_is_struct(out_var->type)) + glsl_type_is_struct_or_ifc(out_var->type)) return false; /* Limit this pass to scalars for now to keep things simple. Most varyings diff --git a/src/compiler/nir/nir_lower_constant_initializers.c b/src/compiler/nir/nir_lower_constant_initializers.c index f165f220f43..e09eacea033 100644 --- a/src/compiler/nir/nir_lower_constant_initializers.c +++ b/src/compiler/nir/nir_lower_constant_initializers.c @@ -47,7 +47,7 @@ build_constant_load(nir_builder *b, nir_deref_instr *deref, nir_constant *c) nir_store_deref(b, nir_build_deref_array(b, deref, nir_imm_int(b, i)), &load->def, ~0); } - } else if (glsl_type_is_struct(deref->type)) { + } else if (glsl_type_is_struct_or_ifc(deref->type)) { unsigned len = glsl_get_length(deref->type); for (unsigned i = 0; i < len; i++) { build_constant_load(b, nir_build_deref_struct(b, deref, i), diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c index 5fbde081476..7f548c8b654 100644 --- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c +++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c @@ -318,7 +318,7 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask, * TODO: Add support for struct splitting. */ if ((!glsl_type_is_array(type) && !glsl_type_is_matrix(type))|| - glsl_type_is_struct(glsl_without_array(type))) + glsl_type_is_struct_or_ifc(glsl_without_array(type))) continue; /* Skip builtins */ diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c index 60fd61e006c..559d80b214a 100644 --- a/src/compiler/nir/nir_lower_io_to_scalar.c +++ b/src/compiler/nir/nir_lower_io_to_scalar.c @@ -341,7 +341,7 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask) /* Skip types we cannot split */ if (glsl_type_is_matrix(glsl_without_array(var->type)) || - glsl_type_is_struct(glsl_without_array(var->type))) + glsl_type_is_struct_or_ifc(glsl_without_array(var->type))) continue; switch (intr->intrinsic) { diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 065280fb9b8..1e7dc8d3579 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -150,7 +150,7 @@ get_deref_node_recur(nir_deref_instr *deref, switch (deref->deref_type) { case nir_deref_type_struct: - assert(glsl_type_is_struct(parent->type)); + assert(glsl_type_is_struct_or_ifc(parent->type)); assert(deref->strct.index < glsl_get_length(parent->type)); if (parent->children[deref->strct.index] == NULL) { diff --git a/src/compiler/nir/nir_split_per_member_structs.c b/src/compiler/nir/nir_split_per_member_structs.c index 1c148d3d63e..c4de52d1461 100644 --- a/src/compiler/nir/nir_split_per_member_structs.c +++ b/src/compiler/nir/nir_split_per_member_structs.c @@ -53,7 +53,7 @@ member_type(const struct glsl_type *type, unsigned index) assert(glsl_get_explicit_stride(type) == 0); return glsl_array_type(elem, glsl_get_length(type), 0); } else { - assert(glsl_type_is_struct(type)); + assert(glsl_type_is_struct_or_ifc(type)); assert(index < glsl_get_length(type)); return glsl_get_struct_field(type, index); } diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c index 6260a8d7bfa..24d573fd235 100644 --- a/src/compiler/nir/nir_split_var_copies.c +++ b/src/compiler/nir/nir_split_var_copies.c @@ -69,7 +69,7 @@ split_deref_copy_instr(nir_builder *b, assert(dst->type == src->type); if (glsl_type_is_vector_or_scalar(src->type)) { nir_copy_deref(b, dst, src); - } else if (glsl_type_is_struct(src->type)) { + } else if (glsl_type_is_struct_or_ifc(src->type)) { for (unsigned i = 0; i < glsl_get_length(src->type); i++) { split_deref_copy_instr(b, nir_build_deref_struct(b, dst, i), nir_build_deref_struct(b, src, i)); diff --git a/src/compiler/nir/nir_split_vars.c b/src/compiler/nir/nir_split_vars.c index 96b6042e6d9..df059276411 100644 --- a/src/compiler/nir/nir_split_vars.c +++ b/src/compiler/nir/nir_split_vars.c @@ -91,7 +91,7 @@ init_field_for_type(struct field *field, struct field *parent, }; const struct glsl_type *struct_type = glsl_without_array(type); - if (glsl_type_is_struct(struct_type)) { + if (glsl_type_is_struct_or_ifc(struct_type)) { field->num_fields = glsl_get_length(struct_type), field->fields = ralloc_array(state->mem_ctx, struct field, field->num_fields); @@ -143,7 +143,7 @@ split_var_list_structs(nir_shader *shader, * pull all of the variables we plan to split off of the list */ nir_foreach_variable_safe(var, vars) { - if (!glsl_type_is_struct(glsl_without_array(var->type))) + if (!glsl_type_is_struct_or_ifc(glsl_without_array(var->type))) continue; exec_node_remove(&var->node); @@ -205,7 +205,7 @@ split_struct_derefs_impl(nir_function_impl *impl, continue; assert(i > 0); - assert(glsl_type_is_struct(path.path[i - 1]->type)); + assert(glsl_type_is_struct_or_ifc(path.path[i - 1]->type)); assert(path.path[i - 1]->type == glsl_without_array(tail_field->type)); diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 17633323dc3..7150649bcef 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -437,7 +437,7 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state) switch (instr->deref_type) { case nir_deref_type_struct: - validate_assert(state, glsl_type_is_struct(parent->type)); + validate_assert(state, glsl_type_is_struct_or_ifc(parent->type)); validate_assert(state, instr->strct.index < glsl_get_length(parent->type)); validate_assert(state, instr->type == @@ -1017,7 +1017,7 @@ validate_var_decl(nir_variable *var, bool is_global, validate_state *state) if (var->num_members > 0) { const struct glsl_type *without_array = glsl_without_array(var->type); - validate_assert(state, glsl_type_is_struct(without_array)); + validate_assert(state, glsl_type_is_struct_or_ifc(without_array)); validate_assert(state, var->num_members == glsl_get_length(without_array)); validate_assert(state, var->members != NULL); } diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp index 89028dcaf3d..3dd233d8edb 100644 --- a/src/compiler/nir_types.cpp +++ b/src/compiler/nir_types.cpp @@ -278,7 +278,7 @@ glsl_type_is_array_or_matrix(const struct glsl_type *type) } bool -glsl_type_is_struct(const struct glsl_type *type) +glsl_type_is_struct_or_ifc(const struct glsl_type *type) { return type->is_struct() || type->is_interface(); } diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h index e28c1b45960..7458efb8ca4 100644 --- a/src/compiler/nir_types.h +++ b/src/compiler/nir_types.h @@ -143,7 +143,7 @@ bool glsl_matrix_type_is_row_major(const struct glsl_type *type); bool glsl_type_is_array(const struct glsl_type *type); bool glsl_type_is_array_of_arrays(const struct glsl_type *type); bool glsl_type_is_array_or_matrix(const struct glsl_type *type); -bool glsl_type_is_struct(const struct glsl_type *type); +bool glsl_type_is_struct_or_ifc(const struct glsl_type *type); bool glsl_type_is_sampler(const struct glsl_type *type); bool glsl_type_is_image(const struct glsl_type *type); bool glsl_type_is_dual_slot(const struct glsl_type *type); diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c index 6bc015a096d..f93e336fb8b 100644 --- a/src/compiler/spirv/vtn_alu.c +++ b/src/compiler/spirv/vtn_alu.c @@ -454,19 +454,19 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, break; case SpvOpIAddCarry: - vtn_assert(glsl_type_is_struct(val->ssa->type)); + vtn_assert(glsl_type_is_struct_or_ifc(val->ssa->type)); val->ssa->elems[0]->def = nir_iadd(&b->nb, src[0], src[1]); val->ssa->elems[1]->def = nir_uadd_carry(&b->nb, src[0], src[1]); break; case SpvOpISubBorrow: - vtn_assert(glsl_type_is_struct(val->ssa->type)); + vtn_assert(glsl_type_is_struct_or_ifc(val->ssa->type)); val->ssa->elems[0]->def = nir_isub(&b->nb, src[0], src[1]); val->ssa->elems[1]->def = nir_usub_borrow(&b->nb, src[0], src[1]); break; case SpvOpUMulExtended: { - vtn_assert(glsl_type_is_struct(val->ssa->type)); + vtn_assert(glsl_type_is_struct_or_ifc(val->ssa->type)); nir_ssa_def *umul = nir_umul_2x32_64(&b->nb, src[0], src[1]); val->ssa->elems[0]->def = nir_unpack_64_2x32_split_x(&b->nb, umul); val->ssa->elems[1]->def = nir_unpack_64_2x32_split_y(&b->nb, umul); @@ -474,7 +474,7 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, } case SpvOpSMulExtended: { - vtn_assert(glsl_type_is_struct(val->ssa->type)); + vtn_assert(glsl_type_is_struct_or_ifc(val->ssa->type)); nir_ssa_def *smul = nir_imul_2x32_64(&b->nb, src[0], src[1]); val->ssa->elems[0]->def = nir_unpack_64_2x32_split_x(&b->nb, smul); val->ssa->elems[1]->def = nir_unpack_64_2x32_split_y(&b->nb, smul); diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index ef40e4912ff..59ff4b88485 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -606,7 +606,7 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, case GLSLstd450ModfStruct: { nir_ssa_def *sign = nir_fsign(nb, src[0]); nir_ssa_def *abs = nir_fabs(nb, src[0]); - vtn_assert(glsl_type_is_struct(val->ssa->type)); + vtn_assert(glsl_type_is_struct_or_ifc(val->ssa->type)); val->ssa->elems[0]->def = nir_fmul(nb, sign, nir_ffract(nb, abs)); val->ssa->elems[1]->def = nir_fmul(nb, sign, nir_ffloor(nb, abs)); return; @@ -794,7 +794,7 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, } case GLSLstd450FrexpStruct: { - vtn_assert(glsl_type_is_struct(val->ssa->type)); + vtn_assert(glsl_type_is_struct_or_ifc(val->ssa->type)); if (src[0]->bit_size == 64) val->ssa->elems[0]->def = build_frexp64(nb, src[0], &val->ssa->elems[1]->def); diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index b155681ca1f..d8a4407639f 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -116,7 +116,7 @@ vtn_variable_resource_index(struct vtn_builder *b, struct vtn_variable *var, nir_ssa_def *desc_array_index) { if (!desc_array_index) { - vtn_assert(glsl_type_is_struct(var->type->type)); + vtn_assert(glsl_type_is_struct_or_ifc(var->type->type)); desc_array_index = nir_imm_int(&b->nb, 0); } @@ -315,7 +315,7 @@ vtn_nir_deref_pointer_dereference(struct vtn_builder *b, } for (; idx < deref_chain->length; idx++) { - if (glsl_type_is_struct(type->type)) { + if (glsl_type_is_struct_or_ifc(type->type)) { vtn_assert(deref_chain->link[idx].mode == vtn_access_mode_literal); unsigned field = deref_chain->link[idx].id; tail = nir_build_deref_struct(&b->nb, tail, field); @@ -608,7 +608,7 @@ _vtn_local_load_store(struct vtn_builder *b, bool load, nir_deref_instr *deref, _vtn_local_load_store(b, load, child, inout->elems[i]); } } else { - vtn_assert(glsl_type_is_struct(deref->type)); + vtn_assert(glsl_type_is_struct_or_ifc(deref->type)); unsigned elems = glsl_get_length(deref->type); for (unsigned i = 0; i < elems; i++) { nir_deref_instr *child = nir_build_deref_struct(&b->nb, deref, i); @@ -2101,7 +2101,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val, var->patch = false; vtn_foreach_decoration(b, val, var_is_patch_cb, &var->patch); if (glsl_type_is_array(var->type->type) && - glsl_type_is_struct(without_array->type)) { + glsl_type_is_struct_or_ifc(without_array->type)) { vtn_foreach_decoration(b, vtn_value(b, without_array->id, vtn_value_type_type), var_is_patch_cb, &var->patch); diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp index 256fdd8fc79..7e13b2ffe19 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp +++ b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp @@ -119,7 +119,7 @@ count_uniform_storage_slots(const struct glsl_type *type) * type is a composite type or an array where each element occupies * more than one slot than we need to recursively process it. */ - if (glsl_type_is_struct(type)) { + if (glsl_type_is_struct_or_ifc(type)) { unsigned location_count = 0; for (unsigned i = 0; i < glsl_get_length(type); i++) { @@ -135,7 +135,7 @@ count_uniform_storage_slots(const struct glsl_type *type) const struct glsl_type *element_type = glsl_get_array_element(type); if (glsl_type_is_array(element_type) || - glsl_type_is_struct(element_type)) { + glsl_type_is_struct_or_ifc(element_type)) { unsigned element_count = count_uniform_storage_slots(element_type); return element_count * glsl_get_length(type); } diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index dab98f18604..8ed7059a82e 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -273,7 +273,7 @@ st_nir_assign_uniform_locations(struct gl_context *ctx, */ unsigned comps; - if (glsl_type_is_struct(type)) { + if (glsl_type_is_struct_or_ifc(type)) { comps = 4; } else { comps = glsl_get_vector_elements(type); @@ -522,7 +522,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, const struct glsl_type *type = glsl_without_array(var->type); for (unsigned int i = 0; i < var->num_state_slots; i++) { unsigned comps; - if (glsl_type_is_struct(type)) { + if (glsl_type_is_struct_or_ifc(type)) { /* Builtin struct require specical handling for now we just * make all members vec4. See st_nir_lower_builtin. */ -- 2.30.2