mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-08 05:20:30 +01:00
ir3/a6xx: Fix immediate offset stg/ldg path
The immediate offset is in units of bytes, whereas the register offset is in dwords. We need to compensate for that. Also, fix an off-by-one when checking the range - the offset field is 13 bits, but the sign bit means we can only represent up to 1 << 12 in bytes or 1 << 10 in dwords. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19849>
This commit is contained in:
parent
733264bd7c
commit
f4c9e9329c
1 changed files with 6 additions and 6 deletions
|
|
@ -379,11 +379,11 @@ emit_intrinsic_load_global_ir3(struct ir3_context *ctx,
|
|||
struct ir3_instruction *load;
|
||||
|
||||
bool const_offset_in_bounds = nir_src_is_const(intr->src[1]) &&
|
||||
nir_src_as_int(intr->src[1]) < (1 << 13) &&
|
||||
nir_src_as_int(intr->src[1]) > -(1 << 13);
|
||||
nir_src_as_int(intr->src[1]) < (1 << 10) &&
|
||||
nir_src_as_int(intr->src[1]) > -(1 << 10);
|
||||
|
||||
if (const_offset_in_bounds) {
|
||||
load = ir3_LDG(b, addr, 0, create_immed(b, nir_src_as_int(intr->src[1])),
|
||||
load = ir3_LDG(b, addr, 0, create_immed(b, nir_src_as_int(intr->src[1]) * 4),
|
||||
0, create_immed(b, dest_components), 0);
|
||||
} else {
|
||||
offset = ir3_get_src(ctx, &intr->src[1])[0];
|
||||
|
|
@ -417,12 +417,12 @@ emit_intrinsic_store_global_ir3(struct ir3_context *ctx,
|
|||
struct ir3_instruction *stg;
|
||||
|
||||
bool const_offset_in_bounds = nir_src_is_const(intr->src[2]) &&
|
||||
nir_src_as_int(intr->src[2]) < (1 << 13) &&
|
||||
nir_src_as_int(intr->src[2]) > -(1 << 13);
|
||||
nir_src_as_int(intr->src[2]) < (1 << 10) &&
|
||||
nir_src_as_int(intr->src[2]) > -(1 << 10);
|
||||
|
||||
if (const_offset_in_bounds) {
|
||||
stg = ir3_STG(b, addr, 0,
|
||||
create_immed(b, nir_src_as_int(intr->src[2])), 0,
|
||||
create_immed(b, nir_src_as_int(intr->src[2]) * 4), 0,
|
||||
value, 0,
|
||||
create_immed(b, ncomp), 0);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue