pan/bi: Pass LD_VAR update mode explicitly

Let the compiler pass the update mode instead of inferring from the
constant value.

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/7636>
This commit is contained in:
Boris Brezillon 2020-11-16 11:41:59 +01:00
parent 4321b4fc93
commit 1176cc1297
5 changed files with 21 additions and 10 deletions

View file

@ -245,6 +245,14 @@ bi_print_load_vary(struct bi_load_vary *load, FILE *fp)
if (load->flat)
fprintf(fp, ".flat");
switch (load->update_mode) {
case BIFROST_UPDATE_STORE: fprintf(fp, ".store"); break;
case BIFROST_UPDATE_RETRIEVE: fprintf(fp, ".retrieve"); break;
case BIFROST_UPDATE_CONDITIONAL: fprintf(fp, ".conditional"); break;
case BIFROST_UPDATE_CLOBBER: fprintf(fp, ".conditional"); break;
default: unreachable("Invalid update mode");
}
}
const char *

View file

@ -228,6 +228,13 @@ enum bifrost_interp_mode {
BIFROST_INTERP_NONE = 0x4,
};
enum bifrost_update_mode {
BIFROST_UPDATE_STORE,
BIFROST_UPDATE_RETRIEVE,
BIFROST_UPDATE_CONDITIONAL,
BIFROST_UPDATE_CLOBBER,
};
/* Fixed location for gl_FragCoord.zw */
#define BIFROST_FRAGZ (23)
#define BIFROST_FRAGW (22)

View file

@ -567,6 +567,7 @@ bi_emit_ld_frag_coord(bi_context *ctx, nir_intrinsic_instr *instr)
.type = BI_LOAD_VAR,
.load_vary = {
.interp_mode = BIFROST_INTERP_CENTER,
.update_mode = BIFROST_UPDATE_CLOBBER,
.reuse = false,
.flat = true
},
@ -724,6 +725,9 @@ bi_emit_point_coord(bi_context *ctx, nir_intrinsic_instr *instr)
{
bi_instruction ins = {
.type = BI_LOAD_VAR,
.load_vary = {
.update_mode = BIFROST_UPDATE_CLOBBER,
},
.vector_channels = 2,
.dest = pan_dest_index(&instr->dest),
.dest_type = nir_type_float32,

View file

@ -134,6 +134,7 @@ extern unsigned bi_class_props[BI_NUM_CLASSES];
/* BI_LD_VARY */
struct bi_load_vary {
enum bifrost_interp_mode interp_mode;
enum bifrost_update_mode update_mode;
bool reuse;
bool flat;
};

View file

@ -215,15 +215,6 @@ def pack_seg(mod, opts, body, pack_exprs):
else:
assert(False)
# TODO: Update modes (perf / slow) For now just force store, except for special
# varyings for which we force clobber
def pack_update(mod, opts, body, pack_exprs):
if opts == ['store', 'retrieve', 'conditional', 'clobber']:
return '(ins->constant.u64 >= 20) ? 3 : 0'
else:
assert(opts[0] == 'store')
return '0'
# Processes modifiers. If used directly, emits a pack. Otherwise, just
# processes the value (grabbing it from the IR). This must sync with the IR.
@ -273,7 +264,7 @@ modifier_map = {
"not_result": pack_not_result,
"register_format": pack_register_format,
"seg": pack_seg,
"update": pack_update,
"update": lambda a,b,c,d: 'ins->load_vary.update_mode',
# Just a minus one modifier
"vecsize": lambda a,b,c,d: 'ins->vector_channels - 1',