union {
struct {
nir_src index;
+ bool in_bounds;
} arr;
struct {
case nir_deref_type_ptr_as_array:
__clone_src(state, &nderef->instr,
&nderef->arr.index, &deref->arr.index);
+ nderef->arr.in_bounds = deref->arr.in_bounds;
break;
case nir_deref_type_array_wildcard:
assert(parent->arr.index.is_ssa);
assert(deref->arr.index.is_ssa);
+ deref->arr.in_bounds &= parent->arr.in_bounds;
+
nir_ssa_def *new_idx = nir_iadd(b, parent->arr.index.ssa,
deref->arr.index.ssa);
case nir_deref_type_array:
case nir_deref_type_ptr_as_array:
hash = hash_src(hash, &instr->arr.index);
+ hash = HASH(hash, instr->arr.in_bounds);
break;
case nir_deref_type_cast:
case nir_deref_type_ptr_as_array:
if (!nir_srcs_equal(deref1->arr.index, deref2->arr.index))
return false;
+ if (deref1->arr.in_bounds != deref2->arr.in_bounds)
+ return false;
break;
case nir_deref_type_cast:
unsigned deref_type:3;
unsigned cast_type_same_as_last:1;
unsigned modes:5; /* See (de|en)code_deref_modes() */
- unsigned _pad:10;
+ unsigned _pad:9;
+ unsigned in_bounds:1;
unsigned packed_src_ssa_16bit:1; /* deref_var redefines this */
unsigned dest:8;
} deref;
header.deref.packed_src_ssa_16bit =
deref->parent.is_ssa && deref->arr.index.is_ssa &&
are_object_ids_16bit(ctx);
+
+ header.deref.in_bounds = deref->arr.in_bounds;
}
write_dest(ctx, &deref->dest, header, deref->instr.type);
read_src(ctx, &deref->arr.index, &deref->instr);
}
+ deref->arr.in_bounds = header.deref.in_bounds;
+
parent = nir_src_as_deref(deref->parent);
if (deref->deref_type == nir_deref_type_array)
deref->type = glsl_get_array_element(parent->type);
/* Access qualifiers */
enum gl_access_qualifier access;
+ bool in_bounds;
+
/** Struct elements and array offsets.
*
* This is an array of 1 so that it can conveniently be created on the
tail = nir_build_deref_array(&b->nb, tail, arr_index);
type = type->array_element;
}
+ tail->arr.in_bounds = deref_chain->in_bounds;
access |= type->access;
}
struct vtn_pointer *base = vtn_pointer(b, w[3]);
+ chain->in_bounds = (opcode == SpvOpInBoundsAccessChain || opcode == SpvOpInBoundsPtrAccessChain);
+
/* Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/3406 */
access |= base->access & ACCESS_NON_UNIFORM;