mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
nir/lower_explicit_io: add alignment parameters to address builder
We will need this when building shifted addresses. Since adding these parameters has a lot of code churn which would distract from the main changes, it is split-off in a separate commit. Signed-off-by: Job Noorman <jnoorman@igalia.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35092>
This commit is contained in:
parent
553a439b54
commit
1406eafbcd
1 changed files with 16 additions and 8 deletions
|
|
@ -1173,7 +1173,8 @@ nir_explicit_io_address_from_deref(nir_builder *b, nir_deref_instr *deref,
|
||||||
|
|
||||||
static nir_io_offset
|
static nir_io_offset
|
||||||
build_addr(nir_builder *b, nir_intrinsic_instr *intrin, nir_def *base_addr,
|
build_addr(nir_builder *b, nir_intrinsic_instr *intrin, nir_def *base_addr,
|
||||||
nir_address_format addr_format, unsigned comp_offset)
|
nir_address_format addr_format, unsigned comp_offset,
|
||||||
|
uint32_t align_mul, uint32_t align_offset)
|
||||||
{
|
{
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
assert(deref);
|
assert(deref);
|
||||||
|
|
@ -1237,7 +1238,8 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
||||||
for (unsigned i = 0; i < intrin->num_components; i++) {
|
for (unsigned i = 0; i < intrin->num_components; i++) {
|
||||||
unsigned comp_offset = i * vec_stride;
|
unsigned comp_offset = i * vec_stride;
|
||||||
nir_io_offset comp_addr =
|
nir_io_offset comp_addr =
|
||||||
build_addr(b, intrin, base_addr, addr_format, comp_offset);
|
build_addr(b, intrin, base_addr, addr_format, comp_offset,
|
||||||
|
align_mul, align_offset);
|
||||||
comps[i] = build_explicit_io_load(b, intrin, comp_addr,
|
comps[i] = build_explicit_io_load(b, intrin, comp_addr,
|
||||||
addr_format, deref->modes,
|
addr_format, deref->modes,
|
||||||
align_mul,
|
align_mul,
|
||||||
|
|
@ -1247,7 +1249,8 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
||||||
}
|
}
|
||||||
value = nir_vec(b, comps, intrin->num_components);
|
value = nir_vec(b, comps, intrin->num_components);
|
||||||
} else {
|
} else {
|
||||||
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0);
|
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0,
|
||||||
|
align_mul, align_offset);
|
||||||
value = build_explicit_io_load(b, intrin, addr, addr_format,
|
value = build_explicit_io_load(b, intrin, addr, addr_format,
|
||||||
deref->modes, align_mul, align_offset,
|
deref->modes, align_mul, align_offset,
|
||||||
intrin->num_components);
|
intrin->num_components);
|
||||||
|
|
@ -1266,14 +1269,16 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
||||||
|
|
||||||
unsigned comp_offset = i * vec_stride;
|
unsigned comp_offset = i * vec_stride;
|
||||||
nir_io_offset comp_addr =
|
nir_io_offset comp_addr =
|
||||||
build_addr(b, intrin, base_addr, addr_format, comp_offset);
|
build_addr(b, intrin, base_addr, addr_format, comp_offset,
|
||||||
|
align_mul, align_offset);
|
||||||
build_explicit_io_store(b, intrin, comp_addr, addr_format,
|
build_explicit_io_store(b, intrin, comp_addr, addr_format,
|
||||||
deref->modes, align_mul,
|
deref->modes, align_mul,
|
||||||
(align_offset + comp_offset) % align_mul,
|
(align_offset + comp_offset) % align_mul,
|
||||||
nir_channel(b, value, i), 1);
|
nir_channel(b, value, i), 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0);
|
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0,
|
||||||
|
align_mul, align_offset);
|
||||||
build_explicit_io_store(b, intrin, addr, addr_format,
|
build_explicit_io_store(b, intrin, addr, addr_format,
|
||||||
deref->modes, align_mul, align_offset,
|
deref->modes, align_mul, align_offset,
|
||||||
value, write_mask);
|
value, write_mask);
|
||||||
|
|
@ -1282,7 +1287,8 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
||||||
}
|
}
|
||||||
|
|
||||||
case nir_intrinsic_load_deref_block_intel: {
|
case nir_intrinsic_load_deref_block_intel: {
|
||||||
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0);
|
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0,
|
||||||
|
align_mul, align_offset);
|
||||||
nir_def *value = build_explicit_io_load(b, intrin, addr, addr_format,
|
nir_def *value = build_explicit_io_load(b, intrin, addr, addr_format,
|
||||||
deref->modes,
|
deref->modes,
|
||||||
align_mul, align_offset,
|
align_mul, align_offset,
|
||||||
|
|
@ -1292,7 +1298,8 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
||||||
}
|
}
|
||||||
|
|
||||||
case nir_intrinsic_store_deref_block_intel: {
|
case nir_intrinsic_store_deref_block_intel: {
|
||||||
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0);
|
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0,
|
||||||
|
align_mul, align_offset);
|
||||||
nir_def *value = intrin->src[1].ssa;
|
nir_def *value = intrin->src[1].ssa;
|
||||||
const nir_component_mask_t write_mask = 0;
|
const nir_component_mask_t write_mask = 0;
|
||||||
build_explicit_io_store(b, intrin, addr, addr_format,
|
build_explicit_io_store(b, intrin, addr, addr_format,
|
||||||
|
|
@ -1302,7 +1309,8 @@ nir_lower_explicit_io_instr(nir_builder *b,
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0);
|
nir_io_offset addr = build_addr(b, intrin, base_addr, addr_format, 0,
|
||||||
|
align_mul, align_offset);
|
||||||
nir_def *value =
|
nir_def *value =
|
||||||
build_explicit_io_atomic(b, intrin, addr, addr_format, deref->modes);
|
build_explicit_io_atomic(b, intrin, addr, addr_format, deref->modes);
|
||||||
nir_def_rewrite_uses(&intrin->def, value);
|
nir_def_rewrite_uses(&intrin->def, value);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue