Mesa (softpipe-opt): softpipe: use one fewer divide in sample_cube

Keith Whitwell keithw at kemper.freedesktop.org
Mon Aug 24 07:48:42 UTC 2009


Module: Mesa
Branch: softpipe-opt
Commit: fd19e8adcd82e88d0fc8d187360b528100fed244
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd19e8adcd82e88d0fc8d187360b528100fed244

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sun Aug 23 19:28:34 2009 +0100

softpipe: use one fewer divide in sample_cube

GCC won't do this for us.  Makes a bigger difference to cubemap fps
than previous set of compilcated rearrangements.

---

 src/gallium/drivers/softpipe/sp_tex_sample.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 3bc4599..50460df 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -1543,9 +1543,12 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
          }
       }
 
-      ssss[j] = ( sc / ma + 1.0F ) * 0.5F;
-      tttt[j] = ( tc / ma + 1.0F ) * 0.5F;
-      samp->faces[j] = face;
+      {
+	 const float ima = 1.0 / ma;
+	 ssss[j] = ( sc * ima + 1.0F ) * 0.5F;
+	 tttt[j] = ( tc * ima + 1.0F ) * 0.5F;
+	 samp->faces[j] = face;
+      }
    }
 
    /* In our little pipeline, the compare stage is next.  If compare




More information about the mesa-commit mailing list