Mesa (master): bifrost: Honor src swizzle in special math ops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 28 21:08:15 UTC 2020


Module: Mesa
Branch: master
Commit: a618631f2dd708853a50a8ffd7e00bd100e19496
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a618631f2dd708853a50a8ffd7e00bd100e19496

Author: Chris Forbes <chrisforbes at google.com>
Date:   Tue Jul 28 12:40:44 2020 -0700

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 <chrisforbes at google.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6108>

---

 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 */



More information about the mesa-commit mailing list