pan/bi: Disallow non-zero .{range,base} on load_push_constant instructions
There seems to be several lowering pass that don't take the base/range into account, like nir_lower_mem_access_bit_sizes(). This caused issues when we tried using it on push_constants to make sure accesses are 32-bit aligned, so let's make sure the frontend is propagating the base to the offset, and assigns range to zero (AKA undefined). Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32415>
This commit is contained in:

committed by
Marge Bot

parent
8496159885
commit
2611dc106a
@@ -1217,8 +1217,10 @@ bi_emit_load_push_constant(bi_builder *b, nir_intrinsic_instr *instr)
|
||||
assert(b->shader->inputs->no_ubo_to_push && "can't mix push constant forms");
|
||||
|
||||
nir_src *offset = &instr->src[0];
|
||||
assert(!nir_intrinsic_base(instr) && "base must be zero");
|
||||
assert(!nir_intrinsic_range(instr) && "range must be zero");
|
||||
assert(nir_src_is_const(*offset) && "no indirect push constants");
|
||||
uint32_t base = nir_intrinsic_base(instr) + nir_src_as_uint(*offset);
|
||||
uint32_t base = nir_src_as_uint(*offset);
|
||||
assert((base & 3) == 0 && "unaligned push constants");
|
||||
|
||||
unsigned bits = instr->def.bit_size * instr->def.num_components;
|
||||
|
Reference in New Issue
Block a user