Commit 1d1105ed authored by Boris Brezillon's avatar Boris Brezillon
Browse files

nir: Propagate alignment info when lowering var copies



Now that copy_deref has src/dest alignment info we can propagate them
when lowering those copy_deref.
Signed-off-by: Boris Brezillon's avatarBoris Brezillon <boris.brezillon@collabora.com>
parent a539b00b
......@@ -58,7 +58,9 @@ emit_deref_copy_load_store(nir_builder *b,
nir_deref_instr *src_deref,
nir_deref_instr **src_deref_arr,
enum gl_access_qualifier dst_access,
enum gl_access_qualifier src_access)
enum gl_access_qualifier src_access,
unsigned dst_align_mul, unsigned dst_align_offset,
unsigned src_align_mul, unsigned src_align_offset)
{
if (dst_deref_arr || src_deref_arr) {
assert(dst_deref_arr && src_deref_arr);
......@@ -81,16 +83,20 @@ emit_deref_copy_load_store(nir_builder *b,
nir_build_deref_array_imm(b, dst_deref, i),
dst_deref_arr + 1,
nir_build_deref_array_imm(b, src_deref, i),
src_deref_arr + 1, dst_access, src_access);
src_deref_arr + 1, dst_access, src_access,
dst_align_mul, dst_align_offset,
src_align_mul, src_align_offset);
}
} else {
assert(glsl_get_bare_type(dst_deref->type) ==
glsl_get_bare_type(src_deref->type));
assert(glsl_type_is_vector_or_scalar(dst_deref->type));
nir_store_deref_with_access(b, dst_deref,
nir_load_deref_with_access(b, src_deref, src_access),
~0, src_access);
nir_ssa_def *load =
nir_load_deref_with_access_and_align(b, src_deref, src_access,
src_align_mul, src_align_offset);
nir_store_deref_with_access_and_align(b, dst_deref, load, ~0, src_access,
dst_align_mul, dst_align_offset);
}
}
......@@ -112,7 +118,11 @@ nir_lower_deref_copy_instr(nir_builder *b, nir_intrinsic_instr *copy)
emit_deref_copy_load_store(b, dst_path.path[0], &dst_path.path[1],
src_path.path[0], &src_path.path[1],
nir_intrinsic_dst_access(copy),
nir_intrinsic_src_access(copy));
nir_intrinsic_src_access(copy),
nir_intrinsic_dst_align_mul(copy),
nir_intrinsic_dst_align_offset(copy),
nir_intrinsic_src_align_mul(copy),
nir_intrinsic_src_align_offset(copy));
nir_deref_path_finish(&dst_path);
nir_deref_path_finish(&src_path);
......
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