From 6e2cc790eb72acc4ab1e6dcd4befc1ccca48a427 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 1 Mar 2024 13:13:36 -0400 Subject: [PATCH] agx: model 64-bit uniform restriction on ALU this one is annoying! Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compiler.h | 2 +- src/asahi/compiler/agx_lower_uniform_sources.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/asahi/compiler/agx_compiler.h b/src/asahi/compiler/agx_compiler.h index 5321162935c..40bef23d57d 100644 --- a/src/asahi/compiler/agx_compiler.h +++ b/src/asahi/compiler/agx_compiler.h @@ -927,7 +927,7 @@ agx_builder_insert(agx_cursor *cursor, agx_instr *I) } bool agx_instr_accepts_uniform(enum agx_opcode op, unsigned src_index, - unsigned value); + unsigned value, enum agx_size size); /* Routines defined for AIR */ void agx_print_index(agx_index index, bool is_float, FILE *fp); diff --git a/src/asahi/compiler/agx_lower_uniform_sources.c b/src/asahi/compiler/agx_lower_uniform_sources.c index 01422f3f4b4..b24e3653c6a 100644 --- a/src/asahi/compiler/agx_lower_uniform_sources.c +++ b/src/asahi/compiler/agx_lower_uniform_sources.c @@ -14,11 +14,14 @@ */ bool agx_instr_accepts_uniform(enum agx_opcode op, unsigned src_index, - unsigned value) + unsigned value, enum agx_size size) { /* Some instructions only seem able to access uniforms in the low half */ bool high = value >= 256; + /* ALU cannot access 64-bit uniforms */ + bool is_64 = size == AGX_SIZE_64; + switch (op) { case AGX_OPCODE_IMAGE_LOAD: case AGX_OPCODE_TEXTURE_LOAD: @@ -52,7 +55,7 @@ agx_instr_accepts_uniform(enum agx_opcode op, unsigned src_index, case AGX_OPCODE_STACK_STORE: return false; default: - return true; + return !is_64; } } @@ -64,7 +67,8 @@ agx_lower_uniform_sources(agx_context *ctx) agx_foreach_src(I, s) { if (I->src[s].type == AGX_INDEX_UNIFORM && - !agx_instr_accepts_uniform(I->op, s, I->src[s].value)) { + !agx_instr_accepts_uniform(I->op, s, I->src[s].value, + I->src[s].size)) { agx_index idx = I->src[s]; idx.abs = idx.neg = false;