From: Alyssa Rosenzweig Date: Tue, 21 Apr 2020 17:00:44 +0000 (-0400) Subject: pan/bi: Generate TEX_COMPACT instruction X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd5fe3b9e0265c9a14ce9117b23a214d469f67c1;p=mesa.git pan/bi: Generate TEX_COMPACT instruction Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 8b7e32f5e8b..21211820dfe 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -684,7 +684,27 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr) static void emit_tex_compact(bi_context *ctx, nir_tex_instr *instr) { - unreachable("stub"); + bi_instruction tex = { + .type = BI_TEX, + .op = { .texture = BI_TEX_COMPACT }, + .dest = bir_dest_index(&instr->dest), + .dest_type = instr->dest_type, + .src_types = { nir_type_float32, nir_type_float32 }, + .writemask = instr->dest_type == nir_type_float32 ? + 0xFFFF : 0xFF, + }; + + for (unsigned i = 0; i < instr->num_srcs; ++i) { + int index = bir_src_index(&instr->src[i].src); + assert (instr->src[i].src_type == nir_tex_src_coord); + + tex.src[0] = index; + tex.src[1] = index; + tex.swizzle[0][0] = 0; + tex.swizzle[1][0] = 1; + } + + bi_emit(ctx, tex); } static void