summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Hourihane <[email protected]>2003-12-07 23:40:13 +0000
committerAlan Hourihane <[email protected]>2003-12-07 23:40:13 +0000
commit297807d431aed30d7fff3749eea91bde84f60cfa (patch)
tree20e12e2ed9dc88c97813a797acd84956457d7197
parenta5a7d208c484c114990ee0a575629d073d847016 (diff)
merge i830 DRI driver from DRI trunk
-rw-r--r--src/mesa/drivers/dri/i830/i830_state.c3
-rw-r--r--src/mesa/drivers/dri/i830/i830_texstate.c41
2 files changed, 11 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_state.c b/src/mesa/drivers/dri/i830/i830_state.c
index 6eb46fac46d..004b49aceca 100644
--- a/src/mesa/drivers/dri/i830/i830_state.c
+++ b/src/mesa/drivers/dri/i830/i830_state.c
@@ -1248,11 +1248,14 @@ static void i830Enable(GLcontext *ctx, GLenum cap, GLboolean state)
if (imesa->hw_stencil) {
I830_STATECHANGE(imesa, I830_UPLOAD_CTX);
imesa->Setup[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
+ imesa->Setup[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
if (state) {
imesa->Setup[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
+ imesa->Setup[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
} else {
imesa->Setup[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
+ imesa->Setup[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
}
} else {
FALLBACK( imesa, I830_FALLBACK_STENCIL, state );
diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c
index 03c98d2ee96..4d211176fd2 100644
--- a/src/mesa/drivers/dri/i830/i830_texstate.c
+++ b/src/mesa/drivers/dri/i830/i830_texstate.c
@@ -62,7 +62,7 @@ static void i830SetTexImages( i830ContextPtr imesa,
GLuint total_height, pitch, i, textureFormat;
i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;
const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel];
- GLint firstLevel, lastLevel, numLevels;
+ GLint numLevels;
switch( baseImage->TexFormat->MesaFormat ) {
case MESA_FORMAT_L8:
@@ -119,52 +119,27 @@ static void i830SetTexImages( i830ContextPtr imesa,
}
/* Compute which mipmap levels we really want to send to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
- * Yes, this looks overly complicated, but it's all needed.
*/
- switch (tObj->Target) {
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- firstLevel = lastLevel = 0;
- break;
- default:
- fprintf(stderr, "%s: bad target %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(tObj->Target));
- return;
- }
-
- /* save these values */
- t->base.firstLevel = firstLevel;
- t->base.lastLevel = lastLevel;
+ driCalculateTextureFirstLastLevel( (driTextureObject *) t );
/* Figure out the amount of memory required to hold all the mipmap
* levels. Choose the smallest pitch to accomodate the largest
* mipmap:
*/
- numLevels = lastLevel - firstLevel + 1;
+ numLevels = t->base.lastLevel - t->base.firstLevel + 1;
/* Pitch would be subject to additional rules if texture memory were
* tiled. Currently it isn't.
*/
if (0) {
pitch = 128;
- while (pitch < tObj->Image[firstLevel]->Width * t->texelBytes)
+ while (pitch < tObj->Image[t->base.firstLevel]->Width * t->texelBytes)
pitch *= 2;
}
else {
- pitch = tObj->Image[firstLevel]->Width * t->texelBytes;
+ pitch = tObj->Image[t->base.firstLevel]->Width * t->texelBytes;
pitch = (pitch + 3) & ~3;
}
@@ -173,7 +148,7 @@ static void i830SetTexImages( i830ContextPtr imesa,
* lines required:
*/
for ( total_height = i = 0 ; i < numLevels ; i++ ) {
- t->image[0][i].image = tObj->Image[firstLevel + i];
+ t->image[0][i].image = tObj->Image[t->base.firstLevel + i];
if (!t->image[0][i].image)
break;
@@ -185,8 +160,8 @@ static void i830SetTexImages( i830ContextPtr imesa,
t->Pitch = pitch;
t->base.totalSize = total_height*pitch;
t->Setup[I830_TEXREG_TM0S1] =
- (((tObj->Image[firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((tObj->Image[firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) |
+ (((tObj->Image[t->base.firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) |
+ ((tObj->Image[t->base.firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) |
textureFormat);
t->Setup[I830_TEXREG_TM0S2] =
((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT));