Commit b47fba3f authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund
Browse files

Revert "spirv: Apply proper alignment when walking the load/store deref chain"

This reverts commit 47919cf4.
parent f509665f
......@@ -620,37 +620,28 @@ vtn_pointer_to_deref(struct vtn_builder *b, struct vtn_pointer *ptr)
static void
_vtn_local_load_store(struct vtn_builder *b, bool load, nir_deref_instr *deref,
struct vtn_ssa_value *inout,
enum gl_access_qualifier access,
unsigned align_mul, unsigned align_offset)
enum gl_access_qualifier access, unsigned alignment)
{
if (glsl_type_is_vector_or_scalar(deref->type)) {
align_offset = align_mul ? align_offset % align_mul : 0;
if (load) {
inout->def = nir_load_deref_with_access_and_align(&b->nb, deref, access,
align_mul, align_offset);
inout->def = nir_load_deref_with_access_and_align(&b->nb, deref, access, alignment, 0);
} else {
nir_store_deref_with_access_and_align(&b->nb, deref, inout->def, ~0,
access, align_mul, align_offset);
nir_store_deref_with_access_and_align(&b->nb, deref, inout->def, ~0, access, alignment, 0);
}
} else if (glsl_type_is_array(deref->type) ||
glsl_type_is_matrix(deref->type)) {
const struct glsl_type *elem_type = glsl_without_array_or_matrix(deref->type);
unsigned stride = glsl_get_explicit_stride(elem_type);
unsigned elems = glsl_get_length(deref->type);
for (unsigned i = 0; i < elems; i++) {
nir_deref_instr *child =
nir_build_deref_array_imm(&b->nb, deref, i);
_vtn_local_load_store(b, load, child, inout->elems[i], access,
align_mul, align_offset + (i * stride));
_vtn_local_load_store(b, load, child, inout->elems[i], access, alignment);
}
} else {
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);
unsigned field_offset = glsl_get_struct_field_offset(deref->type, i);
_vtn_local_load_store(b, load, child, inout->elems[i], access,
align_mul, align_offset + field_offset);
_vtn_local_load_store(b, load, child, inout->elems[i], access, alignment);
}
}
}
......@@ -693,7 +684,7 @@ vtn_local_load(struct vtn_builder *b, nir_deref_instr *src,
{
nir_deref_instr *src_tail = get_deref_tail(b, src);
struct vtn_ssa_value *val = vtn_create_ssa_value(b, src_tail->type);
_vtn_local_load_store(b, true, src_tail, val, access, alignment, 0);
_vtn_local_load_store(b, true, src_tail, val, access, alignment);
if (src_tail != src) {
val->type = src->type;
......@@ -712,13 +703,13 @@ vtn_local_store(struct vtn_builder *b, struct vtn_ssa_value *src,
if (dest_tail != dest) {
struct vtn_ssa_value *val = vtn_create_ssa_value(b, dest_tail->type);
_vtn_local_load_store(b, true, dest_tail, val, access, alignment, 0);
_vtn_local_load_store(b, true, dest_tail, val, access, alignment);
val->def = nir_vector_insert(&b->nb, val->def, src->def,
dest->arr.index.ssa);
_vtn_local_load_store(b, false, dest_tail, val, access, alignment, 0);
_vtn_local_load_store(b, false, dest_tail, val, access, alignment);
} else {
_vtn_local_load_store(b, false, dest_tail, src, access, alignment, 0);
_vtn_local_load_store(b, false, dest_tail, src, access, alignment);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment