From a618631f2dd708853a50a8ffd7e00bd100e19496 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 28 Jul 2020 12:40:44 -0700 Subject: [PATCH] bifrost: Honor src swizzle in special math ops Most ops use the common handling in emit_alu in order to convert NIR sources to bifrost sources, but the "special" math op lowering handrolls the conversion (due to needing to reference the same source multiple times). Unfortunately, that handrolled lowering did not consider that there might be a non-identity swizzle on the source. In this case we would reference the wrong component of the source and generate garbage. Fixes all but two of the remaining failures on G31 in: dEQP-GLES2.functional.shaders.operator.exponential.*highp* The following tests are still broken due to some other issue: dEQP-GLES2.functional.shaders.operator.exponential.exp2.highp_float_fragment dEQP-GLES2.functional.shaders.operator.exponential.exp2.highp_vec2_fragment Signed-off-by: Chris Forbes Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_special.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/bi_special.c b/src/panfrost/bifrost/bi_special.c index 4cb9e151631..16e4d2eb892 100644 --- a/src/panfrost/bifrost/bi_special.c +++ b/src/panfrost/bifrost/bi_special.c @@ -58,7 +58,8 @@ bi_emit_fexp2_new(bi_context *ctx, nir_alu_instr *instr) /* 0x3f80000000 = 1.0f as fp32 * 24 = shift to multiply by 2^24 */ .u64 = (0x3f800000) | (24ull << 32) - } + }, + .swizzle = { { instr->src[0].swizzle[0] } } }; /* F2I_RTE T, T */ @@ -81,6 +82,7 @@ bi_emit_fexp2_new(bi_context *ctx, nir_alu_instr *instr) .dest_type = nir_type_float32, .src = { f2i.dest, mscale.src[0] }, .src_types = { nir_type_int32, nir_type_float32 }, + .swizzle = { {}, { instr->src[0].swizzle[0] } } }; bi_emit(ctx, mscale); @@ -100,7 +102,8 @@ bi_emit_flog2_new(bi_context *ctx, nir_alu_instr *instr) .dest = bi_make_temp(ctx), .dest_type = nir_type_int32, .src = { pan_src_index(&instr->src[0].src) }, - .src_types = { nir_type_float32 } + .src_types = { nir_type_float32 }, + .swizzle = { { instr->src[0].swizzle[0] } } }; /* I32_TO_F32 m */ @@ -126,7 +129,8 @@ bi_emit_flog2_new(bi_context *ctx, nir_alu_instr *instr) .src_types = { nir_type_float32, nir_type_float32 }, .constant = { .u64 = 0xBF800000 /* -1.0 */ - } + }, + .swizzle = { {}, { instr->src[0].swizzle[0] } } }; /* FLOG2_HELP log2(x)/(x-1), x */ @@ -137,6 +141,7 @@ bi_emit_flog2_new(bi_context *ctx, nir_alu_instr *instr) .dest_type = nir_type_float32, .src = { pan_src_index(&instr->src[0].src) }, .src_types = { nir_type_float32 }, + .swizzle = { { instr->src[0].swizzle[0] } } }; /* FMA log2(x)/(x - 1), (x - 1), M */ -- 2.30.2