From: Alyssa Rosenzweig Date: Thu, 5 Mar 2020 22:50:18 +0000 (-0500) Subject: pan/bi: Implement nir_intrsinic_load_interpolated_input X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=07671826658dfc90ead2773c864a2ba3460a97e2;p=mesa.git pan/bi: Implement nir_intrsinic_load_interpolated_input Enough for basic varying reads. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 68dcd31b95c..6be08947d78 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -59,6 +59,51 @@ emit_jump(bi_context *ctx, nir_jump_instr *instr) bi_block_add_successor(ctx->current_block, branch->branch.target); } +static void +bi_emit_ld_vary(bi_context *ctx, nir_intrinsic_instr *instr) +{ + bi_instruction ins = { + .type = BI_LOAD_VAR, + .load_vary = { + .load = { + .location = nir_intrinsic_base(instr), + .channels = instr->num_components, + }, + .interp_mode = BIFROST_INTERP_DEFAULT, /* TODO */ + .reuse = false, /* TODO */ + .flat = instr->intrinsic != nir_intrinsic_load_interpolated_input + }, + .dest = bir_dest_index(&instr->dest), + .dest_type = nir_type_float | nir_dest_bit_size(instr->dest), + }; + + nir_src *offset = nir_get_io_offset_src(instr); + + if (nir_src_is_const(*offset)) + ins.load_vary.load.location += nir_src_as_uint(*offset); + else + ins.src[0] = bir_src_index(offset); + + bi_emit(ctx, ins); +} + +static void +emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr) +{ + + switch (instr->intrinsic) { + case nir_intrinsic_load_barycentric_pixel: + /* stub */ + break; + case nir_intrinsic_load_interpolated_input: + bi_emit_ld_vary(ctx, instr); + break; + default: + /* todo */ + break; + } +} + static void emit_instr(bi_context *ctx, struct nir_instr *instr) { @@ -67,11 +112,13 @@ emit_instr(bi_context *ctx, struct nir_instr *instr) case nir_instr_type_load_const: emit_load_const(ctx, nir_instr_as_load_const(instr)); break; +#endif case nir_instr_type_intrinsic: emit_intrinsic(ctx, nir_instr_as_intrinsic(instr)); break; +#if 0 case nir_instr_type_alu: emit_alu(ctx, nir_instr_as_alu(instr)); break;