Mesa (master): softpipe: fix integer texture swizzling for 1 vs 1.0f

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 21 23:32:36 UTC 2019


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Mar 21 15:22:02 2019 +1000

softpipe: fix integer texture swizzling for 1 vs 1.0f

The swizzling was putting float one in not integer 1.

This fixes a lot of arb_texture_view-rendering-formats cases.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/drivers/softpipe/sp_tex_sample.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 92c78da86f3..26d38296073 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -2754,6 +2754,7 @@ do_swizzling(const struct pipe_sampler_view *sview,
    const unsigned swizzle_g = sview->swizzle_g;
    const unsigned swizzle_b = sview->swizzle_b;
    const unsigned swizzle_a = sview->swizzle_a;
+   float oneval = util_format_is_pure_integer(sview->format) ? uif(1) : 1.0f;
 
    switch (swizzle_r) {
    case PIPE_SWIZZLE_0:
@@ -2762,7 +2763,7 @@ do_swizzling(const struct pipe_sampler_view *sview,
       break;
    case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
-         out[0][j] = 1.0f;
+         out[0][j] = oneval;
       break;
    default:
       assert(swizzle_r < 4);
@@ -2777,7 +2778,7 @@ do_swizzling(const struct pipe_sampler_view *sview,
       break;
    case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
-         out[1][j] = 1.0f;
+         out[1][j] = oneval;
       break;
    default:
       assert(swizzle_g < 4);
@@ -2792,7 +2793,7 @@ do_swizzling(const struct pipe_sampler_view *sview,
       break;
    case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
-         out[2][j] = 1.0f;
+         out[2][j] = oneval;
       break;
    default:
       assert(swizzle_b < 4);
@@ -2807,7 +2808,7 @@ do_swizzling(const struct pipe_sampler_view *sview,
       break;
    case PIPE_SWIZZLE_1:
       for (j = 0; j < 4; j++)
-         out[3][j] = 1.0f;
+         out[3][j] = oneval;
       break;
    default:
       assert(swizzle_a < 4);




More information about the mesa-commit mailing list