diff --git a/src/asahi/compiler/agx_pack.c b/src/asahi/compiler/agx_pack.c index 372531adb68..6ae23d1bbda 100644 --- a/src/asahi/compiler/agx_pack.c +++ b/src/asahi/compiler/agx_pack.c @@ -58,11 +58,10 @@ static unsigned agx_pack_sample_coords(const agx_instr *I, agx_index index, bool *flag, bool *is_16) { - /* TODO: Do we have a use case for 16-bit coords? */ - pack_assert_msg(I, index.size == AGX_SIZE_32, "32-bit coordinates"); + pack_assert_msg(I, index.size <= AGX_SIZE_32, "32-bit coordinates"); pack_assert_msg(I, index.value < 0x100, "coordinate register bound"); - *is_16 = false; + *is_16 = index.size == AGX_SIZE_16; *flag = index.discard; return index.value; } @@ -913,8 +912,8 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups, (q2 << 30) | (((uint64_t)(T & BITFIELD_MASK(6))) << 32) | (((uint64_t)Tt) << 38) | (((uint64_t)(I->dim & BITFIELD_MASK(3))) << 40) | - (((uint64_t)q3) << 43) | (((uint64_t)I->mask) << 48) | - (((uint64_t)lod_mode) << 52) | + (((uint64_t)q3) << 43) | (Cs ? BITFIELD64_BIT(47) : 0) | + (((uint64_t)I->mask) << 48) | (((uint64_t)lod_mode) << 52) | (((uint64_t)(S & BITFIELD_MASK(6))) << 56) | (((uint64_t)St) << 62) | (((uint64_t)I->scoreboard) << 63); diff --git a/src/asahi/compiler/agx_validate.c b/src/asahi/compiler/agx_validate.c index de2e24a1498..990ce4449f1 100644 --- a/src/asahi/compiler/agx_validate.c +++ b/src/asahi/compiler/agx_validate.c @@ -228,12 +228,12 @@ agx_dim_info(enum agx_dim dim) * lower 16-bits are present. LOD queries do not take a layer. */ static unsigned -agx_coordinate_registers(const agx_instr *I) +agx_coordinate_registers(const agx_instr *I, enum agx_size size) { struct dim_info dim = agx_dim_info(I->dim); bool has_array = !I->query_lod; - return 2 * (dim.comps + (has_array && dim.array)); + return agx_size_align_16(size) * (dim.comps + (has_array && dim.array)); } static unsigned @@ -292,7 +292,7 @@ agx_read_registers(const agx_instr *I, unsigned s) if (s == 0) return 4 * size /* data */; else if (s == 1) - return agx_coordinate_registers(I); + return agx_coordinate_registers(I, I->src[1].size); else return size; @@ -300,7 +300,7 @@ agx_read_registers(const agx_instr *I, unsigned s) case AGX_OPCODE_TEXTURE_LOAD: case AGX_OPCODE_TEXTURE_SAMPLE: if (s == 0) { - return agx_coordinate_registers(I); + return agx_coordinate_registers(I, I->src[0].size); } else if (s == 1) { /* LOD */ if (I->lod_mode == AGX_LOD_MODE_LOD_GRAD || @@ -341,7 +341,7 @@ agx_read_registers(const agx_instr *I, unsigned s) case AGX_OPCODE_BLOCK_IMAGE_STORE: if (s == 3 && I->explicit_coords) - return agx_coordinate_registers(I); + return agx_coordinate_registers(I, I->src[3].size); else return size;