summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-11-19 01:18:28 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-11-19 01:18:28 +0000
commit71340e861edf35bfdeb536718cd230fc33c41ee2 (patch)
tree1dcf9d944afe55103cfd24bb4123e04fc2270bc1 /src/mesa/swrast/s_texture.c
parent71515b9175df29e0b230c1930a1786779325e70d (diff)
More span rendering optimizations from Klaus Niederkrueger
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 2440225923..e1e1d0f0ce 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 */