diff options
35 files changed, 379 insertions, 455 deletions
diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c index 7f60ca82a6..09857f1dc8 100644 --- a/src/mesa/drivers/d3d/D3Dvbrender.c +++ b/src/mesa/drivers/d3d/D3Dvbrender.c @@ -1516,7 +1516,7 @@ static void SetRenderStates( GLcontext *ctx ) switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode ) { case GL_MODULATE: - if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format == GL_RGBA ) + if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA ) dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulatealpha]; else dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulate]; @@ -1531,7 +1531,7 @@ static void SetRenderStates( GLcontext *ctx ) break; case GL_DECAL: - if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format == GL_RGBA ) + if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA ) dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha]; else dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal]; @@ -1592,12 +1592,12 @@ static void SetRenderStates( GLcontext *ctx ) CreateTMgrHAL( pContext->pShared, texName, 0, - ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format, + ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format, (RECT *)NULL, - ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Width, - ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Height, + ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Width, + ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Height, TM_ACTION_BIND, - (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Data ); + (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Data ); // } bTexture = TRUE; } @@ -1884,7 +1884,7 @@ static void DebugRenderStates( GLcontext *ctx, BOOL bForce ) textName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name; DPF(( 0, "\tTexture Name:\t%d", textName )); DPF(( 0, "\tTexture Format:\t%s", - (ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format == GL_RGBA) ? + (ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA) ? "GL_RGBA" : "GLRGB" )); } diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index 53e87b9593..a40d33f1e9 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1183,7 +1183,7 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) { struct gl_texture_object * const tObj = t->tObj; const struct gl_texture_image * const baseImage = - tObj->Image[tObj->BaseLevel]; + tObj->Image[0][tObj->BaseLevel]; /* These must be signed values. MinLod and MaxLod can be negative numbers, * and having firstLevel and lastLevel as signed prevents the need for diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index 9afbb0c865..f0c416fc61 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -89,16 +89,17 @@ struct dri_texture_object { * the framebuffer. */ - unsigned firstLevel; /**< Image in \c tObj->Image that + unsigned firstLevel; /**< Image in \c tObj->Image[0] that * corresponds to the base-level of * this texture object. */ - unsigned lastLevel; /**< Last image in \c tObj->Image used - * by the current LOD settings of this - * texture object. This value must be - * greater than or equal to - * \c firstLevel. + unsigned lastLevel; /**< Last image in \c tObj->Image[0] + * used by the + * current LOD settings of + * this texture object. This + * value must be greater than + * or equal to \c firstLevel. */ }; diff --git a/src/mesa/drivers/dri/gamma/gamma_context.h b/src/mesa/drivers/dri/gamma/gamma_context.h index 92836178b6..3db5b23cb0 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.h +++ b/src/mesa/drivers/dri/gamma/gamma_context.h @@ -149,7 +149,7 @@ struct gamma_texture_object_t { GLuint max_level; GLuint dirty_images; - GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */ + GLint firstLevel, lastLevel; /* upload tObj->Image[0][first .. lastLevel] */ struct { const struct gl_texture_image *image; diff --git a/src/mesa/drivers/dri/gamma/gamma_texstate.c b/src/mesa/drivers/dri/gamma/gamma_texstate.c index dfd82b489c..a8d1b253c7 100644 --- a/src/mesa/drivers/dri/gamma/gamma_texstate.c +++ b/src/mesa/drivers/dri/gamma/gamma_texstate.c @@ -17,7 +17,7 @@ static void gammaSetTexImages( gammaContextPtr gmesa, { GLuint height, width, pitch, i, log_pitch; gammaTextureObjectPtr t = (gammaTextureObjectPtr) tObj->DriverData; - const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; GLint firstLevel, lastLevel, numLevels; GLint log2Width, log2Height; @@ -49,15 +49,15 @@ static void gammaSetTexImages( gammaContextPtr gmesa, numLevels = lastLevel - firstLevel + 1; - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; + log2Width = tObj->Image[0][firstLevel]->WidthLog2; + log2Height = tObj->Image[0][firstLevel]->HeightLog2; /* Figure out the amount of memory required to hold all the mipmap * levels. Choose the smallest pitch to accomodate the largest * mipmap: */ - width = tObj->Image[firstLevel]->Width * t->texelBytes; + width = tObj->Image[0][firstLevel]->Width * t->texelBytes; for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 ) log_pitch++; @@ -65,7 +65,7 @@ static void gammaSetTexImages( gammaContextPtr gmesa, * lines required: */ for ( height = i = 0 ; i < numLevels ; i++ ) { - t->image[i].image = tObj->Image[firstLevel + i]; + t->image[i].image = tObj->Image[0][firstLevel + i]; t->image[i].offset = height * pitch; t->image[i].internalFormat = baseImage->Format; height += t->image[i].image->Height; @@ -86,7 +86,7 @@ static void gammaUpdateTexEnv( GLcontext *ctx, GLuint unit ) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *tObj = texUnit->_Current; - const GLuint format = tObj->Image[tObj->BaseLevel]->Format; + const GLuint format = tObj->Image[0][tObj->BaseLevel]->Format; gammaTextureObjectPtr t = (gammaTextureObjectPtr)tObj->DriverData; GLuint tc; @@ -167,7 +167,7 @@ static void gammaUpdateTexUnit( GLcontext *ctx, GLuint unit ) } #if 0 - if (tObj->Image[tObj->BaseLevel]->Border > 0) { + if (tObj->Image[0][tObj->BaseLevel]->Border > 0) { FALLBACK( gmesa, GAMMA_FALLBACK_TEXTURE, GL_TRUE ); return; } @@ -185,8 +185,8 @@ static void gammaUpdateTexUnit( GLcontext *ctx, GLuint unit ) /* Update texture environment if texture object image format or * texture environment state has changed. */ - if (tObj->Image[tObj->BaseLevel]->Format != gmesa->TexEnvImageFmt[unit]) { - gmesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format; + if (tObj->Image[0][tObj->BaseLevel]->Format != gmesa->TexEnvImageFmt[unit]) { + gmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format; gammaUpdateTexEnv( ctx, unit ); } } diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index 05f685c588..e100c565cb 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -46,7 +46,7 @@ static void i810SetTexImages( i810ContextPtr imesa, { GLuint height, width, pitch, i, textureFormat, log_pitch; i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData; - const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; GLint numLevels; GLint log2Width, log2Height; @@ -84,14 +84,14 @@ static void i810SetTexImages( i810ContextPtr imesa, numLevels = t->base.lastLevel - t->base.firstLevel + 1; - log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; - log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; + log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2; /* Figure out the amount of memory required to hold all the mipmap * levels. Choose the smallest pitch to accomodate the largest * mipmap: */ - width = tObj->Image[t->base.firstLevel]->Width * t->texelBytes; + width = tObj->Image[0][t->base.firstLevel]->Width * t->texelBytes; for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 ) log_pitch++; @@ -99,7 +99,7 @@ static void i810SetTexImages( i810ContextPtr imesa, * lines required: */ for ( height = i = 0 ; i < numLevels ; i++ ) { - t->image[i].image = tObj->Image[t->base.firstLevel + i]; + t->image[i].image = tObj->Image[0][t->base.firstLevel + i]; t->image[i].offset = height * pitch; t->image[i].internalFormat = baseImage->Format; height += t->image[i].image->Height; @@ -553,7 +553,7 @@ static void i810UpdateTexEnv( GLcontext *ctx, GLuint unit ) i810ContextPtr imesa = I810_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *tObj = texUnit->_Current; - const GLuint format = tObj->Image[tObj->BaseLevel]->Format; + const GLuint format = tObj->Image[0][tObj->BaseLevel]->Format; GLuint color_combine, alpha_combine; switch (texUnit->EnvMode) { @@ -692,7 +692,7 @@ static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit ) } } - if (tObj->Image[tObj->BaseLevel]->Border > 0) { + if (tObj->Image[0][tObj->BaseLevel]->Border > 0) { FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE ); return; } @@ -712,8 +712,8 @@ static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit ) /* Update texture environment if texture object image format or * texture environment state has changed. */ - if (tObj->Image[tObj->BaseLevel]->Format != imesa->TexEnvImageFmt[unit]) { - imesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format; + if (tObj->Image[0][tObj->BaseLevel]->Format != imesa->TexEnvImageFmt[unit]) { + imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format; i810UpdateTexEnv( ctx, unit ); } } diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c index 34f13d8133..8e93a5b8fe 100644 --- a/src/mesa/drivers/dri/i830/i830_texstate.c +++ b/src/mesa/drivers/dri/i830/i830_texstate.c @@ -61,7 +61,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]; + const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; GLint numLevels; switch( baseImage->TexFormat->MesaFormat ) { @@ -135,11 +135,11 @@ static void i830SetTexImages( i830ContextPtr imesa, */ if (0) { pitch = 128; - while (pitch < tObj->Image[t->base.firstLevel]->Width * t->texelBytes) + while (pitch < tObj->Image[0][t->base.firstLevel]->Width * t->texelBytes) pitch *= 2; } else { - pitch = tObj->Image[t->base.firstLevel]->Width * t->texelBytes; + pitch = tObj->Image[0][t->base.firstLevel]->Width * t->texelBytes; pitch = (pitch + 3) & ~3; } @@ -148,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[t->base.firstLevel + i]; + t->image[0][i].image = tObj->Image[0][t->base.firstLevel + i]; if (!t->image[0][i].image) break; @@ -160,8 +160,8 @@ static void i830SetTexImages( i830ContextPtr imesa, t->Pitch = pitch; t->base.totalSize = total_height*pitch; t->Setup[I830_TEXREG_TM0S1] = - (((tObj->Image[t->base.firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) | - ((tObj->Image[t->base.firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) | + (((tObj->Image[0][t->base.firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) | + ((tObj->Image[0][t->base.firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) | textureFormat); t->Setup[I830_TEXREG_TM0S2] = ((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT)); @@ -1328,7 +1328,7 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) i830TextureObjectPtr t = (i830TextureObjectPtr)tObj->DriverData; /* Fallback if there's a texture border */ - if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) { + if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) { return GL_FALSE; } @@ -1366,9 +1366,9 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) * missed (need to update last stage flag?). Call * i830UpdateTexEnv always. */ - if (tObj->Image[tObj->BaseLevel]->Format != + if (tObj->Image[0][tObj->BaseLevel]->Format != imesa->TexEnvImageFmt[unit]) { - imesa->TexEnvImageFmt[unit] = tObj->Image[tObj->BaseLevel]->Format; + imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format; } i830UpdateTexEnv( ctx, unit ); imesa->TexEnabledMask |= I830_TEX_UNIT_ENABLED(unit); diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index e22a69e052..5f63d5ca46 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -65,7 +65,7 @@ mgaSetTexImages( mgaContextPtr mmesa, const struct gl_texture_object * tObj ) { mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; - struct gl_texture_image *baseImage = tObj->Image[ tObj->BaseLevel ]; + struct gl_texture_image *baseImage = tObj->Image[0][ tObj->BaseLevel ]; GLint totalSize; GLint width, height; GLint i; @@ -110,12 +110,12 @@ mgaSetTexImages( mgaContextPtr mmesa, log2Width = 0; log2Height = 0; } else { - log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; - log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; + log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2; } - width = tObj->Image[t->base.firstLevel]->Width; - height = tObj->Image[t->base.firstLevel]->Height; + width = tObj->Image[0][t->base.firstLevel]->Width; + height = tObj->Image[0][t->base.firstLevel]->Height; numLevels = MIN2( t->base.lastLevel - t->base.firstLevel + 1, MGA_IS_G200(mmesa) ? G200_TEX_MAXLEVELS : G400_TEX_MAXLEVELS); @@ -124,7 +124,7 @@ mgaSetTexImages( mgaContextPtr mmesa, totalSize = 0; for ( i = 0 ; i < numLevels ; i++ ) { const struct gl_texture_image * const texImage = - tObj->Image[ i + t->base.firstLevel ]; + tObj->Image[0][ i + t->base.firstLevel ]; int size; if (texImage == NULL) @@ -204,7 +204,7 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit ) mgaContextPtr mmesa = MGA_CONTEXT(ctx); struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current; mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; - GLenum format = tObj->Image[tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; if (tObj != ctx->Texture.Unit[0].Current2D && tObj != ctx->Texture.Unit[0].CurrentRect) @@ -536,7 +536,7 @@ static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source]; const struct gl_texture_object *tObj = texUnit->_Current; GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit); - GLenum format = tObj->Image[tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; *reg = 0; @@ -633,7 +633,7 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) const struct gl_texture_object *tObj = texUnit->_Current; GLuint *reg = ((GLuint *)&mmesa->setup.tdualstage0 + unit); mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; - GLenum format = tObj->Image[tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; if (tObj != ctx->Texture.Unit[source].Current2D && tObj != ctx->Texture.Unit[source].CurrentRect) @@ -780,7 +780,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; /* Fallback if there's a texture border */ - if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) { + if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) { return GL_FALSE; } diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c index 66c69bf3e5..01acb9ee73 100644 --- a/src/mesa/drivers/dri/mga/mgatexmem.c +++ b/src/mesa/drivers/dri/mga/mgatexmem.c @@ -105,7 +105,7 @@ static void mgaUploadSubImage( mgaContextPtr mmesa, return; } - texImage = t->base.tObj->Image[level]; + texImage = t->base.tObj->Image[0][level]; if ( texImage == NULL ) { fprintf( stderr, "[%s:%d] Image[%d] = NULL\n", __FILE__, __LINE__, level ); diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index 7bffaf4628..63ef0f17b4 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -93,7 +93,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, if ( ( level < 0 ) || ( level > R128_MAX_TEXTURE_LEVELS ) ) return; - image = t->base.tObj->Image[level]; + image = t->base.tObj->Image[0][level]; if ( !image ) return; diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 3c43eb4528..3965bbdb39 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -51,7 +51,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, const struct gl_texture_object *tObj ) { r128TexObjPtr t = (r128TexObjPtr) tObj->DriverData; - struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; int log2Pitch, log2Height, log2Size, log2MinSize; int totalSize; int i; @@ -96,8 +96,8 @@ static void r128SetTexImages( r128ContextPtr rmesa, firstLevel = t->base.firstLevel; lastLevel = t->base.lastLevel; - log2Pitch = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; + log2Pitch = tObj->Image[0][firstLevel]->WidthLog2; + log2Height = tObj->Image[0][firstLevel]->HeightLog2; log2Size = MAX2(log2Pitch, log2Height); log2MinSize = log2Size; @@ -106,7 +106,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, for ( i = firstLevel; i <= lastLevel; i++ ) { const struct gl_texture_image *texImage; - texImage = tObj->Image[i]; + texImage = tObj->Image[0][i]; if ( !texImage || !texImage->Data ) { lastLevel = i - 1; break; @@ -115,14 +115,14 @@ static void r128SetTexImages( r128ContextPtr rmesa, log2MinSize = texImage->MaxLog2; t->image[i - firstLevel].offset = totalSize; - t->image[i - firstLevel].width = tObj->Image[i]->Width; - t->image[i - firstLevel].height = tObj->Image[i]->Height; + t->image[i - firstLevel].width = tObj->Image[0][i]->Width; + t->image[i - firstLevel].height = tObj->Image[0][i]->Height; t->base.dirty_images[0] |= (1 << i); - totalSize += (tObj->Image[i]->Height * - tObj->Image[i]->Width * - tObj->Image[i]->TexFormat->TexelBytes); + totalSize += (tObj->Image[0][i]->Height * + tObj->Image[0][i]->Width * + tObj->Image[0][i]->TexFormat->TexelBytes); /* Offsets must be 32-byte aligned for host data blits and tiling */ totalSize = (totalSize + 31) & ~31; @@ -199,7 +199,7 @@ static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit ) GLint source = rmesa->tmu_source[unit]; const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source]; const struct gl_texture_object *tObj = texUnit->_Current; - const GLenum format = tObj->Image[tObj->BaseLevel]->Format; + const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; GLuint combine; if ( R128_DEBUG & DEBUG_VERBOSE_API ) { @@ -535,7 +535,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) /* Fallback if there's a texture border */ - if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) { + if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) { return GL_FALSE; } diff --git a/src/mesa/drivers/dri/r200/r200_texmem.c b/src/mesa/drivers/dri/r200/r200_texmem.c index 1929397bfb..ed0ca58690 100644 --- a/src/mesa/drivers/dri/r200/r200_texmem.c +++ b/src/mesa/drivers/dri/r200/r200_texmem.c @@ -304,26 +304,7 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t, return; } - switch (face) { - case 0: - texImage = t->base.tObj->Image[level]; - break; - case 1: - texImage = t->base.tObj->NegX[level]; - break; - case 2: - texImage = t->base.tObj->PosY[level]; - break; - case 3: - texImage = t->base.tObj->NegY[level]; - break; - case 4: - texImage = t->base.tObj->PosZ[level]; - break; - case 5: - texImage = t->base.tObj->NegZ[level]; - break; - } + texImage = t->base.tObj->Image[face][level]; if ( !texImage ) { if ( R200_DEBUG & DEBUG_TEXTURE ) diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 2eb6962189..8e171669c4 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -102,7 +102,7 @@ static void r200SetTexImages( r200ContextPtr rmesa, struct gl_texture_object *tObj ) { r200TexObjPtr t = (r200TexObjPtr)tObj->DriverData; - const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; GLint curOffset; GLint i; GLint numLevels; @@ -129,9 +129,9 @@ static void r200SetTexImages( r200ContextPtr rmesa, */ driCalculateTextureFirstLastLevel( (driTextureObject *) t ); - log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; - log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; - log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2; + log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2; + log2Depth = tObj->Image[0][t->base.firstLevel]->DepthLog2; numLevels = t->base.lastLevel - t->base.firstLevel + 1; @@ -147,7 +147,7 @@ static void r200SetTexImages( r200ContextPtr rmesa, const struct gl_texture_image *texImage; GLuint size; - texImage = tObj->Image[i + t->base.firstLevel]; + texImage = tObj->Image[0][i + t->base.firstLevel]; if ( !texImage ) break; @@ -255,17 +255,17 @@ static void r200SetTexImages( r200ContextPtr rmesa, (log2Height << R200_FACE_HEIGHT_4_SHIFT)); } - t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) | - ((tObj->Image[t->base.firstLevel]->Height - 1) << 16)); + t->pp_txsize = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << 0) | + ((tObj->Image[0][t->base.firstLevel]->Height - 1) << 16)); /* Only need to round to nearest 32 for textures, but the blitter * requires 64-byte aligned pitches, and we may/may not need the * blitter. NPOT only! */ if (baseImage->IsCompressed) - t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63); + t->pp_txpitch = (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63); else - t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); + t->pp_txpitch = ((tObj->Image[0][t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); t->pp_txpitch -= 32; t->dirty_state = TEX_ALL; @@ -736,7 +736,7 @@ static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit ) } else { const struct gl_texture_object *tObj = texUnit->_Current; - const GLenum format = tObj->Image[tObj->BaseLevel]->Format; + const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; GLuint color_arg[3], alpha_arg[3]; GLuint i, numColorArgs = 0, numAlphaArgs = 0; GLuint RGBshift = texUnit->CombineScaleShiftRGB; @@ -1606,7 +1606,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) GLenum format; /* Fallback if there's a texture border */ - if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) + if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) return GL_FALSE; /* Update state if this is a different texture object to last @@ -1653,7 +1653,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; } - format = tObj->Image[tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->Format; if ( rmesa->state.texture.unit[unit].format != format || rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode ) { rmesa->state.texture.unit[unit].format = format; diff --git a/src/mesa/drivers/dri/radeon/radeon_subset_tex.c b/src/mesa/drivers/dri/radeon/radeon_subset_tex.c index e401779513..90004d2a33 100644 --- a/src/mesa/drivers/dri/radeon/radeon_subset_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_subset_tex.c @@ -152,7 +152,7 @@ static void radeonUploadSubImage( radeonContextPtr rmesa, drmRadeonTexImage tmp; level += t->firstLevel; - texImage = t->tObj->Image[level]; + texImage = t->tObj->Image[0][level]; if ( !texImage || !texImage->Data ) return; @@ -200,7 +200,7 @@ static void radeonSetTexImages( radeonContextPtr rmesa, struct gl_texture_object *tObj ) { radeonTexObjPtr t = (radeonTexObjPtr)tObj->DriverData; - const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; GLint totalSize; GLint texelsPerDword = 0, blitWidth = 0, blitPitch = 0; GLint x, y, width, height; @@ -273,11 +273,11 @@ static void radeonSetTexImages( radeonContextPtr rmesa, numLevels = lastLevel - firstLevel + 1; - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; + log2Width = tObj->Image[0][firstLevel]->WidthLog2; + log2Height = tObj->Image[0][firstLevel]->HeightLog2; for ( i = 0 ; i < numLevels ; i++ ) { - const struct gl_texture_image *texImage = tObj->Image[i + firstLevel]; + const struct gl_texture_image *texImage = tObj->Image[0][i + firstLevel]; if ( !texImage ) break; @@ -524,7 +524,7 @@ static void radeonUpdateTextureEnv( GLcontext *ctx, int unit ) radeonContextPtr rmesa = RADEON_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *tObj = texUnit->_Current; - const GLenum format = tObj->Image[tObj->BaseLevel]->Format; + const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; GLuint color_combine = radeon_color_combine[unit][RADEON_DISABLE]; GLuint alpha_combine = radeon_alpha_combine[unit][RADEON_DISABLE]; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index d7f9df762e..fd14e76d44 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -704,7 +704,7 @@ static GLboolean run_texrect_stage( GLcontext *ctx, if (stage->changed_inputs & VERT_BIT_TEX(i)) { struct gl_texture_object *texObj = ctx->Texture.Unit[i].CurrentRect; - struct gl_texture_image *texImage = texObj->Image[texObj->BaseLevel]; + struct gl_texture_image *texImage = texObj->Image[0][texObj->BaseLevel]; const GLfloat iw = 1.0/texImage->Width; const GLfloat ih = 1.0/texImage->Height; GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data; diff --git a/src/mesa/drivers/dri/radeon/radeon_texmem.c b/src/mesa/drivers/dri/radeon/radeon_texmem.c index 284efb225a..09289bab67 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texmem.c +++ b/src/mesa/drivers/dri/radeon/radeon_texmem.c @@ -200,26 +200,7 @@ static void uploadSubImage( radeonContextPtr rmesa, radeonTexObjPtr t, return; } - switch (face) { - case 0: - texImage = t->base.tObj->Image[level]; - break; - case 1: - texImage = t->base.tObj->NegX[level]; - break; - case 2: - texImage = t->base.tObj->PosY[level]; - break; - case 3: - texImage = t->base.tObj->NegY[level]; - break; - case 4: - texImage = t->base.tObj->PosZ[level]; - break; - case 5: - texImage = t->base.tObj->NegZ[level]; - break; - } + texImage = t->base.tObj->Image[face][level]; if ( !texImage ) { if ( RADEON_DEBUG & DEBUG_TEXTURE ) diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 0bece3e8b9..f4991a70a2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -104,7 +104,7 @@ static void radeonSetTexImages( radeonContextPtr rmesa, struct gl_texture_object *tObj ) { radeonTexObjPtr t = (radeonTexObjPtr)tObj->DriverData; - const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; GLint curOffset; GLint i; GLint numLevels; @@ -131,9 +131,9 @@ static void radeonSetTexImages( radeonContextPtr rmesa, */ driCalculateTextureFirstLastLevel( (driTextureObject *) t ); - log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; - log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; - log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2; + log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2; + log2Depth = tObj->Image[0][t->base.firstLevel]->DepthLog2; numLevels = t->base.lastLevel - t->base.firstLevel + 1; @@ -149,7 +149,7 @@ static void radeonSetTexImages( radeonContextPtr rmesa, const struct gl_texture_image *texImage; GLuint size; - texImage = tObj->Image[i + t->base.firstLevel]; + texImage = tObj->Image[0][i + t->base.firstLevel]; if ( !texImage ) break; @@ -214,17 +214,17 @@ static void radeonSetTexImages( radeonContextPtr rmesa, t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) | (log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT)); - t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) | - ((tObj->Image[t->base.firstLevel]->Height - 1) << 16)); + t->pp_txsize = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << 0) | + ((tObj->Image[0][t->base.firstLevel]->Height - 1) << 16)); /* Only need to round to nearest 32 for textures, but the blitter * requires 64-byte aligned pitches, and we may/may not need the * blitter. NPOT only! */ if (baseImage->IsCompressed) - t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63); + t->pp_txpitch = (tObj->Image[0][t->base.firstLevel]->Width + 63) & ~(63); else - t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); + t->pp_txpitch = ((tObj->Image[0][t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); t->pp_txpitch -= 32; t->dirty_state = TEX_ALL; @@ -779,7 +779,7 @@ static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit ) } else { const struct gl_texture_object *tObj = texUnit->_Current; - const GLenum format = tObj->Image[tObj->BaseLevel]->Format; + const GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; GLuint color_arg[3], alpha_arg[3]; GLuint i, numColorArgs = 0, numAlphaArgs = 0; GLuint RGBshift = texUnit->CombineScaleShiftRGB; @@ -1496,7 +1496,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) GLenum format; /* Fallback if there's a texture border */ - if ( tObj->Image[tObj->BaseLevel]->Border > 0 ) { + if ( tObj->Image[0][tObj->BaseLevel]->Border > 0 ) { fprintf(stderr, "%s: border\n", __FUNCTION__); return GL_FALSE; } @@ -1549,7 +1549,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; } - format = tObj->Image[tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->Format; if ( rmesa->state.texture.unit[unit].format != format || rmesa->state.texture.unit[unit].envMode != texUnit->EnvMode ) { rmesa->state.texture.unit[unit].format = format; diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index 001eb18a14..a18ad06bd4 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -317,7 +317,7 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, lastLevel = texObj->BaseLevel + (GLint)(texObj->MaxLod + 0.5); lastLevel = MAX2(lastLevel, texObj->BaseLevel); lastLevel = MIN2(lastLevel, texObj->BaseLevel + - texObj->Image[texObj->BaseLevel]->MaxLog2); + texObj->Image[0][texObj->BaseLevel]->MaxLog2); lastLevel = MIN2(lastLevel, texObj->MaxLevel); lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ } @@ -437,9 +437,9 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj, } current->texture[hw_unit].hwTextureSet |= - texObj->Image[firstLevel]->WidthLog2 << 4; + texObj->Image[0][firstLevel]->WidthLog2 << 4; current->texture[hw_unit].hwTextureSet |= - texObj->Image[firstLevel]->HeightLog2; + texObj->Image[0][firstLevel]->HeightLog2; if (hw_unit == 0) smesa->GlobalFlag |= GFLAG_TEXTUREADDRESS; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 515ae7c809..8c4ea2d46d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -171,20 +171,20 @@ static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj) minl = maxl = tObj->BaseLevel; - if (tObj->Image[minl]) { - maxl = MIN2(tObj->MaxLevel, tObj->Image[minl]->MaxLog2); + if (tObj->Image[0][minl]) { + maxl = MIN2(tObj->MaxLevel, tObj->Image[0][minl]->MaxLog2); /* compute largeLodLog2, aspect ratio and texcoord scale factors */ - tdfxTexGetInfo(ctx, tObj->Image[minl]->Width, tObj->Image[minl]->Height, + tdfxTexGetInfo(ctx, tObj->Image[0][minl]->Width, tObj->Image[0][minl]->Height, &ti->info.largeLodLog2, &ti->info.aspectRatioLog2, &(ti->sScale), &(ti->tScale), NULL, NULL); } - if (tObj->Image[maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) { + if (tObj->Image[0][maxl] && (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) { /* mipmapping: need to compute smallLodLog2 */ - tdfxTexGetInfo(ctx, tObj->Image[maxl]->Width, - tObj->Image[maxl]->Height, + tdfxTexGetInfo(ctx, tObj->Image[0][maxl]->Width, + tObj->Image[0][maxl]->Height, &ti->info.smallLodLog2, NULL, NULL, NULL, NULL, NULL); } @@ -1282,11 +1282,11 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, assert(ti); /* assign the parameters to test against */ - tObj->Image[level]->Width = width; - tObj->Image[level]->Height = height; - tObj->Image[level]->Border = border; + tObj->Image[0][level]->Width = width; + tObj->Image[0][level]->Height = height; + tObj->Image[0][level]->Border = border; #if 0 - tObj->Image[level]->IntFormat = internalFormat; + tObj->Image[0][level]->IntFormat = internalFormat; #endif if (level == 0) { /* don't use mipmap levels > 0 */ diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.c b/src/mesa/drivers/dri/tdfx/tdfx_texman.c index b34779c21f..9bfd5de5f9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texman.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.c @@ -655,7 +655,7 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) case TDFX_TMU1: if (ti->tm[targetTMU]) { for (l = ti->minLevel; l <= ti->maxLevel - && tObj->Image[l]->Data; l++) { + && tObj->Image[0][l]->Data; l++) { GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; fxMesa->Glide.grTexDownloadMipMapLevel(targetTMU, ti->tm[targetTMU]->startAddr, @@ -664,14 +664,14 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_BOTH, - tObj->Image[l]->Data); + tObj->Image[0][l]->Data); } } break; case TDFX_TMU_SPLIT: if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) { for (l = ti->minLevel; l <= ti->maxLevel - && tObj->Image[l]->Data; l++) { + && tObj->Image[0][l]->Data; l++) { GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0, ti->tm[TDFX_TMU0]->startAddr, @@ -680,7 +680,7 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_ODD, - tObj->Image[l]->Data); + tObj->Image[0][l]->Data); fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1, ti->tm[TDFX_TMU1]->startAddr, @@ -689,14 +689,14 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_EVEN, - tObj->Image[l]->Data); + tObj->Image[0][l]->Data); } } break; case TDFX_TMU_BOTH: if (ti->tm[TDFX_TMU0] && ti->tm[TDFX_TMU1]) { for (l = ti->minLevel; l <= ti->maxLevel - && tObj->Image[l]->Data; l++) { + && tObj->Image[0][l]->Data; l++) { GrLOD_t glideLod = ti->info.largeLodLog2 - l + tObj->BaseLevel; fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0, ti->tm[TDFX_TMU0]->startAddr, @@ -705,7 +705,7 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_BOTH, - tObj->Image[l]->Data); + tObj->Image[0][l]->Data); fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1, ti->tm[TDFX_TMU1]->startAddr, @@ -714,7 +714,7 @@ tdfxTMDownloadTexture(tdfxContextPtr fxMesa, struct gl_texture_object *tObj) ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_BOTH, - tObj->Image[l]->Data); + tObj->Image[0][l]->Data); } } break; @@ -750,7 +750,7 @@ tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_BOTH, - tObj->Image[level]->Data); + tObj->Image[0][level]->Data); break; case TDFX_TMU_SPLIT: fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0, @@ -760,7 +760,7 @@ tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_ODD, - tObj->Image[level]->Data); + tObj->Image[0][level]->Data); fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1, ti->tm[GR_TMU1]->startAddr, @@ -769,7 +769,7 @@ tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_EVEN, - tObj->Image[level]->Data); + tObj->Image[0][level]->Data); break; case TDFX_TMU_BOTH: fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU0, @@ -779,7 +779,7 @@ tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_BOTH, - tObj->Image[level]->Data); + tObj->Image[0][level]->Data); fxMesa->Glide.grTexDownloadMipMapLevel(GR_TMU1, ti->tm[GR_TMU1]->startAddr, @@ -788,7 +788,7 @@ tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj, ti->info.aspectRatioLog2, ti->info.format, GR_MIPMAPLEVELMASK_BOTH, - tObj->Image[level]->Data); + tObj->Image[0][level]->Data); break; default: diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c index e20938bf28..318d3a1c8f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c @@ -1483,8 +1483,8 @@ static void print_state(tdfxContextPtr fxMesa) GLcontext *ctx = fxMesa->glCtx; struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D; struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D; - GLenum base0 = tObj0->Image[tObj0->BaseLevel] ? tObj0->Image[tObj0->BaseLevel]->Format : 99; - GLenum base1 = tObj1->Image[tObj1->BaseLevel] ? tObj1->Image[tObj1->BaseLevel]->Format : 99; + GLenum base0 = tObj0->Image[0][tObj0->BaseLevel] ? tObj0->Image[0][tObj0->BaseLevel]->Format : 99; + GLenum base1 = tObj1->Image[0][tObj1->BaseLevel] ? tObj1->Image[0][tObj1->BaseLevel]->Format : 99; printf("Unit 0: Enabled: GL=%d Gr=%d\n", ctx->Texture.Unit[0]._ReallyEnabled, fxMesa->TexState.Enabled[0]); @@ -1517,7 +1517,7 @@ static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) GLenum envMode, baseFormat; tObj = ctx->Texture.Unit[unit].Current2D; - if (tObj->Image[tObj->BaseLevel]->Border > 0) { + if (tObj->Image[0][tObj->BaseLevel]->Border > 0) { FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_BORDER, GL_TRUE); return; } @@ -1539,7 +1539,7 @@ static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit) /* Check if we really need to update the texenv state */ envMode = ctx->Texture.Unit[unit].EnvMode; - baseFormat = tObj->Image[tObj->BaseLevel]->Format; + baseFormat = tObj->Image[0][tObj->BaseLevel]->Format; if (TDFX_IS_NAPALM(fxMesa)) { /* see if we really need to update the unit */ @@ -1826,8 +1826,8 @@ static void setupTextureDoubleTMU(GLcontext * ctx) struct gl_texture_object *tObj1 = ctx->Texture.Unit[1].Current2D; tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0); tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1); - struct gl_texture_image *baseImage0 = tObj0->Image[tObj0->BaseLevel]; - struct gl_texture_image *baseImage1 = tObj1->Image[tObj1->BaseLevel]; + struct gl_texture_image *baseImage0 = tObj0->Image[0][tObj0->BaseLevel]; + struct gl_texture_image *baseImage1 = tObj1->Image[0][tObj1->BaseLevel]; const GLenum envMode0 = ctx->Texture.Unit[0].EnvMode; const GLenum envMode1 = ctx->Texture.Unit[1].EnvMode; diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 447fbfa881..bda11f9644 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1575,7 +1575,7 @@ fx_check_IsInHardware(GLcontext * ctx) ctx->Texture.Unit[0].EnvColor[3] != 1)) { return FX_FALLBACK_TEXTURE_ENV; } - if (ctx->Texture.Unit[0]._Current->Image[0]->Border > 0) + if (ctx->Texture.Unit[0]._Current->Image[0][0]->Border > 0) return FX_FALLBACK_TEXTURE_BORDER; } @@ -1583,7 +1583,7 @@ fx_check_IsInHardware(GLcontext * ctx) if (fxMesa->type < GR_SSTTYPE_Voodoo2) if (ctx->Texture.Unit[1].EnvMode == GL_BLEND) return FX_FALLBACK_TEXTURE_ENV; - if (ctx->Texture.Unit[1]._Current->Image[0]->Border > 0) + if (ctx->Texture.Unit[1]._Current->Image[0][0]->Border > 0) return FX_FALLBACK_TEXTURE_BORDER; } diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index f1dd2dd387..437d76f0d7 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -56,8 +56,8 @@ fxPrintTextureData(tfxTexInfo * ti) fprintf(stderr, "\tName: %d\n", ti->tObj->Name); fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel); fprintf(stderr, "\tSize: %d x %d\n", - ti->tObj->Image[ti->tObj->BaseLevel]->Width, - ti->tObj->Image[ti->tObj->BaseLevel]->Height); + ti->tObj->Image[0][ti->tObj->BaseLevel]->Width, + ti->tObj->Image[0][ti->tObj->BaseLevel]->Height); } else fprintf(stderr, "\tName: UNNAMED\n"); diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index cdfef47556..4c08630284 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -63,7 +63,7 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) ti->tObj = tObj; minl = ti->minLevel = tObj->BaseLevel; - maxl = ti->maxLevel = MIN2(tObj->MaxLevel, tObj->Image[0]->MaxLog2); + maxl = ti->maxLevel = MIN2(tObj->MaxLevel, tObj->Image[0][0]->MaxLog2); #if 1||FX_RESCALE_BIG_TEXURES { @@ -110,7 +110,7 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) */ if ((tObj->MinFilter == GL_NEAREST) || (tObj->MinFilter == GL_LINEAR)) { /* no mipmaps! need to rescale */ - struct gl_texture_image *texImage = tObj->Image[minl]; + struct gl_texture_image *texImage = tObj->Image[0][minl]; tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); GLint texelBytes = texImage->TexFormat->TexelBytes; GLvoid *texImage_Data = texImage->Data; @@ -134,7 +134,7 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) MESA_PBUFFER_FREE(texImage_Data); mml->width = _w; mml->height = _h; - maxl = ti->maxLevel = tObj->Image[0]->MaxLog2 = minl + fxMesa->textureMaxLod; + maxl = ti->maxLevel = tObj->Image[0][0]->MaxLog2 = minl + fxMesa->textureMaxLod; } else { /* skip a certain number of LODs */ minl += maxl - fxMesa->textureMaxLod; @@ -147,19 +147,19 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) } #endif - fxTexGetInfo(tObj->Image[minl]->Width, tObj->Image[minl]->Height, + fxTexGetInfo(tObj->Image[0][minl]->Width, tObj->Image[0][minl]->Height, &(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)), &(ti->sScale), &(ti->tScale), NULL, NULL); if ((tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR)) - fxTexGetInfo(tObj->Image[maxl]->Width, tObj->Image[maxl]->Height, + fxTexGetInfo(tObj->Image[0][maxl]->Width, tObj->Image[0][maxl]->Height, &(FX_smallLodLog2(ti->info)), NULL, NULL, NULL, NULL, NULL); else FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info); - ti->baseLevelInternalFormat = tObj->Image[minl]->Format; + ti->baseLevelInternalFormat = tObj->Image[0][minl]->Format; ti->validated = GL_TRUE; diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 66f6f443e1..5a6f18a169 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -442,7 +442,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, for (i = FX_largeLodValue(ti->info), l = ti->minLevel; i <= FX_smallLodValue(ti->info); i++, l++) { - struct gl_texture_image *texImage = tObj->Image[l]; + struct gl_texture_image *texImage = tObj->Image[0][l]; grTexDownloadMipMapLevel(where, ti->tm[where]->startAddr, FX_valueToLod(i), @@ -464,7 +464,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, for (i = FX_largeLodValue(ti->info), l = ti->minLevel; i <= FX_smallLodValue(ti->info); i++, l++) { - struct gl_texture_image *texImage = tObj->Image[l]; + struct gl_texture_image *texImage = tObj->Image[0][l]; grTexDownloadMipMapLevel(GR_TMU0, ti->tm[FX_TMU0]->startAddr, @@ -496,7 +496,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj, for (i = FX_largeLodValue(ti->info), l = ti->minLevel; i <= FX_smallLodValue(ti->info); i++, l++) { - struct gl_texture_image *texImage = tObj->Image[l]; + struct gl_texture_image *texImage = tObj->Image[0][l]; grTexDownloadMipMapLevel(GR_TMU0, ti->tm[FX_TMU0]->startAddr, FX_valueToLod(i), @@ -545,7 +545,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj, tfxTexInfo *ti = fxTMGetTexInfo(tObj); GrLOD_t lodlevel; GLint tmu; - struct gl_texture_image *texImage = tObj->Image[level]; + struct gl_texture_image *texImage = tObj->Image[0][level]; tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); if (TDFX_DEBUG & VERBOSE_TEXTURE) { @@ -640,7 +640,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, GrLOD_t lodlevel; unsigned short *data; GLint tmu; - struct gl_texture_image *texImage = tObj->Image[level]; + struct gl_texture_image *texImage = tObj->Image[0][level]; tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); assert(mml); @@ -771,7 +771,7 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj) fxTMMoveOutTM(fxMesa, tObj); for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { - struct gl_texture_image *texImage = tObj->Image[i]; + struct gl_texture_image *texImage = tObj->Image[0][i]; if (texImage) { if (texImage->DriverData) { FREE(texImage->DriverData); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 815f352701..5e6777efec 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1061,6 +1061,13 @@ struct gl_texture_image { /*@}*/ }; +#define FACE_POS_X 0 +#define FACE_NEG_X 1 +#define FACE_POS_Y 2 +#define FACE_NEG_Y 3 +#define FACE_POS_Z 4 +#define FACE_NEG_Z 5 +#define MAX_FACES 6 /** * Texture object record @@ -1099,20 +1106,7 @@ struct gl_texture_object { GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */ - struct gl_texture_image *Image[MAX_TEXTURE_LEVELS]; - - /** - * \name Texture cube faces - * - * Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; - */ - /*@{*/ - struct gl_texture_image *NegX[MAX_TEXTURE_LEVELS]; - struct gl_texture_image *PosY[MAX_TEXTURE_LEVELS]; - struct gl_texture_image *NegY[MAX_TEXTURE_LEVELS]; - struct gl_texture_image *PosZ[MAX_TEXTURE_LEVELS]; - struct gl_texture_image *NegZ[MAX_TEXTURE_LEVELS]; - /*@}*/ + struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; /** GL_EXT_paletted_texture */ struct gl_color_table Palette; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index fd8e2d0cdd..ad7e20ce0f 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -471,29 +471,22 @@ _mesa_set_tex_image(struct gl_texture_object *tObj, case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: - tObj->Image[level] = texImage; + tObj->Image[0][level] = texImage; return; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - tObj->Image[level] = texImage; - return; case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - tObj->NegX[level] = texImage; - return; case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - tObj->PosY[level] = texImage; - return; case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - tObj->NegY[level] = texImage; - return; case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - tObj->PosZ[level] = texImage; - return; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - tObj->NegZ[level] = texImage; - return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: { + GLuint face = ((GLuint) target - + (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); + tObj->Image[face][level] = texImage; + break; + } case GL_TEXTURE_RECTANGLE_NV: ASSERT(level == 0); - tObj->Image[level] = texImage; + tObj->Image[0][level] = texImage; return; default: _mesa_problem(NULL, "bad target in _mesa_set_tex_image()"); @@ -630,56 +623,39 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, ASSERT(level < MAX_TEXTURE_LEVELS); switch (target) { case GL_TEXTURE_1D: - return texUnit->Current1D->Image[level]; + return texUnit->Current1D->Image[0][level]; case GL_PROXY_TEXTURE_1D: - return ctx->Texture.Proxy1D->Image[level]; + return ctx->Texture.Proxy1D->Image[0][level]; case GL_TEXTURE_2D: - return texUnit->Current2D->Image[level]; + return texUnit->Current2D->Image[0][level]; case GL_PROXY_TEXTURE_2D: - return ctx->Texture.Proxy2D->Image[level]; + return ctx->Texture.Proxy2D->Image[0][level]; case GL_TEXTURE_3D: - return texUnit->Current3D->Image[level]; + return texUnit->Current3D->Image[0][level]; case GL_PROXY_TEXTURE_3D: - return ctx->Texture.Proxy3D->Image[level]; + return ctx->Texture.Proxy3D->Image[0][level]; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - return texUnit->CurrentCubeMap->Image[level]; - else - return NULL; case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - return texUnit->CurrentCubeMap->NegX[level]; - else - return NULL; case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - return texUnit->CurrentCubeMap->PosY[level]; - else - return NULL; case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - return texUnit->CurrentCubeMap->NegY[level]; - else - return NULL; case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - return texUnit->CurrentCubeMap->PosZ[level]; - else - return NULL; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - return texUnit->CurrentCubeMap->NegZ[level]; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + if (ctx->Extensions.ARB_texture_cube_map) { + GLuint face = ((GLuint) target - + (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); + return texUnit->CurrentCubeMap->Image[face][level]; + } else return NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: if (ctx->Extensions.ARB_texture_cube_map) - return ctx->Texture.ProxyCubeMap->Image[level]; + return ctx->Texture.ProxyCubeMap->Image[0][level]; else return NULL; case GL_TEXTURE_RECTANGLE_NV: if (ctx->Extensions.NV_texture_rectangle) { ASSERT(level == 0); - return texUnit->CurrentRect->Image[level]; + return texUnit->CurrentRect->Image[0][level]; } else { return NULL; @@ -687,7 +663,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, case GL_PROXY_TEXTURE_RECTANGLE_NV: if (ctx->Extensions.NV_texture_rectangle) { ASSERT(level == 0); - return ctx->Texture.ProxyRect->Image[level]; + return ctx->Texture.ProxyRect->Image[0][level]; } else { return NULL; @@ -743,66 +719,66 @@ _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level) case GL_PROXY_TEXTURE_1D: if (level >= ctx->Const.MaxTextureLevels) return NULL; - texImage = ctx->Texture.Proxy1D->Image[level]; + texImage = ctx->Texture.Proxy1D->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy1D->Image[level] = texImage; + ctx->Texture.Proxy1D->Image[0][level] = texImage; } return texImage; case GL_PROXY_TEXTURE_2D: if (level >= ctx->Const.MaxTextureLevels) return NULL; - texImage = ctx->Texture.Proxy2D->Image[level]; + texImage = ctx->Texture.Proxy2D->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy2D->Image[level] = texImage; + ctx->Texture.Proxy2D->Image[0][level] = texImage; } return texImage; case GL_PROXY_TEXTURE_3D: if (level >= ctx->Const.Max3DTextureLevels) return NULL; - texImage = ctx->Texture.Proxy3D->Image[level]; + texImage = ctx->Texture.Proxy3D->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy3D->Image[level] = texImage; + ctx->Texture.Proxy3D->Image[0][level] = texImage; } return texImage; case GL_PROXY_TEXTURE_CUBE_MAP: if (level >= ctx->Const.MaxCubeTextureLevels) return NULL; - texImage = ctx->Texture.ProxyCubeMap->Image[level]; + texImage = ctx->Texture.ProxyCubeMap->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.ProxyCubeMap->Image[level] = texImage; + ctx->Texture.ProxyCubeMap->Image[0][level] = texImage; } return texImage; case GL_PROXY_TEXTURE_RECTANGLE_NV: if (level > 0) return NULL; - texImage = ctx->Texture.ProxyRect->Image[level]; + texImage = ctx->Texture.ProxyRect->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.ProxyRect->Image[level] = texImage; + ctx->Texture.ProxyRect->Image[0][level] = texImage; } return texImage; default: @@ -2170,7 +2146,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, 1, border)) { /* when error, clear all proxy texture image parameters */ if (texImage) - clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]); + clear_teximage_fields(ctx->Texture.Proxy2D->Image[0][level]); } else { /* no error, set the tex image parameters */ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 98e49cde67..cdcc5acc75 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -133,7 +133,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, void _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) { - GLuint i; + GLuint i, face; (void) ctx; @@ -142,9 +142,11 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) _mesa_free_colortable_data(&texObj->Palette); /* free the texture images */ - for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { - if (texObj->Image[i]) { - _mesa_delete_texture_image( texObj->Image[i] ); + for (face = 0; face < 6; face++) { + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + if (texObj->Image[face][i]) { + _mesa_delete_texture_image( texObj->Image[face][i] ); + } } } @@ -295,7 +297,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, t->_IsPowerOfTwo = GL_TRUE; /* may be set FALSE below */ /* Always need the base level image */ - if (!t->Image[baseLevel]) { + if (!t->Image[0][baseLevel]) { char s[100]; sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", (void *) t, t->Name, baseLevel); @@ -305,9 +307,9 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } /* Check width/height/depth for zero */ - if (t->Image[baseLevel]->Width == 0 || - t->Image[baseLevel]->Height == 0 || - t->Image[baseLevel]->Depth == 0) { + if (t->Image[0][baseLevel]->Width == 0 || + t->Image[0][baseLevel]->Height == 0 || + t->Image[0][baseLevel]->Depth == 0) { incomplete(t, "texture width = 0"); t->Complete = GL_FALSE; return; @@ -315,23 +317,23 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Compute _MaxLevel */ if (t->Target == GL_TEXTURE_1D) { - maxLog2 = t->Image[baseLevel]->WidthLog2; + maxLog2 = t->Image[0][baseLevel]->WidthLog2; maxLevels = ctx->Const.MaxTextureLevels; } else if (t->Target == GL_TEXTURE_2D) { - maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2, - t->Image[baseLevel]->HeightLog2); + maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2, + t->Image[0][baseLevel]->HeightLog2); maxLevels = ctx->Const.MaxTextureLevels; } else if (t->Target == GL_TEXTURE_3D) { - GLint max = MAX2(t->Image[baseLevel]->WidthLog2, - t->Image[baseLevel]->HeightLog2); - maxLog2 = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2)); + GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2, + t->Image[0][baseLevel]->HeightLog2); + maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2)); maxLevels = ctx->Const.Max3DTextureLevels; } else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { - maxLog2 = MAX2(t->Image[baseLevel]->WidthLog2, - t->Image[baseLevel]->HeightLog2); + maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2, + t->Image[0][baseLevel]->HeightLog2); maxLevels = ctx->Const.MaxCubeTextureLevels; } else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { @@ -354,31 +356,22 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure that all six cube map level 0 images are the same size */ - const GLuint w = t->Image[baseLevel]->Width2; - const GLuint h = t->Image[baseLevel]->Height2; - if (!t->NegX[baseLevel] || - t->NegX[baseLevel]->Width2 != w || - t->NegX[baseLevel]->Height2 != h || - !t->PosY[baseLevel] || - t->PosY[baseLevel]->Width2 != w || - t->PosY[baseLevel]->Height2 != h || - !t->NegY[baseLevel] || - t->NegY[baseLevel]->Width2 != w || - t->NegY[baseLevel]->Height2 != h || - !t->PosZ[baseLevel] || - t->PosZ[baseLevel]->Width2 != w || - t->PosZ[baseLevel]->Height2 != h || - !t->NegZ[baseLevel] || - t->NegZ[baseLevel]->Width2 != w || - t->NegZ[baseLevel]->Height2 != h) { - t->Complete = GL_FALSE; - incomplete(t, "Non-quare cubemap image"); - return; + const GLuint w = t->Image[0][baseLevel]->Width2; + const GLuint h = t->Image[0][baseLevel]->Height2; + GLuint face; + for (face = 1; face < 6; face++) { + if (t->Image[face][baseLevel] == NULL || + t->Image[face][baseLevel]->Width2 != w || + t->Image[face][baseLevel]->Height2 != h) { + t->Complete = GL_FALSE; + incomplete(t, "Non-quare cubemap image"); + return; + } } } /* check for non power of two */ - if (!t->Image[baseLevel]->_IsPowerOfTwo) { + if (!t->Image[0][baseLevel]->_IsPowerOfTwo) { t->_IsPowerOfTwo = GL_FALSE; } @@ -399,13 +392,13 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Test dimension-independent attributes */ for (i = minLevel; i <= maxLevel; i++) { - if (t->Image[i]) { - if (t->Image[i]->TexFormat != t->Image[baseLevel]->TexFormat) { + if (t->Image[0][i]) { + if (t->Image[0][i]->TexFormat != t->Image[0][baseLevel]->TexFormat) { t->Complete = GL_FALSE; incomplete(t, "Format[i] != Format[baseLevel]"); return; } - if (t->Image[i]->Border != t->Image[baseLevel]->Border) { + if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) { t->Complete = GL_FALSE; incomplete(t, "Border[i] != Border[baseLevel]"); return; @@ -416,20 +409,20 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Test things which depend on number of texture image dimensions */ if (t->Target == GL_TEXTURE_1D) { /* Test 1-D mipmaps */ - GLuint width = t->Image[baseLevel]->Width2; + GLuint width = t->Image[0][baseLevel]->Width2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; } if (i >= minLevel && i <= maxLevel) { - if (!t->Image[i]) { + if (!t->Image[0][i]) { t->Complete = GL_FALSE; - incomplete(t, "1D Image[i] == NULL"); + incomplete(t, "1D Image[0][i] == NULL"); return; } - if (t->Image[i]->Width2 != width ) { + if (t->Image[0][i]->Width2 != width ) { t->Complete = GL_FALSE; - incomplete(t, "1D Image[i] bad width"); + incomplete(t, "1D Image[0][i] bad width"); return; } } @@ -440,8 +433,8 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } else if (t->Target == GL_TEXTURE_2D) { /* Test 2-D mipmaps */ - GLuint width = t->Image[baseLevel]->Width2; - GLuint height = t->Image[baseLevel]->Height2; + GLuint width = t->Image[0][baseLevel]->Width2; + GLuint height = t->Image[0][baseLevel]->Height2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; @@ -450,19 +443,19 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, height /= 2; } if (i >= minLevel && i <= maxLevel) { - if (!t->Image[i]) { + if (!t->Image[0][i]) { t->Complete = GL_FALSE; - incomplete(t, "2D Image[i] == NULL"); + incomplete(t, "2D Image[0][i] == NULL"); return; } - if (t->Image[i]->Width2 != width) { + if (t->Image[0][i]->Width2 != width) { t->Complete = GL_FALSE; - incomplete(t, "2D Image[i] bad width"); + incomplete(t, "2D Image[0][i] bad width"); return; } - if (t->Image[i]->Height2 != height) { + if (t->Image[0][i]->Height2 != height) { t->Complete = GL_FALSE; - incomplete(t, "2D Image[i] bad height"); + incomplete(t, "2D Image[0][i] bad height"); return; } if (width==1 && height==1) { @@ -473,9 +466,9 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } else if (t->Target == GL_TEXTURE_3D) { /* Test 3-D mipmaps */ - GLuint width = t->Image[baseLevel]->Width2; - GLuint height = t->Image[baseLevel]->Height2; - GLuint depth = t->Image[baseLevel]->Depth2; + GLuint width = t->Image[0][baseLevel]->Width2; + GLuint height = t->Image[0][baseLevel]->Height2; + GLuint depth = t->Image[0][baseLevel]->Depth2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; @@ -487,29 +480,29 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, depth /= 2; } if (i >= minLevel && i <= maxLevel) { - if (!t->Image[i]) { - incomplete(t, "3D Image[i] == NULL"); + if (!t->Image[0][i]) { + incomplete(t, "3D Image[0][i] == NULL"); t->Complete = GL_FALSE; return; } - if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { + if (t->Image[0][i]->Format == GL_DEPTH_COMPONENT) { t->Complete = GL_FALSE; incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); return; } - if (t->Image[i]->Width2 != width) { + if (t->Image[0][i]->Width2 != width) { t->Complete = GL_FALSE; - incomplete(t, "3D Image[i] bad width"); + incomplete(t, "3D Image[0][i] bad width"); return; } - if (t->Image[i]->Height2 != height) { + if (t->Image[0][i]->Height2 != height) { t->Complete = GL_FALSE; - incomplete(t, "3D Image[i] bad height"); + incomplete(t, "3D Image[0][i] bad height"); return; } - if (t->Image[i]->Depth2 != depth) { + if (t->Image[0][i]->Depth2 != depth) { t->Complete = GL_FALSE; - incomplete(t, "3D Image[i] bad depth"); + incomplete(t, "3D Image[0][i] bad depth"); return; } } @@ -520,8 +513,8 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure 6 cube faces are consistant */ - GLuint width = t->Image[baseLevel]->Width2; - GLuint height = t->Image[baseLevel]->Height2; + GLuint width = t->Image[0][baseLevel]->Width2; + GLuint height = t->Image[0][baseLevel]->Height2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; @@ -530,33 +523,31 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, height /= 2; } if (i >= minLevel && i <= maxLevel) { - /* check that we have images defined */ - if (!t->Image[i] || !t->NegX[i] || - !t->PosY[i] || !t->NegY[i] || - !t->PosZ[i] || !t->NegZ[i]) { - t->Complete = GL_FALSE; - incomplete(t, "CubeMap Image[i] == NULL"); - return; - } - /* Don't support GL_DEPTH_COMPONENT for cube maps */ - if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { - t->Complete = GL_FALSE; - incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); - return; - } - /* check that all six images have same size */ - if (t->NegX[i]->Width2!=width || t->NegX[i]->Height2!=height || - t->PosY[i]->Width2!=width || t->PosY[i]->Height2!=height || - t->NegY[i]->Width2!=width || t->NegY[i]->Height2!=height || - t->PosZ[i]->Width2!=width || t->PosZ[i]->Height2!=height || - t->NegZ[i]->Width2!=width || t->NegZ[i]->Height2!=height) { - t->Complete = GL_FALSE; - incomplete(t, "CubeMap Image[i] bad size"); - return; - } - } - if (width == 1 && height == 1) { - return; /* found smallest needed mipmap, all done! */ + GLuint face; + for (face = 0; face < 6; face++) { + /* check that we have images defined */ + if (!t->Image[face][i]) { + t->Complete = GL_FALSE; + incomplete(t, "CubeMap Image[n][i] == NULL"); + return; + } + /* Don't support GL_DEPTH_COMPONENT for cube maps */ + if (t->Image[face][i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); + return; + } + /* check that all six images have same size */ + if (t->Image[face][i]->Width2!=width || + t->Image[face][i]->Height2!=height) { + t->Complete = GL_FALSE; + incomplete(t, "CubeMap Image[n][i] bad size"); + return; + } + } + } + if (width == 1 && height == 1) { + return; /* found smallest needed mipmap, all done! */ } } } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index db51aebc9a..3e73de29b0 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1874,7 +1874,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, GLint level, maxLevels; ASSERT(texObj); - srcImage = texObj->Image[texObj->BaseLevel]; + srcImage = texObj->Image[0][texObj->BaseLevel]; ASSERT(srcImage); maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 66d127e2dd..3a68e528a7 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -200,7 +200,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_TEX { const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat s0 = v0->texcoord[0][0] * invW0; @@ -226,7 +226,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat s0 = v0->texcoord[u][0] * invW0; diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 2fb66faf72..61ee6f2fbf 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -187,7 +187,7 @@ #ifdef DO_TEX { const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; @@ -217,7 +217,7 @@ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index e3679a270e..1da14e80d1 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -78,7 +78,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; - const struct gl_texture_image *texImg = texObj->Image[texObj->BaseLevel]; + const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; const GLfloat texW = (GLfloat) texImg->WidthScale; const GLfloat texH = (GLfloat) texImg->HeightScale; GLchan rgba[4]; diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 118cec47e3..ee46f32307 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -361,7 +361,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat texW, texH; GLboolean needLambda; if (obj) { - const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) || ctx->FragmentProgram.Enabled; texW = img->WidthScale; @@ -453,7 +453,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat texW, texH; GLboolean needLambda; if (obj) { - const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; + const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) || ctx->FragmentProgram.Enabled; texW = (GLfloat) img->WidthScale; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 2576a181c3..b5a4509c07 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -886,7 +886,7 @@ sample_1d_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_1d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -902,7 +902,7 @@ sample_1d_linear_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_1d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_1d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -930,14 +930,14 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); - sample_1d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_1d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -960,14 +960,14 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); - sample_1d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_1d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_1d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -985,7 +985,7 @@ sample_nearest_1d( GLcontext *ctx, GLuint texUnit, GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); @@ -1001,7 +1001,7 @@ sample_linear_1d( GLcontext *ctx, GLuint texUnit, GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]); @@ -1034,12 +1034,12 @@ sample_lambda_1d( GLcontext *ctx, GLuint texUnit, switch (tObj->MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = minStart; i < minEnd; i++) - sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_NEAREST_MIPMAP_NEAREST: @@ -1069,12 +1069,12 @@ sample_lambda_1d( GLcontext *ctx, GLuint texUnit, switch (tObj->MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = magStart; i < magEnd; i++) - sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; default: @@ -1338,7 +1338,7 @@ sample_2d_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_2d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1355,7 +1355,7 @@ sample_2d_linear_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_2d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_2d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1373,14 +1373,14 @@ sample_2d_nearest_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_2d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_2d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_2d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1404,14 +1404,14 @@ sample_2d_linear_mipmap_linear( GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_2d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_2d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_2d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_2d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1436,14 +1436,14 @@ sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_2d_linear_repeat(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_2d_linear_repeat(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_2d_linear_repeat(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1460,7 +1460,7 @@ sample_nearest_2d( GLcontext *ctx, GLuint texUnit, const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); @@ -1476,7 +1476,7 @@ sample_linear_2d( GLcontext *ctx, GLuint texUnit, const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { sample_2d_linear(ctx, tObj, image, texcoords[i], rgba[i]); @@ -1498,7 +1498,7 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { - const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint colMask = img->Width - 1; @@ -1538,7 +1538,7 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { - const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint colMask = img->Width - 1; @@ -1572,7 +1572,7 @@ sample_lambda_2d( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { - const struct gl_texture_image *tImg = tObj->Image[tObj->BaseLevel]; + const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ @@ -1923,7 +1923,7 @@ sample_3d_nearest_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_3d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1939,7 +1939,7 @@ sample_3d_linear_mipmap_nearest(GLcontext *ctx, for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); - sample_3d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + sample_3d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } @@ -1956,14 +1956,14 @@ sample_3d_nearest_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_3d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_3d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -1985,14 +1985,14 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx, GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { - sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); - sample_3d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); - sample_3d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); + sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); @@ -2009,7 +2009,7 @@ sample_nearest_3d(GLcontext *ctx, GLuint texUnit, GLchan rgba[][4]) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); @@ -2025,7 +2025,7 @@ sample_linear_3d( GLcontext *ctx, GLuint texUnit, const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; - struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; + struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]); @@ -2057,12 +2057,12 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit, switch (tObj->MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = minStart; i < minEnd; i++) - sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_NEAREST_MIPMAP_NEAREST: @@ -2092,12 +2092,12 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit, switch (tObj->MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = magStart; i < magEnd; i++) - sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; default: @@ -2141,13 +2141,13 @@ choose_cube_face(const struct gl_texture_object *texObj, if (arx > ary && arx > arz) { if (rx >= 0.0F) { - imgArray = (const struct gl_texture_image **) texObj->Image; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_X]; sc = -rz; tc = -ry; ma = arx; } else { - imgArray = (const struct gl_texture_image **) texObj->NegX; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_X]; sc = rz; tc = -ry; ma = arx; @@ -2155,13 +2155,13 @@ choose_cube_face(const struct gl_texture_object *texObj, } else if (ary > arx && ary > arz) { if (ry >= 0.0F) { - imgArray = (const struct gl_texture_image **) texObj->PosY; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Y]; sc = rx; tc = rz; ma = ary; } else { - imgArray = (const struct gl_texture_image **) texObj->NegY; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Y]; sc = rx; tc = -rz; ma = ary; @@ -2169,13 +2169,13 @@ choose_cube_face(const struct gl_texture_object *texObj, } else { if (rz > 0.0F) { - imgArray = (const struct gl_texture_image **) texObj->PosZ; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Z]; sc = rx; tc = -ry; ma = arz; } else { - imgArray = (const struct gl_texture_image **) texObj->NegZ; + imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Z]; sc = -rx; tc = -ry; ma = arz; @@ -2405,7 +2405,7 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image *img = tObj->Image[0]; + const struct gl_texture_image *img = tObj->Image[0][0]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint width_minus_1 = img->Width - 1; @@ -2460,7 +2460,7 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image *img = tObj->Image[0]; + const struct gl_texture_image *img = tObj->Image[0][0]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint width_minus_1 = img->Width - 1; @@ -2590,7 +2590,7 @@ sample_depth_texture( GLcontext *ctx, GLuint unit, GLchan texel[][4] ) { const GLint baseLevel = tObj->BaseLevel; - const struct gl_texture_image *texImage = tObj->Image[baseLevel]; + const struct gl_texture_image *texImage = tObj->Image[0][baseLevel]; const GLuint width = texImage->Width; const GLuint height = texImage->Height; GLchan ambient; @@ -2599,7 +2599,7 @@ sample_depth_texture( GLcontext *ctx, GLuint unit, (void) unit; - ASSERT(tObj->Image[tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); + ASSERT(tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_RECTANGLE_NV); @@ -2881,7 +2881,7 @@ sample_depth_texture2(const GLcontext *ctx, { const struct gl_texture_object *texObj = texUnit->_Current; const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *texImage = texObj->Image[baseLevel]; + const struct gl_texture_image *texImage = texObj->Image[0][baseLevel]; const GLuint width = texImage->Width; const GLuint height = texImage->Height; GLchan ambient; @@ -2996,7 +2996,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, const struct gl_texture_object *t ) { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[t->BaseLevel]->Format; + const GLenum format = t->Image[0][t->BaseLevel]->Format; if (!t->Complete) { return &null_sample_func; @@ -3034,15 +3034,15 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->_IsPowerOfTwo && - t->Image[baseLevel]->Border == 0 && - t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { + t->Image[0][baseLevel]->Border == 0 && + t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->_IsPowerOfTwo && - t->Image[baseLevel]->Border == 0 && - t->Image[baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { + t->Image[0][baseLevel]->Border == 0 && + t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } else { @@ -3863,9 +3863,9 @@ texture_apply( const GLcontext *ctx, ASSERT(texUnit->_Current); baseLevel = texUnit->_Current->BaseLevel; - ASSERT(texUnit->_Current->Image[baseLevel]); + ASSERT(texUnit->_Current->Image[0][baseLevel]); - format = texUnit->_Current->Image[baseLevel]->Format; + format = texUnit->_Current->Image[0][baseLevel]->Format; if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) { format = GL_RGBA; /* a bit of a hack */ diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 3e42966467..ebbba34af5 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -154,12 +154,12 @@ GLboolean _swrast_culltriangle( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ - const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ - const GLint smask = obj->Image[b]->Width - 1; \ - const GLint tmask = obj->Image[b]->Height - 1; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ + const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLint smask = obj->Image[0][b]->Width - 1; \ + const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ @@ -205,12 +205,12 @@ GLboolean _swrast_culltriangle( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ - const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ - const GLint smask = obj->Image[b]->Width - 1; \ - const GLint tmask = obj->Image[b]->Height - 1; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ + const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLint smask = obj->Image[0][b]->Width - 1; \ + const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ @@ -538,13 +538,13 @@ affine_span(GLcontext *ctx, struct sw_span *span, struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ - info.texture = (const GLchan *) obj->Image[b]->Data; \ - info.twidth_log2 = obj->Image[b]->WidthLog2; \ - info.smask = obj->Image[b]->Width - 1; \ - info.tmask = obj->Image[b]->Height - 1; \ - info.format = obj->Image[b]->Format; \ + const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ + info.texture = (const GLchan *) obj->Image[0][b]->Data; \ + info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ + info.smask = obj->Image[0][b]->Width - 1; \ + info.tmask = obj->Image[0][b]->Height - 1; \ + info.format = obj->Image[0][b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ span.arrayMask |= SPAN_RGBA; \ @@ -565,22 +565,22 @@ affine_span(GLcontext *ctx, struct sw_span *span, case GL_ALPHA: \ case GL_LUMINANCE: \ case GL_INTENSITY: \ - info.tbytesline = obj->Image[b]->Width; \ + info.tbytesline = obj->Image[0][b]->Width; \ break; \ case GL_LUMINANCE_ALPHA: \ - info.tbytesline = obj->Image[b]->Width * 2; \ + info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ case GL_RGB: \ - info.tbytesline = obj->Image[b]->Width * 3; \ + info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ case GL_RGBA: \ - info.tbytesline = obj->Image[b]->Width * 4; \ + info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\ return; \ } \ - info.tsize = obj->Image[b]->Height * info.tbytesline; + info.tsize = obj->Image[0][b]->Height * info.tbytesline; #define RENDER_SPAN( span ) affine_span(ctx, &span, &info); @@ -808,11 +808,11 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ const struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ - info.texture = (const GLchan *) obj->Image[b]->Data; \ - info.twidth_log2 = obj->Image[b]->WidthLog2; \ - info.smask = obj->Image[b]->Width - 1; \ - info.tmask = obj->Image[b]->Height - 1; \ - info.format = obj->Image[b]->Format; \ + info.texture = (const GLchan *) obj->Image[0][b]->Data; \ + info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ + info.smask = obj->Image[0][b]->Width - 1; \ + info.tmask = obj->Image[0][b]->Height - 1; \ + info.format = obj->Image[0][b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ \ @@ -832,22 +832,22 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, case GL_ALPHA: \ case GL_LUMINANCE: \ case GL_INTENSITY: \ - info.tbytesline = obj->Image[b]->Width; \ + info.tbytesline = obj->Image[0][b]->Width; \ break; \ case GL_LUMINANCE_ALPHA: \ - info.tbytesline = obj->Image[b]->Width * 2; \ + info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ case GL_RGB: \ - info.tbytesline = obj->Image[b]->Width * 3; \ + info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ case GL_RGBA: \ - info.tbytesline = obj->Image[b]->Width * 4; \ + info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\ return; \ } \ - info.tsize = obj->Image[b]->Height * info.tbytesline; + info.tsize = obj->Image[0][b]->Height * info.tbytesline; #define RENDER_SPAN( span ) \ span.interpMask &= ~SPAN_RGBA; \ @@ -1062,7 +1062,7 @@ _swrast_choose_triangle( GLcontext *ctx ) GLenum minFilter, magFilter, envMode; GLint format; texObj2D = ctx->Texture.Unit[0].Current2D; - texImg = texObj2D ? texObj2D->Image[texObj2D->BaseLevel] : NULL; + texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; format = texImg ? texImg->TexFormat->MesaFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; |