summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r--src/mesa/swrast/s_texture.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 24402259233..e1e1d0f0ceb 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.41 2001/10/17 23:03:34 brianp Exp $ */
+/* $Id: s_texture.c,v 1.42 2001/11/19 01:18:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -956,6 +956,28 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit,
}
}
+#ifdef DEBUG
+static int
+span_is_monotonous (GLuint n, const GLfloat lambda[])
+{
+ GLuint i;
+
+ if (n <= 1) /* array too short */
+ return GL_TRUE;
+ else if (lambda[0] >= lambda[n-1]) { /* decreasing */
+ for (i=0; i<n-1; i++)
+ if (lambda[i] < lambda[i+1])
+ return GL_FALSE;
+ }
+ else { /* increasing */
+ for (i=0; i<n-1; i++)
+ if (lambda[i] > lambda[i+1])
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+#endif /* DEBUG */
/*
* Given an array of (s,t) texture coordinate and lambda (level of detail)
@@ -973,6 +995,10 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit,
GLuint i;
(void) u;
+#ifdef DEBUG
+ ASSERT (span_is_monotonous(n, lambda) == GL_TRUE);
+#endif /* DEBUG */
+
/* since lambda is monotonous-array use this check first */
if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) {
/* magnification for whole span */