nir/lower_io: Add a mode parameter to build_addr_iadd
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332>
This commit is contained in:
parent
ff838abc46
commit
7007d06898
|
@ -773,7 +773,9 @@ type_scalar_size_bytes(const struct glsl_type *type)
|
|||
|
||||
static nir_ssa_def *
|
||||
build_addr_iadd(nir_builder *b, nir_ssa_def *addr,
|
||||
nir_address_format addr_format, nir_ssa_def *offset)
|
||||
nir_address_format addr_format,
|
||||
nir_variable_mode modes,
|
||||
nir_ssa_def *offset)
|
||||
{
|
||||
assert(offset->num_components == 1);
|
||||
|
||||
|
@ -834,9 +836,11 @@ addr_get_offset_bit_size(nir_ssa_def *addr, nir_address_format addr_format)
|
|||
|
||||
static nir_ssa_def *
|
||||
build_addr_iadd_imm(nir_builder *b, nir_ssa_def *addr,
|
||||
nir_address_format addr_format, int64_t offset)
|
||||
nir_address_format addr_format,
|
||||
nir_variable_mode modes,
|
||||
int64_t offset)
|
||||
{
|
||||
return build_addr_iadd(b, addr, addr_format,
|
||||
return build_addr_iadd(b, addr, addr_format, modes,
|
||||
nir_imm_intN_t(b, offset,
|
||||
addr_get_offset_bit_size(addr, addr_format)));
|
||||
}
|
||||
|
@ -873,7 +877,7 @@ build_addr_for_var(nir_builder *b, nir_variable *var,
|
|||
unreachable("Unsupported variable mode");
|
||||
}
|
||||
|
||||
return build_addr_iadd_imm(b, base_addr, addr_format,
|
||||
return build_addr_iadd_imm(b, base_addr, addr_format, var->data.mode,
|
||||
var->data.driver_location);
|
||||
}
|
||||
|
||||
|
@ -1412,7 +1416,7 @@ nir_explicit_io_address_from_deref(nir_builder *b, nir_deref_instr *deref,
|
|||
|
||||
nir_ssa_def *index = nir_ssa_for_src(b, deref->arr.index, 1);
|
||||
index = nir_i2i(b, index, addr_get_offset_bit_size(base_addr, addr_format));
|
||||
return build_addr_iadd(b, base_addr, addr_format,
|
||||
return build_addr_iadd(b, base_addr, addr_format, deref->modes,
|
||||
nir_amul_imm(b, index, stride));
|
||||
}
|
||||
|
||||
|
@ -1420,7 +1424,7 @@ nir_explicit_io_address_from_deref(nir_builder *b, nir_deref_instr *deref,
|
|||
nir_ssa_def *index = nir_ssa_for_src(b, deref->arr.index, 1);
|
||||
index = nir_i2i(b, index, addr_get_offset_bit_size(base_addr, addr_format));
|
||||
unsigned stride = nir_deref_instr_array_stride(deref);
|
||||
return build_addr_iadd(b, base_addr, addr_format,
|
||||
return build_addr_iadd(b, base_addr, addr_format, deref->modes,
|
||||
nir_amul_imm(b, index, stride));
|
||||
}
|
||||
|
||||
|
@ -1433,7 +1437,8 @@ nir_explicit_io_address_from_deref(nir_builder *b, nir_deref_instr *deref,
|
|||
int offset = glsl_get_struct_field_offset(parent->type,
|
||||
deref->strct.index);
|
||||
assert(offset >= 0);
|
||||
return build_addr_iadd_imm(b, base_addr, addr_format, offset);
|
||||
return build_addr_iadd_imm(b, base_addr, addr_format,
|
||||
deref->modes, offset);
|
||||
}
|
||||
|
||||
case nir_deref_type_cast:
|
||||
|
@ -1473,6 +1478,7 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
|||
for (unsigned i = 0; i < intrin->num_components; i++) {
|
||||
unsigned comp_offset = i * vec_stride;
|
||||
nir_ssa_def *comp_addr = build_addr_iadd_imm(b, addr, addr_format,
|
||||
deref->modes,
|
||||
comp_offset);
|
||||
comps[i] = build_explicit_io_load(b, intrin, comp_addr,
|
||||
addr_format, align_mul,
|
||||
|
@ -1501,6 +1507,7 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
|||
|
||||
unsigned comp_offset = i * vec_stride;
|
||||
nir_ssa_def *comp_addr = build_addr_iadd_imm(b, addr, addr_format,
|
||||
deref->modes,
|
||||
comp_offset);
|
||||
build_explicit_io_store(b, intrin, comp_addr, addr_format,
|
||||
align_mul,
|
||||
|
|
Loading…
Reference in New Issue