summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-09-25 13:10:26 -0600
committerBrian Paul <brianp@vmware.com>2010-09-25 13:37:05 -0600
commit5ba62cd4139e95c752453a1591eb3e47b6b18238 (patch)
tree08bebad949bb055c8254614230693298a3d09037 /src/mesa/swrast
parent4e2f53bacb670b824593dce70668a8f92796ed93 (diff)
swrast: update comments for REMAINDER() macro
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_texfilter.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 3fc554c5a2..1aa2bcaf74 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -135,8 +135,11 @@ lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c,
/**
- * If A is a signed integer, A % B doesn't give the right value for A < 0
- * (in terms of texture repeat). Just casting to unsigned fixes that.
+ * Used for GL_REPEAT wrap mode. Using A % B doesn't produce the
+ * right results for A<0. Casting to A to be unsigned only works if B
+ * is a power of two. Adding a bias to A (which is a multiple of B)
+ * avoids the problems with A < 0 (for reasonable A) without using a
+ * conditional.
*/
#define REMAINDER(A, B) (((A) + (B) * 1024) % (B))