[Mesa-dev] [PATCH] softpipe: Change faces type to uint

Krzesimir Nowak qdlacz at gmail.com
Sat Sep 12 07:17:34 PDT 2015


This is to avoid needless float<->int conversions, since all
face-related computations are made on integers. Spotted by Emil
Velikov.
---
 src/gallium/drivers/softpipe/sp_tex_sample.c | 10 +++++-----
 src/gallium/drivers/softpipe/sp_tex_sample.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index dfe38af..8a09350 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -2200,7 +2200,7 @@ img_filter_2d_ewa(const struct sp_sampler_view *sp_sview,
                   const float s[TGSI_QUAD_SIZE],
                   const float t[TGSI_QUAD_SIZE],
                   const float p[TGSI_QUAD_SIZE],
-                  const float faces[TGSI_QUAD_SIZE],
+                  const uint faces[TGSI_QUAD_SIZE],
                   unsigned level,
                   const float dudx, const float dvdx,
                   const float dudy, const float dvdy,
@@ -3089,7 +3089,7 @@ convert_cube(const struct sp_sampler_view *sp_sview,
              float ssss[TGSI_QUAD_SIZE],
              float tttt[TGSI_QUAD_SIZE],
              float pppp[TGSI_QUAD_SIZE],
-             float faces[TGSI_QUAD_SIZE])
+             uint faces[TGSI_QUAD_SIZE])
 {
    unsigned j;
 
@@ -3564,14 +3564,14 @@ sp_tgsi_get_samples(struct tgsi_sampler *tgsi_sampler,
       float cs[TGSI_QUAD_SIZE];
       float ct[TGSI_QUAD_SIZE];
       float cp[TGSI_QUAD_SIZE];
-      float faces[TGSI_QUAD_SIZE];
+      uint faces[TGSI_QUAD_SIZE];
 
       convert_cube(sp_sview, sp_samp, s, t, p, c0, cs, ct, cp, faces);
 
       filt_args.faces = faces;
       sample_mip(sp_sview, sp_samp, cs, ct, cp, c0, lod, &filt_args, rgba);
    } else {
-      static const float zero_faces[TGSI_QUAD_SIZE] = {0.0f, 0.0f, 0.0f, 0.0f};
+      static const uint zero_faces[TGSI_QUAD_SIZE] = {0, 0, 0, 0};
 
       filt_args.faces = zero_faces;
       sample_mip(sp_sview, sp_samp, s, t, p, c0, lod, &filt_args, rgba);
@@ -3619,7 +3619,7 @@ sp_tgsi_query_lod(const struct tgsi_sampler *tgsi_sampler,
       float cs[TGSI_QUAD_SIZE];
       float ct[TGSI_QUAD_SIZE];
       float cp[TGSI_QUAD_SIZE];
-      float unused_faces[TGSI_QUAD_SIZE];
+      uint unused_faces[TGSI_QUAD_SIZE];
 
       convert_cube(sp_sview, sp_samp, s, t, p, c0, cs, ct, cp, unused_faces);
       compute_lambda_lod_unclamped(sp_sview, sp_samp,
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h
index 83ee3a3..d591487 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.h
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.h
@@ -72,7 +72,7 @@ typedef void (*img_filter_func)(const struct sp_sampler_view *sp_sview,
 struct filter_args {
    enum tgsi_sampler_control control;
    const int8_t *offset;
-   const float *faces;
+   const uint *faces;
 };
 
 typedef void (*mip_filter_func)(const struct sp_sampler_view *sp_sview,
-- 
2.4.3



More information about the mesa-dev mailing list