From: Brian Paul Date: Fri, 5 Jan 2001 21:28:31 +0000 (+0000) Subject: Fixed bug in MinMagThresh computation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cbc573eae500aff6d121b2eef93fb00822622f1;p=mesa.git Fixed bug in MinMagThresh computation. Renamed gl_texture_pixels() to _swrast_texture_fragments() --- diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index cf87b96bc08..401b448a630 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -1,4 +1,4 @@ -/* $Id: s_copypix.c,v 1.8 2000/12/26 05:09:32 keithw Exp $ */ +/* $Id: s_copypix.c,v 1.9 2001/01/05 21:28:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -247,8 +247,8 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, s, t, r, q); - gl_texture_pixels(ctx, unit, width, s, t, r, NULL, - primary_rgba, rgba); + _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL, + primary_rgba, rgba); } } @@ -493,8 +493,8 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, s, t, r, q); - gl_texture_pixels(ctx, unit, width, s, t, r, NULL, - primary_rgba, rgba); + _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL, + primary_rgba, rgba); } } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 63281b2f730..766749e811f 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -1,4 +1,4 @@ -/* $Id: s_drawpix.c,v 1.6 2001/01/03 15:59:30 brianp Exp $ */ +/* $Id: s_drawpix.c,v 1.7 2001/01/05 21:28:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -810,8 +810,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, if (ctx->Texture.Unit[unit]._ReallyEnabled) { _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, s, t, r, q); - gl_texture_pixels(ctx, unit, width, s, t, r, NULL, - primary_rgba, rgba); + _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL, + primary_rgba, rgba); } } } diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index fc2a1d66331..062b4da348d 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,4 +1,4 @@ -/* $Id: s_span.c,v 1.5 2000/12/12 00:27:51 brianp Exp $ */ +/* $Id: s_span.c,v 1.6 2001/01/05 21:28:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -818,7 +818,7 @@ void gl_write_texture_span( GLcontext *ctx, /* Texturing without alpha is done after depth-testing which gives a potential speed-up. */ ASSERT(ctx->Texture._ReallyEnabled); - gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba, rgba ); + _swrast_texture_fragments( ctx, 0, n, s, t, u, lambda, rgba, rgba ); /* Do the alpha test */ if (_mesa_alpha_test( ctx, n, (const GLchan (*)[4]) rgba, mask ) == 0) { @@ -851,7 +851,7 @@ void gl_write_texture_span( GLcontext *ctx, /* Texture without alpha test */ if (! ctx->Color.AlphaEnabled) { ASSERT(ctx->Texture._ReallyEnabled); - gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba, rgba ); + _swrast_texture_fragments( ctx, 0, n, s, t, u, lambda, rgba, rgba ); } /* Add base and specular colors */ @@ -965,7 +965,8 @@ gl_write_multitexture_span( GLcontext *ctx, */ ASSERT(ctx->Texture._ReallyEnabled); for (i = 0; i < texUnits; i++) - gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], lambda[i], rgbaIn, rgba ); + _swrast_texture_fragments( ctx, i, n, s[i], t[i], u[i], + lambda[i], rgbaIn, rgba ); /* Do the alpha test */ if (_mesa_alpha_test( ctx, n, (const GLchan (*)[4])rgba, mask ) == 0) { @@ -999,8 +1000,8 @@ gl_write_multitexture_span( GLcontext *ctx, if (! ctx->Color.AlphaEnabled) { ASSERT(ctx->Texture._ReallyEnabled); for (i = 0; i < texUnits; i++) - gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], - lambda[i], rgbaIn, rgba ); + _swrast_texture_fragments( ctx, i, n, s[i], t[i], u[i], + lambda[i], rgbaIn, rgba ); } /* Add base and specular colors */ diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 29d6b46f4db..b4c81fad02e 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.6 2001/01/03 15:59:30 brianp Exp $ */ +/* $Id: s_texture.c,v 1.7 2001/01/05 21:28:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -46,8 +46,9 @@ * index - the palette index (8-bit only) * Output: red, green, blue, alpha - the texel color */ -static void palette_sample(const struct gl_texture_object *tObj, - GLint index, GLchan rgba[4] ) +static void +palette_sample(const struct gl_texture_object *tObj, + GLint index, GLchan rgba[4] ) { GLcontext *ctx = _mesa_get_current_context(); /* THIS IS A HACK */ const GLchan *palette; @@ -219,9 +220,10 @@ static void palette_sample(const struct gl_texture_object *tObj, * Given 1-D texture image and an (i) texel column coordinate, return the * texel color. */ -static void get_1d_texel( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, GLint i, - GLchan rgba[4] ) +static void +get_1d_texel( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, GLint i, + GLchan rgba[4] ) { const GLchan *texel; @@ -274,9 +276,10 @@ static void get_1d_texel( const struct gl_texture_object *tObj, /* * Return the texture sample for coordinate (s) using GL_NEAREST filter. */ -static void sample_1d_nearest( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLfloat s, GLchan rgba[4] ) +static void +sample_1d_nearest( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat s, GLchan rgba[4] ) { const GLint width = img->Width2; /* without border, power of two */ const GLchan *texel; @@ -330,10 +333,10 @@ static void sample_1d_nearest( const struct gl_texture_object *tObj, /* * Return the texture sample for coordinate (s) using GL_LINEAR filter. */ -static void sample_1d_linear( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLfloat s, - GLchan rgba[4] ) +static void +sample_1d_linear( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat s, GLchan rgba[4] ) { const GLint width = img->Width2; GLint i0, i1; @@ -456,11 +459,12 @@ sample_1d_linear_mipmap_linear( const struct gl_texture_object *tObj, -static void sample_nearest_1d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_nearest_1d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; @@ -474,11 +478,12 @@ static void sample_nearest_1d( GLcontext *ctx, GLuint texUnit, -static void sample_linear_1d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_linear_1d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; @@ -496,11 +501,12 @@ static void sample_linear_1d( GLcontext *ctx, GLuint texUnit, * return a texture sample. * */ -static void sample_lambda_1d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_lambda_1d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; GLuint i; @@ -564,9 +570,10 @@ static void sample_lambda_1d( GLcontext *ctx, GLuint texUnit, * Given a texture image and an (i,j) integer texel coordinate, return the * texel color. */ -static void get_2d_texel( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, GLint i, GLint j, - GLchan rgba[4] ) +static void +get_2d_texel( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, GLint i, GLint j, + GLchan rgba[4] ) { const GLint width = img->Width; /* includes border */ const GLchan *texel; @@ -621,10 +628,11 @@ static void get_2d_texel( const struct gl_texture_object *tObj, /* * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. */ -static void sample_2d_nearest( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLfloat s, GLfloat t, - GLchan rgba[] ) +static void +sample_2d_nearest( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat s, GLfloat t, + GLchan rgba[] ) { const GLint imgWidth = img->Width; /* includes border */ const GLint width = img->Width2; /* without border, power of two */ @@ -682,10 +690,11 @@ static void sample_2d_nearest( const struct gl_texture_object *tObj, * Return the texture sample for coordinate (s,t) using GL_LINEAR filter. * New sampling code contributed by Lynn Quam . */ -static void sample_2d_linear( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLfloat s, GLfloat t, - GLchan rgba[] ) +static void +sample_2d_linear( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat s, GLfloat t, + GLchan rgba[] ) { const GLint width = img->Width2; const GLint height = img->Height2; @@ -834,11 +843,12 @@ sample_2d_linear_mipmap_linear( const struct gl_texture_object *tObj, -static void sample_nearest_2d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_nearest_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; @@ -851,11 +861,12 @@ static void sample_nearest_2d( GLcontext *ctx, GLuint texUnit, -static void sample_linear_2d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_linear_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; @@ -871,12 +882,13 @@ static void sample_linear_2d( GLcontext *ctx, GLuint texUnit, * Given an (s,t) texture coordinate and lambda (level of detail) value, * return a texture sample. */ -static void sample_lambda_2d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, - GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_lambda_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; GLuint i; @@ -932,11 +944,12 @@ static void sample_lambda_2d( GLcontext *ctx, GLuint texUnit, * No border * Format = GL_RGB */ -static void opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, - GLuint n, const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; @@ -974,11 +987,12 @@ static void opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, * No border * Format = GL_RGBA */ -static void opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, - GLuint n, const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, + GLuint n, const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; @@ -1019,10 +1033,11 @@ static void opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, * Given a texture image and an (i,j,k) integer texel coordinate, return the * texel color. */ -static void get_3d_texel( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLint i, GLint j, GLint k, - GLchan rgba[4] ) +static void +get_3d_texel( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLint i, GLint j, GLint k, + GLchan rgba[4] ) { const GLint width = img->Width; /* includes border */ const GLint height = img->Height; /* includes border */ @@ -1080,10 +1095,11 @@ static void get_3d_texel( const struct gl_texture_object *tObj, /* * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ -static void sample_3d_nearest( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLfloat s, GLfloat t, GLfloat r, - GLchan rgba[4] ) +static void +sample_3d_nearest( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat s, GLfloat t, GLfloat r, + GLchan rgba[4] ) { const GLint imgWidth = img->Width; /* includes border, if any */ const GLint imgHeight = img->Height; /* includes border, if any */ @@ -1140,10 +1156,11 @@ static void sample_3d_nearest( const struct gl_texture_object *tObj, /* * Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. */ -static void sample_3d_linear( const struct gl_texture_object *tObj, - const struct gl_texture_image *img, - GLfloat s, GLfloat t, GLfloat r, - GLchan rgba[4] ) +static void +sample_3d_linear( const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + GLfloat s, GLfloat t, GLfloat r, + GLchan rgba[4] ) { const GLint width = img->Width2; const GLint height = img->Height2; @@ -1335,11 +1352,12 @@ sample_3d_linear_mipmap_linear( const struct gl_texture_object *tObj, } -static void sample_nearest_3d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_nearest_3d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; @@ -1351,11 +1369,12 @@ static void sample_nearest_3d( GLcontext *ctx, GLuint texUnit, -static void sample_linear_3d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_linear_3d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; @@ -1370,11 +1389,12 @@ static void sample_linear_3d( GLcontext *ctx, GLuint texUnit, * Given an (s,t,r) texture coordinate and lambda (level of detail) value, * return a texture sample. */ -static void sample_lambda_3d( GLcontext *ctx, GLuint texUnit, - const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) +static void +sample_lambda_3d( GLcontext *ctx, GLuint texUnit, + const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLchan rgba[][4] ) { GLuint i; GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; @@ -1734,9 +1754,9 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, if (needLambda) { /* Compute min/mag filter threshold */ - if (t->MagFilter==GL_LINEAR - && (t->MinFilter==GL_NEAREST_MIPMAP_NEAREST || - t->MinFilter==GL_LINEAR_MIPMAP_NEAREST)) { + if (t->MagFilter == GL_LINEAR + && (t->MinFilter == GL_NEAREST_MIPMAP_NEAREST || + t->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { swrast->_MinMagThresh[texUnit] = 0.5F; } else { @@ -2500,10 +2520,11 @@ apply_texture( const GLcontext *ctx, /* * Apply a unit of texture mapping to the incoming fragments. */ -void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat r[], GLfloat lambda[], - GLchan primary_rgba[][4], GLchan rgba[][4] ) +void +_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat r[], GLfloat lambda[], + GLchan primary_rgba[][4], GLchan rgba[][4] ) { const GLuint mask = TEXTURE0_ANY << (texUnit * 4); diff --git a/src/mesa/swrast/s_texture.h b/src/mesa/swrast/s_texture.h index edb19691e71..9a64928b5d4 100644 --- a/src/mesa/swrast/s_texture.h +++ b/src/mesa/swrast/s_texture.h @@ -1,4 +1,4 @@ -/* $Id: s_texture.h,v 1.3 2000/11/22 07:32:18 joukj Exp $ */ +/* $Id: s_texture.h,v 1.4 2001/01/05 21:28:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,9 +25,6 @@ */ - - - #ifndef S_TEXTURE_H #define S_TEXTURE_H @@ -36,15 +33,18 @@ #include "swrast.h" -extern void gl_texture_pixels( GLcontext *ctx, GLuint texSet, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat r[], GLfloat lambda[], - GLchan primary_rgba[][4], GLchan rgba[][4] ); - extern void _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj ); + +extern void +_swrast_texture_fragments( GLcontext *ctx, GLuint texSet, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat r[], GLfloat lambda[], + GLchan primary_rgba[][4], GLchan rgba[][4] ); + + #endif