diff options
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_aatritemp.h | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_fragprog.c | 30 | ||||
-rw-r--r-- | src/mesa/swrast/s_points.c | 71 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfilter.c | 37 |
5 files changed, 71 insertions, 77 deletions
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 42d74a16328..29609add179 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -286,7 +286,7 @@ } /* skip fragments with zero coverage */ - while (startX >= 0) { + while (startX > 0) { coverage = compute_coveragef(pMin, pMax, pMid, startX, iy); if (coverage > 0.0F) break; @@ -300,6 +300,7 @@ /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; SWspanarrays *array = span.array; + ASSERT(ix >= 0); #ifdef DO_INDEX array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy); #else diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 6656ebc0d0c..4067fd68867 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.0.3 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -41,10 +41,12 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, { GLchan rgba[4]; SWcontext *swrast = SWRAST_CONTEXT(ctx); + const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; + lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); + /* XXX use a float-valued TextureSample routine here!!! */ - swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, - 1, (const GLfloat (*)[4]) texcoord, + swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); @@ -60,7 +62,7 @@ fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, static void fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texdx[4], const GLfloat texdy[4], - GLuint unit, GLfloat color[4] ) + GLfloat lodBias, GLuint unit, GLfloat color[4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; @@ -69,15 +71,17 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texH = (GLfloat) texImg->HeightScale; GLchan rgba[4]; - GLfloat lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ - texdx[1], texdy[1], /* dt/dx, dt/dy */ - texdx[3], texdy[2], /* dq/dx, dq/dy */ - texW, texH, - texcoord[0], texcoord[1], texcoord[3], - 1.0F / texcoord[3]); + GLfloat lambda + = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ + texdx[1], texdy[1], /* dt/dx, dt/dy */ + texdx[3], texdy[2], /* dq/dx, dq/dy */ + texW, texH, + texcoord[0], texcoord[1], texcoord[3], + 1.0F / texcoord[3]) + lodBias; + + lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); - swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current, - 1, (const GLfloat (*)[4]) texcoord, + swrast->TextureSample[unit](ctx, texObj, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index ce73365a4ea..dd664b980ed 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -46,6 +46,38 @@ } while(0) + +/** + * Get/compute the point size. + * The size may come from a vertex shader, or computed with attentuation + * or just the glPointSize value. + * Must also clamp to user-defined range and implmentation limits. + */ +static INLINE GLfloat +get_size(const GLcontext *ctx, const SWvertex *vert, GLboolean smoothed) +{ + GLfloat size; + + if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { + /* use vertex's point size */ + size = vert->pointSize; + } + else { + /* use constant point size */ + size = ctx->Point.Size; + } + /* always clamp to user-specified limits */ + size = CLAMP(size, ctx->Point.MinSize, ctx->Point.MaxSize); + /* clamp to implementation limits */ + if (smoothed) + size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); + else + size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); + + return size; +} + + /** * Draw a point sprite */ @@ -68,18 +100,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert) span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); span.zStep = 0; - /* compute size */ - if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { - /* use vertex's point size */ - /* first, clamp attenuated size to the user-specifed range */ - size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize); - } - else { - /* use constant point size */ - size = ctx->Point.Size; - } - /* clamp to non-AA implementation limits */ - size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); + size = get_size(ctx, vert, GL_FALSE); /* span init */ INIT_SPAN(span, GL_POINT); @@ -237,18 +258,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert) span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); span.zStep = 0; - /* compute size */ - if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { - /* use vertex's point size */ - /* first, clamp attenuated size to the user-specifed range */ - size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize); - } - else { - /* use constant point size */ - size = ctx->Point.Size; - } - /* clamp to AA implementation limits */ - size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); + size = get_size(ctx, vert, GL_TRUE); /* alpha attenuation / fade factor */ if (ctx->Multisample.Enabled) { @@ -371,18 +381,7 @@ large_point(GLcontext *ctx, const SWvertex *vert) span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); span.zStep = 0; - /* compute size */ - if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { - /* use vertex's point size */ - /* first, clamp attenuated size to the user-specifed range */ - size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize); - } - else { - /* use constant point size */ - size = ctx->Point.Size; - } - /* clamp to non-AA implementation limits */ - size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); + size = get_size(ctx, vert, GL_FALSE); /* span init */ INIT_SPAN(span, GL_POINT); diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index fe9a70f4eae..916ddc1b973 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -129,7 +129,8 @@ read_depth_pixels( GLcontext *ctx, rb->GetRow(ctx, rb, width, x, y, dest); /* convert range from 24-bit to 32-bit */ for (k = 0; k < width; k++) { - dest[k] = (dest[k] << 8) | (dest[k] >> 24); + /* Note: put MSByte of 24-bit value into LSByte */ + dest[k] = (dest[k] << 8) | ((dest[k] >> 16) & 0xff); } } } diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index bb4e38623c9..a5594ac6232 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -1036,7 +1036,7 @@ sample_2d_linear_repeat(GLcontext *ctx, ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(img->Border == 0); - ASSERT(img->_BaseFormat != GL_COLOR_INDEX); + ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); @@ -1191,7 +1191,8 @@ sample_linear_2d( GLcontext *ctx, (void) lambda; if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT && - image->_IsPowerOfTwo) { + image->_IsPowerOfTwo && + image->Border == 0) { for (i=0;i<n;i++) { sample_2d_linear_repeat(ctx, tObj, image, texcoords[i], rgba[i]); } @@ -1230,7 +1231,7 @@ opt_sample_rgb_2d( GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->_BaseFormat==GL_RGB); + ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGB); ASSERT(img->_IsPowerOfTwo); for (k=0; k<n; k++) { @@ -1271,7 +1272,7 @@ opt_sample_rgba_2d( GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->_BaseFormat==GL_RGBA); + ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGBA); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { @@ -1301,7 +1302,7 @@ sample_lambda_2d( GLcontext *ctx, const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) - && (tImg->_BaseFormat != GL_COLOR_INDEX) + && (tImg->TexFormat->BaseFormat != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; ASSERT(lambda != NULL); @@ -1316,16 +1317,10 @@ sample_lambda_2d( GLcontext *ctx, if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { case MESA_FORMAT_RGB: - case MESA_FORMAT_RGB888: - /*case MESA_FORMAT_BGR888:*/ opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; case MESA_FORMAT_RGBA: - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: - /*case MESA_FORMAT_ABGR8888:*/ - /*case MESA_FORMAT_BGRA8888:*/ opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; @@ -1379,16 +1374,10 @@ sample_lambda_2d( GLcontext *ctx, if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { case MESA_FORMAT_RGB: - case MESA_FORMAT_RGB888: - /*case MESA_FORMAT_BGR888:*/ opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; case MESA_FORMAT_RGBA: - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: - /*case MESA_FORMAT_ABGR8888:*/ - /*case MESA_FORMAT_BGRA8888:*/ opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; @@ -2095,7 +2084,7 @@ sample_nearest_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->_BaseFormat != GL_COLOR_INDEX); + ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { GLint row, col; @@ -2131,7 +2120,7 @@ sample_linear_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->_BaseFormat != GL_COLOR_INDEX); + ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); /* XXX lots of opportunity for optimization in this loop */ for (i = 0; i < n; i++) { @@ -2873,8 +2862,8 @@ sample_depth_texture( GLcontext *ctx, (void) lambda; - ASSERT(tObj->Image[0][tObj->BaseLevel]->_BaseFormat == GL_DEPTH_COMPONENT || - tObj->Image[0][tObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL_EXT); + ASSERT(img->TexFormat->BaseFormat == GL_DEPTH_COMPONENT || + img->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || @@ -3242,7 +3231,7 @@ sample_depth_texture2(const GLcontext *ctx, * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object * isn't a depth texture. */ - if (texImage->_BaseFormat != GL_DEPTH_COMPONENT) { + if (texImage->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) { _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); return; } @@ -3345,7 +3334,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat; + const GLenum format = t->Image[0][t->BaseLevel]->TexFormat->BaseFormat; switch (t->Target) { case GL_TEXTURE_1D: |