Mesa (master): pan/midgard: Use fp32 blend shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 1 18:05:14 UTC 2019


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Oct 31 15:50:45 2019 -0400

pan/midgard: Use fp32 blend shaders

Clearly we do want to have fp16 at some point ... but I kind of give up
debugging and it turns out the issues with fp16 support in 'frost are so
deeply rooted that I might as well disable this non-opt and land
LCRA now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 .gitlab-ci/deqp-panfrost-t760-fails.txt                  |  2 +-
 .gitlab-ci/deqp-panfrost-t860-fails.txt                  |  1 -
 src/gallium/drivers/panfrost/nir/nir_lower_blend.c       | 14 +++++++-------
 src/gallium/drivers/panfrost/nir/nir_lower_framebuffer.c |  6 +++---
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci/deqp-panfrost-t760-fails.txt b/.gitlab-ci/deqp-panfrost-t760-fails.txt
index 83c7712c2ed..f9a421e6c06 100644
--- a/.gitlab-ci/deqp-panfrost-t760-fails.txt
+++ b/.gitlab-ci/deqp-panfrost-t760-fails.txt
@@ -44,6 +44,7 @@ dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_depthbuffer.rbo_rgb565_depth_component16 Fail
 dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgba_depth_component16 Fail
 dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgb_depth_component16 Fail
+dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.zero_constant_color Fail
 dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.add_dst_color_one_minus_src_color Fail
 dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_alpha Fail
 dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_color Fail
@@ -720,7 +721,6 @@ dEQP-GLES2.functional.fragment_ops.random.72 Fail
 dEQP-GLES2.functional.fragment_ops.random.75 Fail
 dEQP-GLES2.functional.fragment_ops.random.81 Fail
 dEQP-GLES2.functional.fragment_ops.random.87 Fail
-dEQP-GLES2.functional.fragment_ops.random.94 Fail
 dEQP-GLES2.functional.fragment_ops.random.96 Fail
 dEQP-GLES2.functional.polygon_offset.default_render_with_units Fail
 dEQP-GLES2.functional.polygon_offset.fixed16_factor_1_slope Fail
diff --git a/.gitlab-ci/deqp-panfrost-t860-fails.txt b/.gitlab-ci/deqp-panfrost-t860-fails.txt
index e2a5e77bcbe..91c1f14ce1a 100644
--- a/.gitlab-ci/deqp-panfrost-t860-fails.txt
+++ b/.gitlab-ci/deqp-panfrost-t860-fails.txt
@@ -713,7 +713,6 @@ dEQP-GLES2.functional.fragment_ops.random.72 Fail
 dEQP-GLES2.functional.fragment_ops.random.75 Fail
 dEQP-GLES2.functional.fragment_ops.random.81 Fail
 dEQP-GLES2.functional.fragment_ops.random.87 Fail
-dEQP-GLES2.functional.fragment_ops.random.94 Fail
 dEQP-GLES2.functional.fragment_ops.random.96 Fail
 dEQP-GLES2.functional.polygon_offset.default_render_with_units Fail
 dEQP-GLES2.functional.polygon_offset.fixed16_factor_1_slope Fail
diff --git a/src/gallium/drivers/panfrost/nir/nir_lower_blend.c b/src/gallium/drivers/panfrost/nir/nir_lower_blend.c
index 4ed9b53b6d2..0ffe985250d 100644
--- a/src/gallium/drivers/panfrost/nir/nir_lower_blend.c
+++ b/src/gallium/drivers/panfrost/nir/nir_lower_blend.c
@@ -82,7 +82,7 @@ nir_alpha_saturate(
 {
    nir_ssa_def *Asrc = nir_channel(b, src, 3);
    nir_ssa_def *Adst = nir_channel(b, dst, 3);
-   nir_ssa_def *one = nir_imm_float16(b, 1.0);
+   nir_ssa_def *one = nir_imm_float(b, 1.0);
    nir_ssa_def *Adsti = nir_fsub(b, one, Adst);
 
    return (chan < 3) ? nir_fmin(b, Asrc, Adsti) : one;
@@ -99,7 +99,7 @@ nir_blend_factor_value(
 {
    switch (factor) {
    case BLEND_FACTOR_ZERO:
-      return nir_imm_float16(b, 0.0);
+      return nir_imm_float(b, 0.0);
    case BLEND_FACTOR_SRC_COLOR:
       return nir_channel(b, src, chan);
    case BLEND_FACTOR_DST_COLOR:
@@ -132,7 +132,7 @@ nir_blend_factor(
       nir_blend_factor_value(b, src, dst, bconst, chan, factor);
 
    if (inverted)
-      f = nir_fsub(b, nir_imm_float16(b, 1.0), f);
+      f = nir_fsub(b, nir_imm_float(b, 1.0), f);
 
    return nir_fmul(b, raw_scalar, f);
 }
@@ -167,7 +167,7 @@ nir_blend(
    nir_ssa_def *src, nir_ssa_def *dst)
 {
    /* Grab the blend constant ahead of time */
-   nir_ssa_def *bconst = nir_f2f16(b, nir_load_blend_const_color_rgba(b));
+   nir_ssa_def *bconst = nir_load_blend_const_color_rgba(b);
 
    /* We blend per channel and recombine later */
    nir_ssa_def *channels[4];
@@ -249,13 +249,13 @@ nir_lower_blend(nir_shader *shader, nir_lower_blend_options options)
             b.cursor = nir_before_instr(instr);
 
             /* Grab the input color */
-            nir_ssa_def *src = nir_f2f16(&b, nir_ssa_for_src(&b, intr->src[1], 4));
+            nir_ssa_def *src = nir_ssa_for_src(&b, intr->src[1], 4);
 
             /* Grab the tilebuffer color - io lowered to load_output */
-            nir_ssa_def *dst = nir_f2f16(&b, nir_load_var(&b, var));
+            nir_ssa_def *dst = nir_load_var(&b, var);
 
             /* Blend the two colors per the passed options */
-            nir_ssa_def *blended = nir_f2f32(&b, nir_blend(&b, options, src, dst));
+            nir_ssa_def *blended = nir_blend(&b, options, src, dst);
 
             /* Write out the final color instead of the input */
             nir_instr_rewrite_src(instr, &intr->src[1],
diff --git a/src/gallium/drivers/panfrost/nir/nir_lower_framebuffer.c b/src/gallium/drivers/panfrost/nir/nir_lower_framebuffer.c
index 040cf698776..9afbbe4dd01 100644
--- a/src/gallium/drivers/panfrost/nir/nir_lower_framebuffer.c
+++ b/src/gallium/drivers/panfrost/nir/nir_lower_framebuffer.c
@@ -49,14 +49,14 @@ static nir_ssa_def *
 nir_float_to_unorm8(nir_builder *b, nir_ssa_def *c_float)
 {
    /* First, we degrade quality to fp16; we don't need the extra bits */
-   nir_ssa_def *degraded = nir_f2f16(b, c_float);
+   nir_ssa_def *degraded = /*nir_f2f16(b, c_float)*/c_float;
 
    /* Scale from [0, 1] to [0, 255.0] */
    nir_ssa_def *scaled = nir_fmul_imm(b, nir_fsat(b, degraded), 255.0);
 
    /* Next, we type convert */
    nir_ssa_def *converted = nir_u2u8(b, nir_f2u16(b,
-                                     nir_fround_even(b, scaled)));
+                                     nir_fround_even(b, nir_f2f16(b, scaled))));
 
    return converted;
 }
@@ -65,7 +65,7 @@ static nir_ssa_def *
 nir_unorm8_to_float(nir_builder *b, nir_ssa_def *c_native)
 {
    /* First, we convert up from u8 to f16 */
-   nir_ssa_def *converted = nir_u2f16(b, nir_u2u16(b, c_native));
+   nir_ssa_def *converted = nir_f2f32(b, nir_u2f16(b, nir_u2u16(b, c_native)));
 
    /* Next, we scale down from [0, 255.0] to [0, 1] */
    nir_ssa_def *scaled = nir_fsat(b, nir_fmul_imm(b, converted, 1.0/255.0));




More information about the mesa-commit mailing list