}
static inline nir_deref_instr *
-nir_build_deref_cast(nir_builder *build, nir_def *parent,
- nir_variable_mode modes, const struct glsl_type *type,
- unsigned ptr_stride)
+nir_build_deref_cast_with_alignment(nir_builder *build, nir_def *parent,
+ nir_variable_mode modes,
+ const struct glsl_type *type,
+ unsigned ptr_stride,
+ unsigned align_mul,
+ unsigned align_offset)
{
nir_deref_instr *deref =
nir_deref_instr_create(build->shader, nir_deref_type_cast);
deref->modes = modes;
deref->type = type;
deref->parent = nir_src_for_ssa(parent);
+ deref->cast.align_mul = align_mul;
+ deref->cast.align_offset = align_offset;
deref->cast.ptr_stride = ptr_stride;
nir_def_init(&deref->instr, &deref->def, parent->num_components,
}
static inline nir_deref_instr *
+nir_build_deref_cast(nir_builder *build, nir_def *parent,
+ nir_variable_mode modes, const struct glsl_type *type,
+ unsigned ptr_stride)
+{
+ return nir_build_deref_cast_with_alignment(build, parent, modes, type,
+ ptr_stride, 0, 0);
+}
+
+static inline nir_deref_instr *
nir_alignment_deref_cast(nir_builder *build, nir_deref_instr *parent,
uint32_t align_mul, uint32_t align_offset)
{
return nir_build_deref_struct(b, parent, leader->strct.index);
+ case nir_deref_type_cast:
+ return nir_build_deref_cast_with_alignment(b, &parent->def,
+ leader->modes,
+ leader->type,
+ leader->cast.ptr_stride,
+ leader->cast.align_mul,
+ leader->cast.align_offset);
default:
unreachable("Invalid deref instruction type");
}