From 71340e861edf35bfdeb536718cd230fc33c41ee2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 19 Nov 2001 01:18:28 +0000 Subject: More span rendering optimizations from Klaus Niederkrueger --- src/mesa/swrast/s_texture.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/mesa/swrast/s_texture.c') 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 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 */ -- cgit v1.2.3