agx: Model and pack gathers

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21264>
This commit is contained in:
Alyssa Rosenzweig
2023-02-09 22:10:05 -05:00
committed by Marge Bot
parent 8dc861dbb5
commit 978d3fefa8
4 changed files with 17 additions and 8 deletions

View File

@@ -1233,7 +1233,7 @@ agx_emit_tex(agx_builder *b, nir_tex_instr *instr)
b, tmp, coords, lod, texture, sampler, compare_offset,
agx_tex_dim(instr->sampler_dim, instr->is_array),
agx_lod_mode_for_nir(instr->op), mask, 0, !agx_is_null(packed_offset),
!agx_is_null(compare));
!agx_is_null(compare), AGX_GATHER_NONE);
if (txf)
I->op = AGX_OPCODE_TEXTURE_LOAD;

View File

@@ -338,6 +338,7 @@ typedef struct {
enum agx_dim dim : 4;
bool offset : 1;
bool shadow : 1;
enum agx_gather gather : 3;
/* Final st_vary op */
bool last : 1;
@@ -356,7 +357,7 @@ typedef struct {
bool saturate : 1;
unsigned mask : 4;
unsigned padding : 11;
unsigned padding : 8;
} agx_instr;
static inline void

View File

@@ -108,6 +108,14 @@ DIM = enum("dim", {
8: '2d_ms_array',
})
GATHER = enum("gather", {
0b000: "none",
0b001: "r",
0b011: "g",
0b101: "b",
0b111: "a",
})
OFFSET = immediate("offset", "bool")
SHADOW = immediate("shadow", "bool")
SCOREBOARD = immediate("scoreboard")
@@ -234,7 +242,8 @@ op("fcmpsel",
# TODO: anything else?
op("texture_sample",
encoding_32 = (0x31, 0x7F, 8, 10), # XXX WRONG SIZE
srcs = 5, imms = [DIM, LOD_MODE, MASK, SCOREBOARD, OFFSET, SHADOW])
srcs = 5, imms = [DIM, LOD_MODE, MASK, SCOREBOARD, OFFSET, SHADOW,
GATHER])
op("texture_load",
encoding_32 = (0x71, 0x7F, 8, 10), # XXX WRONG SIZE
srcs = 5, imms = [DIM, LOD_MODE, MASK, SCOREBOARD, OFFSET])

View File

@@ -601,12 +601,11 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups,
unsigned q2 = 0; // XXX
unsigned q3 = 12; // XXX
unsigned kill = 0; // helper invocation kill bit
unsigned q6 = 0; // XXX
uint32_t extend = ((U & BITFIELD_MASK(5)) << 0) | (kill << 5) |
((I->dim >> 3) << 7) | ((R >> 6) << 8) |
((C >> 6) << 10) | ((D >> 6) << 12) | ((T >> 6) << 14) |
((O & BITFIELD_MASK(6)) << 16) | (q6 << 22) |
((O & BITFIELD_MASK(6)) << 16) | (I->gather << 23) |
(I->offset << 27) | ((S >> 6) << 28) | ((O >> 6) << 30);
bool L = (extend != 0);