pan/bi: Extract LD_VAR sample field from ins->load_vary.interp_mode

So we can extend bi_emit_ld_vary() to support centroid and sample modes.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
This commit is contained in:
Boris Brezillon 2020-11-05 12:10:42 +01:00
parent 1692088d05
commit ca5a00a70c
4 changed files with 11 additions and 8 deletions

View File

@ -91,9 +91,9 @@ const char *
bi_interp_mode_name(enum bifrost_interp_mode mode)
{
switch (mode) {
case BIFROST_INTERP_PER_FRAG: return ".per_frag";
case BIFROST_INTERP_CENTER: return ".center";
case BIFROST_INTERP_CENTROID: return ".centroid";
case BIFROST_INTERP_DEFAULT: return "";
case BIFROST_INTERP_SAMPLE: return ".sample";
case BIFROST_INTERP_EXPLICIT: return ".explicit";
default: return ".unknown";
}

View File

@ -221,10 +221,11 @@ enum bifrost_minmax_mode {
};
enum bifrost_interp_mode {
BIFROST_INTERP_PER_FRAG = 0x0,
BIFROST_INTERP_CENTER = 0x0,
BIFROST_INTERP_CENTROID = 0x1,
BIFROST_INTERP_DEFAULT = 0x2,
BIFROST_INTERP_EXPLICIT = 0x3
BIFROST_INTERP_SAMPLE = 0x2,
BIFROST_INTERP_EXPLICIT = 0x3,
BIFROST_INTERP_NONE = 0x4,
};
/* Fixed location for gl_FragCoord.zw */

View File

@ -148,7 +148,7 @@ static void
bi_emit_ld_vary(bi_context *ctx, nir_intrinsic_instr *instr)
{
bi_instruction ins = bi_load(BI_LOAD_VAR, instr);
ins.load_vary.interp_mode = BIFROST_INTERP_DEFAULT; /* TODO */
ins.load_vary.interp_mode = BIFROST_INTERP_CENTER; /* TODO */
ins.load_vary.reuse = false; /* TODO */
ins.load_vary.flat = instr->intrinsic != nir_intrinsic_load_interpolated_input;
ins.dest_type = nir_type_float | nir_dest_bit_size(instr->dest);
@ -500,7 +500,7 @@ bi_emit_ld_frag_coord(bi_context *ctx, nir_intrinsic_instr *instr)
bi_instruction load = {
.type = BI_LOAD_VAR,
.load_vary = {
.interp_mode = BIFROST_INTERP_DEFAULT,
.interp_mode = BIFROST_INTERP_CENTER,
.reuse = false,
.flat = true
},

View File

@ -281,6 +281,9 @@ modifier_map = {
"z": lambda a,b,c,d: '(ins->src[0] != 0)',
"stencil": lambda a,b,c,d: '(ins->src[1] != 0)',
# For +LD_VAR, infer sample from load_vary.interp_mode
"sample": lambda a,b,c,d: 'ins->load_vary.interp_mode',
# We don't support these in the IR yet (TODO)
"saturate": lambda a,b,c,d: '0', # clamp to min/max int
"mask": lambda a,b,c,d: '0', # clz(~0) = ~0
@ -296,7 +299,6 @@ modifier_map = {
"func": lambda a,b,c,d: '0', # pow special case thing
"h": lambda a,b,c,d: '0', # VN_ASST1.f16
"l": lambda a,b,c,d: '0', # VN_ASST1.f16
"sample": lambda a,b,c,d: '0', # LD_VAR center
"function": lambda a,b,c,d: '3', # LD_VAR_FLAT none
"preserve_null": lambda a,b,c,d: '0', # SEG_ADD none
"bytes2": lambda a,b,c,d: '0', # NIR shifts are in bits