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 <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Timothy Arceri
2019-03-05 16:07:12 +11:00
parent e16a27fcf8
commit 54522d0506
25 changed files with 45 additions and 45 deletions

View File

@@ -3975,7 +3975,7 @@ glsl_to_llvm_type(struct ac_llvm_context *ac,
glsl_get_length(type)); 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)]; LLVMTypeRef member_types[glsl_get_length(type)];

View File

@@ -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); mark_16bit_fs_input(ctx, glsl_get_array_element(type), location + i * stride);
} }
} else { } 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++) { for (unsigned i = 0; i < glsl_get_length(type); i++) {
mark_16bit_fs_input(ctx, glsl_get_struct_field(type, i), location); mark_16bit_fs_input(ctx, glsl_get_struct_field(type, i), location);
location += glsl_count_attribute_slots(glsl_get_struct_field(type, i), false); location += glsl_count_attribute_slots(glsl_get_struct_field(type, i), false);

View File

@@ -184,7 +184,7 @@ set_uniform_initializer(struct set_uniform_initializer_closure *data,
{ {
const struct glsl_type *t_without_array = glsl_without_array(type); 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++) { for (unsigned int i = 0; i < glsl_get_length(type); i++) {
const struct glsl_type *field_type = glsl_get_struct_field(type, i); const struct glsl_type *field_type = glsl_get_struct_field(type, i);
set_uniform_initializer(data, field_type, val->elements[i]); set_uniform_initializer(data, field_type, val->elements[i]);
@@ -192,7 +192,7 @@ set_uniform_initializer(struct set_uniform_initializer_closure *data,
return; 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(type) &&
glsl_type_is_array(glsl_get_array_element(type)))) { glsl_type_is_array(glsl_get_array_element(type)))) {
const struct glsl_type *element_type = glsl_get_array_element(type); const struct glsl_type *element_type = glsl_get_array_element(type);

View File

@@ -204,7 +204,7 @@ build_type_tree_for_type(const struct glsl_type *type)
entry->array_size = glsl_get_length(type); entry->array_size = glsl_get_length(type);
entry->children = build_type_tree_for_type(glsl_get_array_element(type)); entry->children = build_type_tree_for_type(glsl_get_array_element(type));
entry->children->parent = entry; 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; struct type_tree_entry *last = NULL;
for (unsigned i = 0; i < glsl_get_length(type); i++) { 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 * composite type or an array where each element occupies more than one
* location than we need to recursively process it. * 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(type) &&
(glsl_type_is_array(glsl_get_array_element(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; int location_count = 0;
struct type_tree_entry *old_type = state->current_type; 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++) { for (unsigned i = 0; i < glsl_get_length(type); i++) {
const struct glsl_type *field_type; 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); field_type = glsl_get_struct_field(type, i);
else else
field_type = glsl_get_array_element(type); field_type = glsl_get_array_element(type);
@@ -318,7 +318,7 @@ nir_link_uniform(struct gl_context *ctx,
location += entries; location += entries;
location_count += 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; state->current_type = state->current_type->next_sibling;
} }

View File

@@ -148,7 +148,7 @@ add_varying_outputs(nir_variable *var,
location_offset += child_outputs; location_offset += child_outputs;
dest_offset += component_slots; 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); unsigned length = glsl_get_length(type);
for (unsigned i = 0; i < length; i++) { for (unsigned i = 0; i < length; i++) {
const struct glsl_type *child_type = glsl_get_struct_field(type, i); const struct glsl_type *child_type = glsl_get_struct_field(type, i);

View File

@@ -871,7 +871,7 @@ static inline nir_deref_instr *
nir_build_deref_struct(nir_builder *build, nir_deref_instr *parent, nir_build_deref_struct(nir_builder *build, nir_deref_instr *parent,
unsigned index) 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 *deref =
nir_deref_instr_create(build->shader, nir_deref_type_struct); 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: 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) == assert(glsl_get_length(parent->type) ==
glsl_get_length(leader_parent->type)); glsl_get_length(leader_parent->type));

View File

@@ -152,7 +152,7 @@ struct_type_get_field_offset(const struct glsl_type *struct_type,
glsl_type_size_align_func size_align, glsl_type_size_align_func size_align,
unsigned field_idx) unsigned field_idx)
{ {
assert(glsl_type_is_struct(struct_type)); assert(glsl_type_is_struct_or_ifc(struct_type));
unsigned offset = 0; unsigned offset = 0;
for (unsigned i = 0; i <= field_idx; i++) { for (unsigned i = 0; i <= field_idx; i++) {
unsigned elem_size, elem_align; unsigned elem_size, elem_align;

View File

@@ -340,7 +340,7 @@ glsl_type_get_sampler_count(const struct glsl_type *type)
glsl_type_get_sampler_count(glsl_without_array(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; unsigned count = 0;
for (int i = 0; i < glsl_get_length(type); i++) for (int i = 0; i < glsl_get_length(type); i++)
count += glsl_type_get_sampler_count(glsl_get_struct_field(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))); 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; unsigned count = 0;
for (int i = 0; i < glsl_get_length(type); i++) for (int i = 0; i < glsl_get_length(type); i++)
count += glsl_type_get_image_count(glsl_get_struct_field(type, i)); count += glsl_type_get_image_count(glsl_get_struct_field(type, i));

View File

@@ -42,7 +42,7 @@ add_var_xfb_outputs(nir_xfb_info *xfb,
const struct glsl_type *child_type = glsl_get_array_element(type); const struct glsl_type *child_type = glsl_get_array_element(type);
for (unsigned i = 0; i < length; i++) for (unsigned i = 0; i < length; i++)
add_var_xfb_outputs(xfb, var, buffer, location, offset, child_type); 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); unsigned length = glsl_get_length(type);
for (unsigned i = 0; i < length; i++) { for (unsigned i = 0; i < length; i++) {
const struct glsl_type *child_type = glsl_get_struct_field(type, 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, add_var_xfb_outputs(xfb, var, var->data.xfb_buffer,
&location, &offset, var->type); &location, &offset, var->type);
} else if (is_array_block) { } 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); unsigned aoa_size = glsl_get_aoa_size(var->type);
const struct glsl_type *itype = var->interface_type; const struct glsl_type *itype = var->interface_type;

View File

@@ -768,7 +768,7 @@ can_replace_varying(nir_variable *out_var)
if (glsl_type_is_array(out_var->type) || if (glsl_type_is_array(out_var->type) ||
glsl_type_is_dual_slot(out_var->type) || glsl_type_is_dual_slot(out_var->type) ||
glsl_type_is_matrix(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; return false;
/* Limit this pass to scalars for now to keep things simple. Most varyings /* Limit this pass to scalars for now to keep things simple. Most varyings

View File

@@ -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)), nir_store_deref(b, nir_build_deref_array(b, deref, nir_imm_int(b, i)),
&load->def, ~0); &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); unsigned len = glsl_get_length(deref->type);
for (unsigned i = 0; i < len; i++) { for (unsigned i = 0; i < len; i++) {
build_constant_load(b, nir_build_deref_struct(b, deref, i), build_constant_load(b, nir_build_deref_struct(b, deref, i),

View File

@@ -318,7 +318,7 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
* TODO: Add support for struct splitting. * TODO: Add support for struct splitting.
*/ */
if ((!glsl_type_is_array(type) && !glsl_type_is_matrix(type))|| 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; continue;
/* Skip builtins */ /* Skip builtins */

View File

@@ -341,7 +341,7 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask)
/* Skip types we cannot split */ /* Skip types we cannot split */
if (glsl_type_is_matrix(glsl_without_array(var->type)) || 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; continue;
switch (intr->intrinsic) { switch (intr->intrinsic) {

View File

@@ -150,7 +150,7 @@ get_deref_node_recur(nir_deref_instr *deref,
switch (deref->deref_type) { switch (deref->deref_type) {
case nir_deref_type_struct: 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)); assert(deref->strct.index < glsl_get_length(parent->type));
if (parent->children[deref->strct.index] == NULL) { if (parent->children[deref->strct.index] == NULL) {

View File

@@ -53,7 +53,7 @@ member_type(const struct glsl_type *type, unsigned index)
assert(glsl_get_explicit_stride(type) == 0); assert(glsl_get_explicit_stride(type) == 0);
return glsl_array_type(elem, glsl_get_length(type), 0); return glsl_array_type(elem, glsl_get_length(type), 0);
} else { } else {
assert(glsl_type_is_struct(type)); assert(glsl_type_is_struct_or_ifc(type));
assert(index < glsl_get_length(type)); assert(index < glsl_get_length(type));
return glsl_get_struct_field(type, index); return glsl_get_struct_field(type, index);
} }

View File

@@ -69,7 +69,7 @@ split_deref_copy_instr(nir_builder *b,
assert(dst->type == src->type); assert(dst->type == src->type);
if (glsl_type_is_vector_or_scalar(src->type)) { if (glsl_type_is_vector_or_scalar(src->type)) {
nir_copy_deref(b, dst, src); 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++) { for (unsigned i = 0; i < glsl_get_length(src->type); i++) {
split_deref_copy_instr(b, nir_build_deref_struct(b, dst, i), split_deref_copy_instr(b, nir_build_deref_struct(b, dst, i),
nir_build_deref_struct(b, src, i)); nir_build_deref_struct(b, src, i));

View File

@@ -91,7 +91,7 @@ init_field_for_type(struct field *field, struct field *parent,
}; };
const struct glsl_type *struct_type = glsl_without_array(type); 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->num_fields = glsl_get_length(struct_type),
field->fields = ralloc_array(state->mem_ctx, struct field, field->fields = ralloc_array(state->mem_ctx, struct field,
field->num_fields); 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 * pull all of the variables we plan to split off of the list
*/ */
nir_foreach_variable_safe(var, vars) { 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; continue;
exec_node_remove(&var->node); exec_node_remove(&var->node);
@@ -205,7 +205,7 @@ split_struct_derefs_impl(nir_function_impl *impl,
continue; continue;
assert(i > 0); 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 == assert(path.path[i - 1]->type ==
glsl_without_array(tail_field->type)); glsl_without_array(tail_field->type));

View File

@@ -437,7 +437,7 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state)
switch (instr->deref_type) { switch (instr->deref_type) {
case nir_deref_type_struct: 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, validate_assert(state,
instr->strct.index < glsl_get_length(parent->type)); instr->strct.index < glsl_get_length(parent->type));
validate_assert(state, instr->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) { if (var->num_members > 0) {
const struct glsl_type *without_array = glsl_without_array(var->type); 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->num_members == glsl_get_length(without_array));
validate_assert(state, var->members != NULL); validate_assert(state, var->members != NULL);
} }

View File

@@ -278,7 +278,7 @@ glsl_type_is_array_or_matrix(const struct glsl_type *type)
} }
bool 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(); return type->is_struct() || type->is_interface();
} }

View File

@@ -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(const struct glsl_type *type);
bool glsl_type_is_array_of_arrays(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_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_sampler(const struct glsl_type *type);
bool glsl_type_is_image(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); bool glsl_type_is_dual_slot(const struct glsl_type *type);

View File

@@ -454,19 +454,19 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
break; break;
case SpvOpIAddCarry: 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[0]->def = nir_iadd(&b->nb, src[0], src[1]);
val->ssa->elems[1]->def = nir_uadd_carry(&b->nb, src[0], src[1]); val->ssa->elems[1]->def = nir_uadd_carry(&b->nb, src[0], src[1]);
break; break;
case SpvOpISubBorrow: 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[0]->def = nir_isub(&b->nb, src[0], src[1]);
val->ssa->elems[1]->def = nir_usub_borrow(&b->nb, src[0], src[1]); val->ssa->elems[1]->def = nir_usub_borrow(&b->nb, src[0], src[1]);
break; break;
case SpvOpUMulExtended: { 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]); 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[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); 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: { 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]); 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[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); val->ssa->elems[1]->def = nir_unpack_64_2x32_split_y(&b->nb, smul);

View File

@@ -606,7 +606,7 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
case GLSLstd450ModfStruct: { case GLSLstd450ModfStruct: {
nir_ssa_def *sign = nir_fsign(nb, src[0]); nir_ssa_def *sign = nir_fsign(nb, src[0]);
nir_ssa_def *abs = nir_fabs(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[0]->def = nir_fmul(nb, sign, nir_ffract(nb, abs));
val->ssa->elems[1]->def = nir_fmul(nb, sign, nir_ffloor(nb, abs)); val->ssa->elems[1]->def = nir_fmul(nb, sign, nir_ffloor(nb, abs));
return; return;
@@ -794,7 +794,7 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
} }
case GLSLstd450FrexpStruct: { 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) if (src[0]->bit_size == 64)
val->ssa->elems[0]->def = build_frexp64(nb, src[0], val->ssa->elems[0]->def = build_frexp64(nb, src[0],
&val->ssa->elems[1]->def); &val->ssa->elems[1]->def);

View File

@@ -116,7 +116,7 @@ vtn_variable_resource_index(struct vtn_builder *b, struct vtn_variable *var,
nir_ssa_def *desc_array_index) nir_ssa_def *desc_array_index)
{ {
if (!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); 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++) { 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); vtn_assert(deref_chain->link[idx].mode == vtn_access_mode_literal);
unsigned field = deref_chain->link[idx].id; unsigned field = deref_chain->link[idx].id;
tail = nir_build_deref_struct(&b->nb, tail, field); 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]); _vtn_local_load_store(b, load, child, inout->elems[i]);
} }
} else { } 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); unsigned elems = glsl_get_length(deref->type);
for (unsigned i = 0; i < elems; i++) { for (unsigned i = 0; i < elems; i++) {
nir_deref_instr *child = nir_build_deref_struct(&b->nb, deref, 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; var->patch = false;
vtn_foreach_decoration(b, val, var_is_patch_cb, &var->patch); vtn_foreach_decoration(b, val, var_is_patch_cb, &var->patch);
if (glsl_type_is_array(var->type->type) && 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_foreach_decoration(b, vtn_value(b, without_array->id,
vtn_value_type_type), vtn_value_type_type),
var_is_patch_cb, &var->patch); var_is_patch_cb, &var->patch);

View File

@@ -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 * type is a composite type or an array where each element occupies
* more than one slot than we need to recursively process it. * 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; unsigned location_count = 0;
for (unsigned i = 0; i < glsl_get_length(type); i++) { 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); const struct glsl_type *element_type = glsl_get_array_element(type);
if (glsl_type_is_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); unsigned element_count = count_uniform_storage_slots(element_type);
return element_count * glsl_get_length(type); return element_count * glsl_get_length(type);
} }

View File

@@ -273,7 +273,7 @@ st_nir_assign_uniform_locations(struct gl_context *ctx,
*/ */
unsigned comps; unsigned comps;
if (glsl_type_is_struct(type)) { if (glsl_type_is_struct_or_ifc(type)) {
comps = 4; comps = 4;
} else { } else {
comps = glsl_get_vector_elements(type); 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); const struct glsl_type *type = glsl_without_array(var->type);
for (unsigned int i = 0; i < var->num_state_slots; i++) { for (unsigned int i = 0; i < var->num_state_slots; i++) {
unsigned comps; 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 /* Builtin struct require specical handling for now we just
* make all members vec4. See st_nir_lower_builtin. * make all members vec4. See st_nir_lower_builtin.
*/ */