diff --git a/src/asahi/compiler/agx_ir.c b/src/asahi/compiler/agx_ir.c index 15858e444b0..9c2888119c5 100644 --- a/src/asahi/compiler/agx_ir.c +++ b/src/asahi/compiler/agx_ir.c @@ -4,6 +4,7 @@ */ #include "agx_compiler.h" +#include "agx_opcodes.h" bool agx_allows_16bit_immediate(agx_instr *I) @@ -13,7 +14,8 @@ agx_allows_16bit_immediate(agx_instr *I) (I->op == AGX_OPCODE_STACK_LOAD) || (I->op == AGX_OPCODE_STACK_STORE) || (I->op == AGX_OPCODE_UNIFORM_STORE) || (I->op == AGX_OPCODE_ATOMIC) || - (I->op == AGX_OPCODE_PHI); + (I->op == AGX_OPCODE_PHI) || (I->op == AGX_OPCODE_TEX_STATE_STORE) || + (I->op == AGX_OPCODE_SAMPLER_STATE_STORE); } unsigned diff --git a/src/asahi/compiler/agx_optimizer.c b/src/asahi/compiler/agx_optimizer.c index 78da05ddd27..2f46c3f6b22 100644 --- a/src/asahi/compiler/agx_optimizer.c +++ b/src/asahi/compiler/agx_optimizer.c @@ -571,9 +571,7 @@ agx_optimizer_forward(agx_context *ctx) /* Inline immediates if we can. TODO: systematic */ if (I->op != AGX_OPCODE_COLLECT && I->op != AGX_OPCODE_IMAGE_LOAD && I->op != AGX_OPCODE_TEXTURE_LOAD && - I->op != AGX_OPCODE_UNIFORM_STORE && I->op != AGX_OPCODE_EXPORT && - I->op != AGX_OPCODE_TEX_STATE_STORE && - I->op != AGX_OPCODE_SAMPLER_STATE_STORE) + I->op != AGX_OPCODE_UNIFORM_STORE && I->op != AGX_OPCODE_EXPORT) agx_optimizer_inline_imm(defs, I); if (I->op == AGX_OPCODE_IF_ICMP) { diff --git a/src/asahi/compiler/agx_pack.c b/src/asahi/compiler/agx_pack.c index b51be8bfff4..1241a20a0f9 100644 --- a/src/asahi/compiler/agx_pack.c +++ b/src/asahi/compiler/agx_pack.c @@ -88,7 +88,7 @@ agx_pack_texture(const agx_instr *I, agx_index base, agx_index index, pack_assert(I, base.type == AGX_INDEX_UNIFORM); pack_assert(I, base.size == AGX_SIZE_64); pack_assert(I, (base.value & 3) == 0); - pack_assert(I, index.size == AGX_SIZE_32); + pack_assert(I, index.size <= AGX_SIZE_32); /* Bindless */ *packed_base = base.value >> 2; @@ -928,12 +928,14 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups, pack_assert(I, U < (1 << 4)); pack_assert(I, (T & 1) == 0); - pack_assert(I, T < (1 << 8)); + pack_assert(I, T < (1 << 24)); pack_assert(I, I->imm < (1 << 7)); - uint64_t raw = agx_opcodes_info[I->op].encoding.exact | (I->imm << 8) | - (I->scoreboard << 16) | ((uint64_t)(T >> 1) << 27) | - ((uint64_t)(U << 1) << 58); + uint64_t raw = + agx_opcodes_info[I->op].encoding.exact | (I->imm << 8) | + (I->scoreboard << 16) | ((uint64_t)T << 26) | + ((I->src[1].type == AGX_INDEX_IMMEDIATE) ? (1ul << 58) : 0) | + ((uint64_t)U << 59); memcpy(util_dynarray_grow_bytes(emission, 1, 8), &raw, 8); break;