agx: Add perspective bit to ld_var
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 5 Jun 2021 20:20:11 +0000 (16:20 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 5 Jul 2021 20:56:03 +0000 (20:56 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11718>

src/asahi/compiler/agx_compile.c
src/asahi/compiler/agx_compiler.h
src/asahi/compiler/agx_opcodes.py
src/asahi/compiler/agx_pack.c

index ad3321a..4013744 100644 (file)
@@ -139,7 +139,7 @@ agx_emit_load_vary(agx_builder *b, nir_intrinsic_instr *instr)
    imm_index += 1;
 
    return agx_ld_vary_to(b, agx_dest_index(&instr->dest),
-         agx_immediate(imm_index), components);
+         agx_immediate(imm_index), components, true);
 }
 
 static agx_instr *
index 1154377..909ce2d 100644 (file)
@@ -272,6 +272,9 @@ typedef struct {
       struct agx_block *target;
    };
 
+   /* For load varying */
+   bool perspective : 1;
+
    /* Invert icond/fcond */
    bool invert_cond : 1;
 
index 63f7a31..aabd7b6 100644 (file)
@@ -95,6 +95,7 @@ NEST = immediate("nest")
 INVERT_COND = immediate("invert_cond")
 NEST = immediate("nest")
 TARGET = immediate("target", "agx_block *")
+PERSPECTIVE = immediate("perspective", "bool")
 SR = enum("sr", {
    0:  'threadgroup_position_in_grid.x',
    1:  'threadgroup_position_in_grid.y',
@@ -235,7 +236,7 @@ for is_float in [False, True]:
 
 op("bitop", (0x7E, 0x7F, 6, _), srcs = 2, imms = [TRUTH_TABLE])
 op("convert", (0x3E | L, 0x7F | L | (0x3 << 38), 6, _), srcs = 2, imms = [ROUND]) 
-op("ld_vary", (0x21, 0x3F, 8, _), srcs = 1, imms = [CHANNELS])
+op("ld_vary", (0x21, 0x3F, 8, _), srcs = 1, imms = [CHANNELS, PERSPECTIVE])
 op("st_vary", None, dests = 0, srcs = 2, can_eliminate = False)
 op("stop", (0x88, 0xFFFF, 2, _), dests = 0, can_eliminate = False)
 op("trap", (0x08, 0xFFFF, 2, _), dests = 0, can_eliminate = False)
index fdafbde..38b5d6f 100644 (file)
@@ -400,7 +400,6 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups, agx
    case AGX_OPCODE_LD_VARY:
    {
       unsigned D = agx_pack_alu_dst(I->dest[0]);
-      bool perspective = 1; // TODO
       unsigned channels = (I->channels & 0x3);
       assert(I->mask < 0xF); /* 0 indicates full mask */
       agx_index index_src = I->src[0];
@@ -408,7 +407,7 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups, agx
       unsigned index = index_src.value;
 
       uint64_t raw =
-            0x21 | (perspective ? (1 << 6) : 0) |
+            0x21 | (I->perspective ? (1 << 6) : 0) |
             ((D & 0xFF) << 7) |
             (1ull << 15) | /* XXX */
             (((uint64_t) index) << 16) |