freedreno/ir3: Use flat.b to load flat varyings on a6xx

The flat.b/bary.f cat2 instruction should be faster than an ldlv cat6
instruction, even with a couple of additional moves (which will be
removed in the next patch).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13558>
This commit is contained in:
Matt Turner 2021-10-12 08:50:55 -07:00 committed by Marge Bot
parent 2ee1b5a526
commit 2ab0cf2b54
2 changed files with 18 additions and 3 deletions

View file

@ -1462,6 +1462,10 @@ ir3_output_conv_src_type(struct ir3_instruction *instr, type_t base_type)
*/ */
return TYPE_F32; return TYPE_F32;
case OPC_FLAT_B:
/* Treat the input data as u32 if not interpolating. */
return TYPE_U32;
default: default:
return (instr->srcs[0]->flags & IR3_REG_HALF) ? half_type(base_type) return (instr->srcs[0]->flags & IR3_REG_HALF) ? half_type(base_type)
: full_type(base_type); : full_type(base_type);

View file

@ -86,9 +86,20 @@ create_frag_input(struct ir3_context *ctx, struct ir3_instruction *coord,
if (coord) { if (coord) {
instr = ir3_BARY_F(block, inloc, 0, coord, 0); instr = ir3_BARY_F(block, inloc, 0, coord, 0);
} else if (ctx->compiler->flat_bypass) { } else if (ctx->compiler->flat_bypass) {
instr = ir3_LDLV(block, inloc, 0, create_immed(block, 1), 0); if (ctx->compiler->gen >= 6) {
instr->cat6.type = TYPE_U32; struct ir3_instruction *ij[2];
instr->cat6.iim_val = 1;
for (int i = 0; i < 2; i++) {
ij[i] = create_immed(block, fui(0.0));
}
instr = ir3_FLAT_B(block, inloc, 0, ir3_create_collect(block, ij, 2), 0);
instr->srcs[1]->wrmask = 0x3;
} else {
instr = ir3_LDLV(block, inloc, 0, create_immed(block, 1), 0);
instr->cat6.type = TYPE_U32;
instr->cat6.iim_val = 1;
}
} else { } else {
instr = ir3_BARY_F(block, inloc, 0, ctx->ij[IJ_PERSP_PIXEL], 0); instr = ir3_BARY_F(block, inloc, 0, ctx->ij[IJ_PERSP_PIXEL], 0);
instr->srcs[1]->wrmask = 0x3; instr->srcs[1]->wrmask = 0x3;