summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-10-03 19:30:48 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-10-03 19:30:48 +0200
commit6d25b9125ec1e66e0e255b0ee20fe18dfe1076fa (patch)
treec376951940eac2875567979a81e6a03a019942b7 /src/mesa/swrast
parent81c7561d9d3faf70ac22c6a5f3fbea18f53eed92 (diff)
parent7d2699aedc084d9cb9c2bd2f8bdb5f038271ac1e (diff)
Merge branch 'master' into r300-compiler
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_fragprog.c11
-rw-r--r--src/mesa/swrast/s_readpix.c6
-rw-r--r--src/mesa/swrast/s_span.c4
-rw-r--r--src/mesa/swrast/s_texfilter.c12
4 files changed, 19 insertions, 14 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 613a91b0ec..77a77f0bcb 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -89,6 +89,8 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
* Fetch a texel with the given partial derivatives to compute a level
* of detail in the mipmap.
* Called via machine->FetchTexelDeriv()
+ * \param lodBias the lod bias which may be specified by a TXB instruction,
+ * otherwise zero.
*/
static void
fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
@@ -96,7 +98,8 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
GLfloat lodBias, GLuint unit, GLfloat color[4] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_texture_object *texObj = texUnit->_Current;
if (texObj) {
const struct gl_texture_image *texImg =
@@ -108,10 +111,12 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
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 */
+ texdx[3], texdy[3], /* dq/dx, dq/dy */
texW, texH,
texcoord[0], texcoord[1], texcoord[3],
- 1.0F / texcoord[3]) + lodBias;
+ 1.0F / texcoord[3]);
+
+ lambda += lodBias + texUnit->LodBias + texObj->LodBias;
lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 48b9408d24..a1aeb2e01f 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -555,15 +555,15 @@ _swrast_ReadPixels( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct gl_pixelstore_attrib clippedPacking = *packing;
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
/* Need to do swrast_render_start() before clipping or anything else
* since this is where a driver may grab the hw lock and get an updated
* window size.
*/
swrast_render_start(ctx);
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (swrast->NewState)
_swrast_validate_derived( ctx );
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index a45eac438e..704230d1d7 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -904,7 +904,6 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span)
}
}
-#if FEATURE_ARB_occlusion_query
if (ctx->Query.CurrentOcclusionObject) {
/* update count of 'passed' fragments */
struct gl_query_object *q = ctx->Query.CurrentOcclusionObject;
@@ -912,7 +911,6 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span)
for (i = 0; i < span->end; i++)
q->Result += span->array->mask[i];
}
-#endif
/* we have to wait until after occlusion to do this test */
if (ctx->Color.IndexMask == 0) {
@@ -1376,7 +1374,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
}
}
-#if FEATURE_ARB_occlusion_query
if (ctx->Query.CurrentOcclusionObject) {
/* update count of 'passed' fragments */
struct gl_query_object *q = ctx->Query.CurrentOcclusionObject;
@@ -1384,7 +1381,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
for (i = 0; i < span->end; i++)
q->Result += span->array->mask[i];
}
-#endif
/* We had to wait until now to check for glColorMask(0,0,0,0) because of
* the occlusion test.
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 6b1f934647..004d4e05ae 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -1862,7 +1862,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
GLuint face;
GLfloat sc, tc, ma;
- if (arx > ary && arx > arz) {
+ if (arx >= ary && arx >= arz) {
if (rx >= 0.0F) {
face = FACE_POS_X;
sc = -rz;
@@ -1876,7 +1876,7 @@ choose_cube_face(const struct gl_texture_object *texObj,
ma = arx;
}
}
- else if (ary > arx && ary > arz) {
+ else if (ary >= arx && ary >= arz) {
if (ry >= 0.0F) {
face = FACE_POS_Y;
sc = rx;
@@ -1905,8 +1905,12 @@ choose_cube_face(const struct gl_texture_object *texObj,
}
}
- newCoord[0] = ( sc / ma + 1.0F ) * 0.5F;
- newCoord[1] = ( tc / ma + 1.0F ) * 0.5F;
+ {
+ const float ima = 1.0F / ma;
+ newCoord[0] = ( sc * ima + 1.0F ) * 0.5F;
+ newCoord[1] = ( tc * ima + 1.0F ) * 0.5F;
+ }
+
return (const struct gl_texture_image **) texObj->Image[face];
}