summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-03-04 15:53:41 -0700
committerBrian Paul <brianp@vmware.com>2010-03-04 15:58:01 -0700
commitb37c54150058c07ab2d3db2d7e5891a457b51e76 (patch)
tree1429c800612808e976f89713b8ec2277345e7a0e
parent2b5c5c0dcf16062676ecfdf5efb7de650a4c5938 (diff)
softpipe: minor tweaks to texture filtering code
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index ecd6b39863..b3a79732b4 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -55,7 +55,7 @@
static INLINE float
frac(float f)
{
- return f - util_ifloor(f);
+ return f - floorf(f);
}
@@ -201,11 +201,9 @@ wrap_nearest_mirror_repeat(const float s[4], unsigned size, int icoord[4])
const float max = 1.0F - min;
for (ch = 0; ch < 4; ch++) {
const int flr = util_ifloor(s[ch]);
- float u;
+ float u = frac(s[ch]);
if (flr & 1)
- u = 1.0F - (s[ch] - (float) flr);
- else
- u = s[ch] - (float) flr;
+ u = 1.0F - u;
if (u < min)
icoord[ch] = 0;
else if (u > max)
@@ -358,11 +356,9 @@ wrap_linear_mirror_repeat(const float s[4], unsigned size,
uint ch;
for (ch = 0; ch < 4; ch++) {
const int flr = util_ifloor(s[ch]);
- float u;
+ float u = frac(s[ch]);
if (flr & 1)
- u = 1.0F - (s[ch] - (float) flr);
- else
- u = s[ch] - (float) flr;
+ u = 1.0F - u;
u = u * size - 0.5F;
icoord0[ch] = util_ifloor(u);
icoord1[ch] = icoord0[ch] + 1;