From a9fc8ba756dd25a07dc19058fe60f65bda82a055 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 5 Oct 2005 01:48:07 +0000 Subject: In gl_texture_image replace IntFormat with InternalFormat and Format with _BaseFormat to be consistant with gl_renderbuffer. --- src/mesa/drivers/dri/i810/i810texstate.c | 4 +-- src/mesa/drivers/dri/i830/i830_texstate.c | 6 ++-- src/mesa/drivers/dri/i915/i830_texstate.c | 4 +-- src/mesa/drivers/dri/i915/i915_texprog.c | 2 +- src/mesa/drivers/dri/i915/i915_texstate.c | 12 ++++---- src/mesa/drivers/dri/i915/intel_tex.c | 7 ++--- src/mesa/drivers/dri/mach64/mach64_texstate.c | 8 ++--- src/mesa/drivers/dri/mga/mga_texstate.c | 6 ++-- src/mesa/drivers/dri/r128/r128_texstate.c | 2 +- src/mesa/drivers/dri/r300/r300_texstate.c | 4 +-- src/mesa/drivers/dri/radeon/radeon_texstate.c | 2 +- src/mesa/drivers/dri/s3v/s3v_texmem.c | 2 +- src/mesa/drivers/dri/s3v/s3v_texstate.c | 8 ++--- src/mesa/drivers/dri/savage/savagetex.c | 8 +++-- src/mesa/drivers/dri/sis/sis_tex.c | 4 +-- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 32 +++++++++---------- src/mesa/drivers/dri/tdfx/tdfx_texstate.c | 24 +++++++-------- src/mesa/drivers/dri/unichrome/via_tex.c | 5 +-- src/mesa/drivers/glide/fxddtex.c | 33 ++++++++++---------- src/mesa/main/fbobject.c | 8 +++-- src/mesa/main/mtypes.h | 4 +-- src/mesa/main/teximage.c | 22 +++++++------- src/mesa/main/texobj.c | 4 +-- src/mesa/main/texrender.c | 2 +- src/mesa/main/texstate.c | 23 +++++++------- src/mesa/main/texstore.c | 44 ++++++++++++++------------- src/mesa/swrast/s_texcombine.c | 2 +- src/mesa/swrast/s_texfilter.c | 20 ++++++------ src/mesa/swrast/s_texstore.c | 12 ++++---- src/mesa/swrast/s_triangle.c | 4 +-- 30 files changed, 163 insertions(+), 155 deletions(-) diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index 6b6d1d727fc..5133ea44d4b 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -106,7 +106,7 @@ static void i810SetTexImages( i810ContextPtr imesa, for ( height = i = 0 ; i < numLevels ; i++ ) { t->image[i].image = tObj->Image[0][t->base.firstLevel + i]; t->image[i].offset = height * pitch; - t->image[i].internalFormat = baseImage->Format; + t->image[i].internalFormat = baseImage->_BaseFormat; height += t->image[i].image->Height; } @@ -591,7 +591,7 @@ static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit, * texture environment state has changed. */ - imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format; + imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; } else { imesa->CurrentTexObj[unit] = 0; diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c index 358c554f3b3..a11ae7660a2 100644 --- a/src/mesa/drivers/dri/i830/i830_texstate.c +++ b/src/mesa/drivers/dri/i830/i830_texstate.c @@ -185,7 +185,7 @@ static void i830SetTexImages( i830ContextPtr imesa, } else total_height += t->image[0][i].image->Height; - t->image[0][i].internalFormat = baseImage->Format; + t->image[0][i].internalFormat = baseImage->_BaseFormat; } t->Pitch = pitch; @@ -586,9 +586,9 @@ static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit ) * missed (need to update last stage flag?). Call * i830UpdateTexEnv always. */ - if (tObj->Image[0][tObj->BaseLevel]->Format != + if (tObj->Image[0][tObj->BaseLevel]->_BaseFormat != imesa->TexEnvImageFmt[unit]) { - imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format; + imesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; } i830UpdateTexEnv( ctx, unit ); imesa->TexEnabledMask |= I830_TEX_UNIT_ENABLED(unit); diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 55a5a174030..ba972dac8f1 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -199,7 +199,7 @@ static GLboolean i830SetTexImages( i830ContextPtr i830, t->intel.image[face][i].offset = y * pitch + x * t->intel.texelBytes; - t->intel.image[face][i].internalFormat = baseImage->Format; + t->intel.image[face][i].internalFormat = baseImage->_BaseFormat; d >>= 1; x += step_offsets[face][0] * d; @@ -219,7 +219,7 @@ static GLboolean i830SetTexImages( i830ContextPtr i830, break; t->intel.image[0][i].offset = total_height * pitch; - t->intel.image[0][i].internalFormat = baseImage->Format; + t->intel.image[0][i].internalFormat = baseImage->_BaseFormat; if (t->intel.image[0][i].image->IsCompressed) { if (t->intel.image[0][i].image->Height > 4) diff --git a/src/mesa/drivers/dri/i915/i915_texprog.c b/src/mesa/drivers/dri/i915/i915_texprog.c index 3eaf53d7d58..74ece96f8b7 100644 --- a/src/mesa/drivers/dri/i915/i915_texprog.c +++ b/src/mesa/drivers/dri/i915/i915_texprog.c @@ -291,7 +291,7 @@ static GLuint emit_texenv( struct i915_fragment_program *p, int unit ) struct gl_texture_unit *texUnit = &p->ctx->Texture.Unit[unit]; GLenum envMode = texUnit->EnvMode; struct gl_texture_object *tObj = texUnit->_Current; - GLenum format = tObj->Image[0][tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; GLuint saturate = unit < p->last_tex_stage ? A0_DEST_SATURATE : 0; switch(envMode) { diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 22f38a92397..efd6fc94505 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -115,7 +115,7 @@ static void i915LayoutTextureImages( i915ContextPtr i915, t->intel.image[face][i].offset = y * pitch + x * t->intel.texelBytes; - t->intel.image[face][i].internalFormat = baseImage->Format; + t->intel.image[face][i].internalFormat = baseImage->_BaseFormat; d >>= 1; x += step_offsets[face][0] * d; @@ -144,7 +144,7 @@ static void i915LayoutTextureImages( i915ContextPtr i915, t->intel.image[0][i].image = tObj->Image[0][firstLevel + i]; if (t->intel.image[0][i].image) { t->intel.image[0][i].offset = total_height * pitch; - t->intel.image[0][i].internalFormat = baseImage->Format; + t->intel.image[0][i].internalFormat = baseImage->_BaseFormat; } total_height += MAX2(2, virtual_height); @@ -171,7 +171,7 @@ static void i915LayoutTextureImages( i915ContextPtr i915, break; t->intel.image[0][i].offset = total_height * pitch; - t->intel.image[0][i].internalFormat = baseImage->Format; + t->intel.image[0][i].internalFormat = baseImage->_BaseFormat; if (t->intel.image[0][i].image->IsCompressed) { if (t->intel.image[0][i].image->Height > 4) @@ -266,7 +266,7 @@ static void i945LayoutTextureImages( i915ContextPtr i915, t->intel.image[face][i].offset = y * pitch + x * t->intel.texelBytes; - t->intel.image[face][i].internalFormat = baseImage->Format; + t->intel.image[face][i].internalFormat = baseImage->_BaseFormat; d >>= 1; @@ -326,7 +326,7 @@ static void i945LayoutTextureImages( i915ContextPtr i915, t->intel.image[0][i].offset = total_height * pitch; - t->intel.image[0][i].internalFormat = baseImage->Format; + t->intel.image[0][i].internalFormat = baseImage->_BaseFormat; @@ -358,7 +358,7 @@ static void i945LayoutTextureImages( i915ContextPtr i915, break; t->intel.image[0][i].offset = offset; - t->intel.image[0][i].internalFormat = baseImage->Format; + t->intel.image[0][i].internalFormat = baseImage->_BaseFormat; if (t->intel.image[0][i].image->IsCompressed) sz = MAX2(1, t->intel.image[0][i].image->Height/4) * pitch; diff --git a/src/mesa/drivers/dri/i915/intel_tex.c b/src/mesa/drivers/dri/i915/intel_tex.c index 396e126011f..d256dbf7cb8 100644 --- a/src/mesa/drivers/dri/i915/intel_tex.c +++ b/src/mesa/drivers/dri/i915/intel_tex.c @@ -646,8 +646,7 @@ static void intelUploadTexImage( intelContextPtr intel, image->Width, image->Height, image->Depth, offset, row_len, t->Pitch, t->depth_pitch); - switch(image->IntFormat) - { + switch (image->InternalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: case GL_RGB_S3TC: @@ -669,9 +668,9 @@ static void intelUploadTexImage( intelContextPtr intel, } break; default: - fprintf(stderr,"Internal Compressed format not supported %d\n", image->IntFormat); + fprintf(stderr,"Internal Compressed format not supported %d\n", image->InternalFormat); break; - } + } } else { GLuint row_len = image->Width * image->TexFormat->TexelBytes; diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index ada4b056f57..b6a9e3f931e 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -163,9 +163,9 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, t->setup.tex_cntl &= ~R128_MIP_MAP_DISABLE; #else - if ( ( baseImage->Format == GL_RGBA ) || - ( baseImage->Format == GL_ALPHA ) || - ( baseImage->Format == GL_LUMINANCE_ALPHA ) ) { + if ( ( baseImage->_BaseFormat == GL_RGBA ) || + ( baseImage->_BaseFormat == GL_ALPHA ) || + ( baseImage->_BaseFormat == GL_LUMINANCE_ALPHA ) ) { t->hasAlpha = 1; } else { t->hasAlpha = 0; @@ -188,7 +188,7 @@ static void mach64UpdateTextureEnv( GLcontext *ctx, int unit ) GLint source = mmesa->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[0][tObj->BaseLevel]->Format; + const GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; GLuint s = mmesa->setup.scale_3d_cntl; if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) { diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index 8c28254cbf4..71d264b0f19 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -205,7 +205,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[0][tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; if (tObj != ctx->Texture.Unit[0].Current2D && tObj != ctx->Texture.Unit[0].CurrentRect) @@ -537,7 +537,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[0][tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; *reg = 0; @@ -634,7 +634,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[0][tObj->BaseLevel]->Format; + GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; if (tObj != ctx->Texture.Unit[source].Current2D && tObj != ctx->Texture.Unit[source].CurrentRect) diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index c22323b68fb..6b43f21cd47 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -201,7 +201,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[0][tObj->BaseLevel]->Format; + const GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; GLuint combine; if ( R128_DEBUG & DEBUG_VERBOSE_API ) { diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 5c51e30637b..9d929516c96 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -253,7 +253,7 @@ static void r300SetTexImages(r300ContextPtr rmesa, if(0) fprintf(stderr, "w=%d h=%d d=%d tb=%d intFormat=%d\n", texImage->Width, texImage->Height, texImage->Depth, texImage->TexFormat->TexelBytes, - texImage->IntFormat); + texImage->InternalFormat); /* Align to 32-byte offset. It is faster to do this unconditionally * (no branch penalty). @@ -1325,7 +1325,7 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit) } #endif - format = tObj->Image[0][tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; 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_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 9583a6827e8..e12fd41ad91 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -1111,7 +1111,7 @@ static GLboolean update_tex_common( GLcontext *ctx, int unit ) rmesa->NewGLState |= _NEW_TEXTURE_MATRIX; } - format = tObj->Image[0][tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; 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/s3v/s3v_texmem.c b/src/mesa/drivers/dri/s3v/s3v_texmem.c index 0ce3ff5fc23..5b44340d19b 100644 --- a/src/mesa/drivers/dri/s3v/s3v_texmem.c +++ b/src/mesa/drivers/dri/s3v/s3v_texmem.c @@ -297,7 +297,7 @@ static void s3vUploadTexLevel( s3vContextPtr vmesa, s3vTextureObjectPtr t, default: fprintf(stderr, "Not supported texture format %s\n", - _mesa_lookup_enum_by_nr(image->Format)); + _mesa_lookup_enum_by_nr(image->_BaseFormat)); } DEBUG_TEX(("words = %i\n\n", words)); diff --git a/src/mesa/drivers/dri/s3v/s3v_texstate.c b/src/mesa/drivers/dri/s3v/s3v_texstate.c index b136c9d378c..2719de3663a 100644 --- a/src/mesa/drivers/dri/s3v/s3v_texstate.c +++ b/src/mesa/drivers/dri/s3v/s3v_texstate.c @@ -73,7 +73,7 @@ static void s3vSetTexImages( s3vContextPtr vmesa, for ( height = i = 0 ; i < numLevels ; i++ ) { t->image[i].image = tObj->Image[0][firstLevel + i]; t->image[i].offset = height * pitch; - t->image[i].internalFormat = baseImage->Format; + t->image[i].internalFormat = baseImage->_BaseFormat; height += t->image[i].image->Height; t->TextureBaseAddr[i] = (t->BufAddr + t->image[i].offset + _TEXALIGN) & (GLuint)(~_TEXALIGN); @@ -96,7 +96,7 @@ static void s3vUpdateTexEnv( GLcontext *ctx, GLuint unit ) s3vContextPtr vmesa = S3V_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[0][tObj->BaseLevel]->Format; + const GLuint format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; /* s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; GLuint tc; @@ -246,9 +246,9 @@ static void s3vUpdateTexUnit( GLcontext *ctx, GLuint unit ) /* Update texture environment if texture object image format or * texture environment state has changed. */ - if (tObj->Image[0][tObj->BaseLevel]->Format != + if (tObj->Image[0][tObj->BaseLevel]->_BaseFormat != vmesa->TexEnvImageFmt[unit]) { - vmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->Format; + vmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; s3vUpdateTexEnv( ctx, unit ); } #if 1 diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index ce9d1def8ef..b2802904bda 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -561,6 +561,7 @@ static struct gl_texture_format _savage_texformat_a1114444 = { 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ + 0, /* StencilBits */ 2, /* TexelBytes */ _savage_texstore_a1114444, /* StoreTexImageFunc */ NULL, NULL, NULL, NULL, NULL, NULL /* FetchTexel* filled in by @@ -578,6 +579,7 @@ static struct gl_texture_format _savage_texformat_a1118888 = { 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ + 0, /* StencilBits */ 4, /* TexelBytes */ _savage_texstore_a1118888, /* StoreTexImageFunc */ NULL, NULL, NULL, NULL, NULL, NULL /* FetchTexel* filled in by @@ -1202,7 +1204,7 @@ static void savageUpdateTex0State_s4( GLcontext *ctx ) driUpdateTextureLRU( &t->base ); - format = tObj->Image[0][tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; switch (ctx->Texture.Unit[0].EnvMode) { case GL_REPLACE: @@ -1455,7 +1457,7 @@ static void savageUpdateTex1State_s4( GLcontext *ctx ) driUpdateTextureLRU( &t->base ); - format = tObj->Image[0][tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; switch (ctx->Texture.Unit[1].EnvMode) { case GL_REPLACE: @@ -1629,7 +1631,7 @@ static void savageUpdateTexState_s3d( GLcontext *ctx ) driUpdateTextureLRU( &t->base ); - format = tObj->Image[0][tObj->BaseLevel]->Format; + format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; /* FIXME: copied from utah-glx, probably needs some tuning */ switch (ctx->Texture.Unit[0].EnvMode) { diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 5fa8256f1ba..a8b4c0e74d5 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -63,7 +63,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, int size, texel_size; if (t->format == 0) { - t->format = image->Format; + t->format = image->_BaseFormat; switch (t->format) { case GL_RGBA: @@ -88,7 +88,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, sis_fatal_error("Bad texture format.\n"); } } - assert(t->format == image->Format); + assert(t->format == image->_BaseFormat); texel_size = image->TexFormat->TexelBytes; size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index cf4de23b368..6d39067de40 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -98,7 +98,7 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, srcRowStride, /* dstRowStride */ 0, /* dstImageStride */ srcWidth, srcHeight, 1, - texImage->Format, _t, srcImage, &ctx->DefaultPacking); + texImage->_BaseFormat, _t, srcImage, &ctx->DefaultPacking); } if (srcHeight == 1) { @@ -139,7 +139,7 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, if (bpt) { src = _s; dst = _d; - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, dstImage, 0, 0, 0, /* dstX/Y/Zoffset */ dstWidth * bpt, @@ -1185,7 +1185,7 @@ adjust2DRatio (GLcontext *ctx, return GL_FALSE; } - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, tempImage, 0, 0, 0, /* dstX/Y/Zoffset */ width * texelBytes, /* dstRowStride */ @@ -1229,7 +1229,7 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ dstRowStride, @@ -1321,7 +1321,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, case GL_RGBA4_S3TC: internalFormat = GL_COMPRESSED_RGBA_FXT1_3DFX; } - texImage->IntFormat = internalFormat; + texImage->InternalFormat = internalFormat; } #endif #if FX_TC_NAPALM @@ -1333,7 +1333,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, texNapalm = GL_COMPRESSED_RGBA_FXT1_3DFX; } if (texNapalm) { - texImage->IntFormat = internalFormat = texNapalm; + texImage->InternalFormat = internalFormat = texNapalm; texImage->IsCompressed = GL_TRUE; } } @@ -1386,7 +1386,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, @@ -1469,11 +1469,11 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, assert(mml); assert(texImage->Data); /* must have an existing texture image! */ - assert(texImage->Format); + assert(texImage->_BaseFormat); texelBytes = texImage->TexFormat->TexelBytes; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, mml->width); + dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; } @@ -1496,7 +1496,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset, yoffset, 0, dstRowStride, @@ -1736,12 +1736,12 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, mml = TDFX_TEXIMAGE_DATA(texImage); assert(mml); - srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, width); - destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->IntFormat, + texImage->InternalFormat, mml->width, (GLubyte*) texImage->Data); @@ -1757,9 +1757,9 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, * see fxDDCompressedTexImage2D for caveats */ if (mml->wScale != 1 || mml->hScale != 1) { - srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, texImage->Width); + srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, texImage->Width); - destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); _mesa_upscale_teximage2d(srcRowStride, texImage->Height / 4, destRowStride, mml->height / 4, @@ -1829,7 +1829,7 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, tObj->Image[0][level]->Height = height; tObj->Image[0][level]->Border = border; #if 0 - tObj->Image[0][level]->IntFormat = internalFormat; + tObj->Image[0][level]->InternalFormat = internalFormat; #endif if (level == 0) { /* don't use mipmap levels > 0 */ diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c index 7059b56e3d0..f5f385fad7c 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c @@ -1629,7 +1629,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[0][tObj->BaseLevel]->Format; + baseFormat = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; if (TDFX_IS_NAPALM(fxMesa)) { /* see if we really need to update the unit */ @@ -1952,10 +1952,10 @@ static void setupTextureDoubleTMU(GLcontext * ctx) baseImage0->Format != fxMesa->TexState.TexFormat[1] || (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)*/) { hw1 = SetupTexEnvNapalm(ctx, GL_TRUE, &ctx->Texture.Unit[0], - baseImage0->Format, &fxMesa->TexCombineExt[1]); + baseImage0->_BaseFormat, &fxMesa->TexCombineExt[1]); #if 0/*JJJ*/ fxMesa->TexState.EnvMode[1] = envMode0; - fxMesa->TexState.TexFormat[1] = baseImage0->Format; + fxMesa->TexState.TexFormat[1] = baseImage0->_BaseFormat; fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled; #endif } @@ -1964,13 +1964,13 @@ static void setupTextureDoubleTMU(GLcontext * ctx) if (1/*fxMesa->TexState.Enabled[1] != ctx->Texture.Unit[1]._ReallyEnabled || envMode1 != fxMesa->TexState.EnvMode[0] || envMode1 == GL_COMBINE_EXT || - baseImage1->Format != fxMesa->TexState.TexFormat[0] || + baseImage1->_BaseFormat != fxMesa->TexState.TexFormat[0] || (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)*/) { hw2 = SetupTexEnvNapalm(ctx, GL_FALSE, &ctx->Texture.Unit[1], - baseImage1->Format, &fxMesa->TexCombineExt[0]); + baseImage1->_BaseFormat, &fxMesa->TexCombineExt[0]); #if 0/*JJJ*/ fxMesa->TexState.EnvMode[0] = envMode1; - fxMesa->TexState.TexFormat[0] = baseImage1->Format; + fxMesa->TexState.TexFormat[0] = baseImage1->_BaseFormat; fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled; #endif } @@ -1994,21 +1994,21 @@ static void setupTextureDoubleTMU(GLcontext * ctx) envMode0 == GL_COMBINE_EXT || envMode1 != fxMesa->TexState.EnvMode[unit1] || envMode1 == GL_COMBINE_EXT || - baseImage0->Format != fxMesa->TexState.TexFormat[unit0] || - baseImage1->Format != fxMesa->TexState.TexFormat[unit1] || + baseImage0->_BaseFormat != fxMesa->TexState.TexFormat[unit0] || + baseImage1->_BaseFormat != fxMesa->TexState.TexFormat[unit1] || (fxMesa->Fallback & TDFX_FALLBACK_TEXTURE_ENV)*/) { if (!SetupDoubleTexEnvVoodoo3(ctx, unit0, - ctx->Texture.Unit[0].EnvMode, baseImage0->Format, - ctx->Texture.Unit[1].EnvMode, baseImage1->Format)) { + ctx->Texture.Unit[0].EnvMode, baseImage0->_BaseFormat, + ctx->Texture.Unit[1].EnvMode, baseImage1->_BaseFormat)) { FALLBACK(fxMesa, TDFX_FALLBACK_TEXTURE_ENV, GL_TRUE); } #if 0/*JJJ*/ fxMesa->TexState.EnvMode[unit0] = envMode0; - fxMesa->TexState.TexFormat[unit0] = baseImage0->Format; + fxMesa->TexState.TexFormat[unit0] = baseImage0->_BaseFormat; fxMesa->TexState.EnvMode[unit1] = envMode1; - fxMesa->TexState.TexFormat[unit1] = baseImage1->Format; + fxMesa->TexState.TexFormat[unit1] = baseImage1->_BaseFormat; fxMesa->TexState.Enabled[0] = ctx->Texture.Unit[0]._ReallyEnabled; fxMesa->TexState.Enabled[1] = ctx->Texture.Unit[1]._ReallyEnabled; #endif diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index fb048c05f86..126a26c3451 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -782,13 +782,14 @@ static void viaTexImage(GLcontext *ctx, GLint dstRowStride, dstImageStride = 0; GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); + dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,width); } else { dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; } ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, dims, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, dims, + texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index f3f12c4cc7b..581df8b2b3b 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -95,7 +95,8 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, srcRowStride, /* dstRowStride */ 0, /* dstImageStride */ srcWidth, srcHeight, 1, - texImage->Format, _t, srcImage, &ctx->DefaultPacking); + texImage->_BaseFormat, _t, + srcImage, &ctx->DefaultPacking); } if (srcHeight == 1) { @@ -136,7 +137,7 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, if (bpt) { src = _s; dst = _d; - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, dstImage, 0, 0, 0, /* dstX/Y/Zoffset */ dstWidth * bpt, @@ -1238,7 +1239,7 @@ adjust2DRatio (GLcontext *ctx, return GL_FALSE; } - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, tempImage, 0, 0, 0, /* dstX/Y/Zoffset */ width * texelBytes, /* dstRowStride */ @@ -1282,7 +1283,7 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ dstRowStride, @@ -1313,7 +1314,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, if (TDFX_DEBUG & VERBOSE_TEXTURE) { fprintf(stderr, "fxDDTexImage2D: id=%d int 0x%x format 0x%x type 0x%x %dx%d\n", - texObj->Name, texImage->IntFormat, format, type, + texObj->Name, texImage->InternalFormat, format, type, texImage->Width, texImage->Height); } @@ -1362,7 +1363,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, case GL_RGBA4_S3TC: internalFormat = GL_COMPRESSED_RGBA_FXT1_3DFX; } - texImage->IntFormat = internalFormat; + texImage->InternalFormat = internalFormat; } #endif #if FX_TC_NAPALM @@ -1374,7 +1375,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, texNapalm = GL_COMPRESSED_RGBA_FXT1_3DFX; } if (texNapalm) { - texImage->IntFormat = internalFormat = texNapalm; + texImage->InternalFormat = internalFormat = texNapalm; texImage->IsCompressed = GL_TRUE; } } @@ -1429,7 +1430,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, @@ -1515,11 +1516,11 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, assert(mml); assert(texImage->Data); /* must have an existing texture image! */ - assert(texImage->Format); + assert(texImage->_BaseFormat); texelBytes = texImage->TexFormat->TexelBytes; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, mml->width); + dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; } @@ -1542,7 +1543,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, (GLubyte *) texImage->Data, xoffset, yoffset, 0, /* dstX/Y/Zoffset */ dstRowStride, @@ -1739,12 +1740,12 @@ fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, mml = FX_MIPMAP_DATA(texImage); assert(mml); - srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, width); - destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->IntFormat, + texImage->InternalFormat, mml->width, (GLubyte*) texImage->Data); @@ -1760,9 +1761,9 @@ fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, * see fxDDCompressedTexImage2D for caveats */ if (mml->wScale != 1 || mml->hScale != 1) { - srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, texImage->Width); + srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, texImage->Width); - destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); _mesa_upscale_teximage2d(srcRowStride, texImage->Height / 4, destRowStride, mml->height / 4, diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index f2ab7dc9c06..6fc7c8ab631 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -406,9 +406,11 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) } if (att->Type == GL_TEXTURE) { - w = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Width; - h = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Height; - f = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Format; + const struct gl_texture_image *texImg + = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + w = texImg->Width; + h = texImg->Height; + f = texImg->_BaseFormat; numImages++; if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) { /* XXX need GL_DEPTH_STENCIL_EXT test? */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 962d9f29cfa..b551abae344 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1206,13 +1206,13 @@ struct gl_texture_format */ struct gl_texture_image { - GLenum Format; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, + GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_COLOR_INDEX, * GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT * only. Used for choosing TexEnv arithmetic. */ - GLint IntFormat; /**< Internal format as given by the user */ + GLint InternalFormat; /**< Internal format as given by the user */ GLuint Border; /**< 0 or 1 */ GLuint Width; /**< = 2^WidthLog2 + 2*Border */ GLuint Height; /**< = 2^HeightLog2 + 2*Border */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 862a0d40712..9731185f443 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1037,8 +1037,8 @@ static void clear_teximage_fields(struct gl_texture_image *img) { ASSERT(img); - img->Format = 0; - img->IntFormat = 0; + img->_BaseFormat = 0; + img->InternalFormat = 0; img->Border = 0; img->Width = 0; img->Height = 0; @@ -1081,9 +1081,9 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, GLint border, GLenum internalFormat) { ASSERT(img); - img->Format = _mesa_base_tex_format( ctx, internalFormat ); - ASSERT(img->Format > 0); - img->IntFormat = internalFormat; + img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat ); + ASSERT(img->_BaseFormat > 0); + img->InternalFormat = internalFormat; img->Border = border; img->Width = width; img->Height = height; @@ -1969,12 +1969,12 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, } } - if (teximage->IntFormat == GL_YCBCR_MESA) { + if (teximage->InternalFormat == GL_YCBCR_MESA) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D"); return GL_TRUE; } - if (teximage->Format == GL_DEPTH_COMPONENT) { + if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) { if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage%D(no depth buffer)", @@ -1982,7 +1982,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } } - else if (teximage->Format == GL_DEPTH_STENCIL_EXT) { + else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { if (!ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer || !ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -3191,7 +3191,7 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); - if ((GLint) format != texImage->IntFormat) { + if ((GLint) format != texImage->InternalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCompressedTexSubImage1D(format)"); return; @@ -3241,7 +3241,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); - if ((GLint) format != texImage->IntFormat) { + if ((GLint) format != texImage->InternalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCompressedTexSubImage2D(format)"); return; @@ -3291,7 +3291,7 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); - if ((GLint) format != texImage->IntFormat) { + if ((GLint) format != texImage->InternalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCompressedTexSubImage3D(format)"); return; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index c4cfe3310c8..7b61bfadd99 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -435,7 +435,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, t->Complete = GL_FALSE; return; } - if (t->Image[0][i]->Format == GL_DEPTH_COMPONENT) { + if (t->Image[0][i]->_BaseFormat == GL_DEPTH_COMPONENT) { t->Complete = GL_FALSE; incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); return; @@ -482,7 +482,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, return; } /* Don't support GL_DEPTH_COMPONENT for cube maps */ - if (t->Image[face][i]->Format == GL_DEPTH_COMPONENT) { + if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) { t->Complete = GL_FALSE; incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); return; diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index ae4a2a5527b..9c21e03515a 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -164,7 +164,7 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att) trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; - trb->Base.InternalFormat = trb->TexImage->IntFormat; /* XXX fix? */ + trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX fix? */ trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat; #if 0 /* fix/avoid this assertion someday */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 3dc3292dd7d..3cc343d287e 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1717,38 +1717,39 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Depth; return; case GL_TEXTURE_INTERNAL_FORMAT: - *params = img->IntFormat; + *params = img->InternalFormat; return; case GL_TEXTURE_BORDER: *params = img->Border; return; case GL_TEXTURE_RED_SIZE: - if (img->Format == GL_RGB || img->Format == GL_RGBA) + if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) *params = img->TexFormat->RedBits; else *params = 0; return; case GL_TEXTURE_GREEN_SIZE: - if (img->Format == GL_RGB || img->Format == GL_RGBA) + if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) *params = img->TexFormat->GreenBits; else *params = 0; return; case GL_TEXTURE_BLUE_SIZE: - if (img->Format == GL_RGB || img->Format == GL_RGBA) + if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) *params = img->TexFormat->BlueBits; else *params = 0; return; case GL_TEXTURE_ALPHA_SIZE: - if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA || - img->Format == GL_RGBA) + if (img->_BaseFormat == GL_ALPHA || + img->_BaseFormat == GL_LUMINANCE_ALPHA || + img->_BaseFormat == GL_RGBA) *params = img->TexFormat->AlphaBits; else *params = 0; return; case GL_TEXTURE_INTENSITY_SIZE: - if (img->Format != GL_INTENSITY) + if (img->_BaseFormat != GL_INTENSITY) *params = 0; else if (img->TexFormat->IntensityBits > 0) *params = img->TexFormat->IntensityBits; @@ -1756,8 +1757,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); return; case GL_TEXTURE_LUMINANCE_SIZE: - if (img->Format != GL_LUMINANCE && - img->Format != GL_LUMINANCE_ALPHA) + if (img->_BaseFormat != GL_LUMINANCE && + img->_BaseFormat != GL_LUMINANCE_ALPHA) *params = 0; else if (img->TexFormat->LuminanceBits > 0) *params = img->TexFormat->LuminanceBits; @@ -1765,7 +1766,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); return; case GL_TEXTURE_INDEX_SIZE_EXT: - if (img->Format == GL_COLOR_INDEX) + if (img->_BaseFormat == GL_COLOR_INDEX) *params = img->TexFormat->IndexBits; else *params = 0; @@ -3033,7 +3034,7 @@ update_texture_state( GLcontext *ctx ) texUnit->_CurrentCombine = & texUnit->Combine; } else { - GLenum format = texUnit->_Current->Image[0][0]->Format; + GLenum format = texUnit->_Current->Image[0][0]->_BaseFormat; if (format == GL_COLOR_INDEX) { format = GL_RGBA; /* a bit of a hack */ } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 9423b643db4..f4da9053f7c 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2338,7 +2338,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, const GLint dstRowStride = 0, dstImageStride = 0; GLboolean success; ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ @@ -2425,13 +2425,14 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLint dstRowStride, dstImageStride = 0; GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); + dstRowStride + = _mesa_compressed_row_stride(texImage->InternalFormat,width); } else { dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; } ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ @@ -2504,7 +2505,8 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, GLint dstRowStride, dstImageStride; GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); + dstRowStride + = _mesa_compressed_row_stride(texImage->InternalFormat,width); dstImageStride = 0; } else { @@ -2512,7 +2514,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, dstImageStride = dstRowStride * height; } ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ @@ -2558,7 +2560,7 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, const GLint dstRowStride = 0, dstImageStride = 0; GLboolean success; ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset, 0, 0, /* offsets */ @@ -2604,14 +2606,14 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLint dstRowStride = 0, dstImageStride = 0; GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, texImage->Width); } else { dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; } ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset, yoffset, 0, @@ -2657,7 +2659,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLint dstRowStride, dstImageStride; GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, texImage->Width); dstImageStride = 0; /* XXX fix */ } @@ -2666,7 +2668,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, dstImageStride = dstRowStride * texImage->Height; } ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format, + success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset, yoffset, zoffset, @@ -2850,13 +2852,13 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, if (!data) return; - srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, width); src = (const GLubyte *) data; - destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, texImage->Width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->IntFormat, + texImage->InternalFormat, texImage->Width, (GLubyte*) texImage->Data); @@ -3683,21 +3685,21 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, assert(texObj->Target == GL_TEXTURE_2D); - if (srcImage->Format == GL_RGB) { + if (srcImage->_BaseFormat == GL_RGB) { convertFormat = &_mesa_texformat_rgb; components = 3; } - else if (srcImage->Format == GL_RGBA) { + else if (srcImage->_BaseFormat == GL_RGBA) { convertFormat = &_mesa_texformat_rgba; components = 4; } else { - _mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps"); + _mesa_problem(ctx, "bad srcImage->_BaseFormat in _mesa_generate_mipmaps"); return; } /* allocate storage for uncompressed GL_RGB or GL_RGBA images */ - size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE) + size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE) * srcImage->Width * srcImage->Height * srcImage->Depth + 20; /* 20 extra bytes, just be safe when calling last FetchTexel */ srcData = (GLubyte *) _mesa_malloc(size); @@ -3788,7 +3790,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* initialize new image */ _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, - dstDepth, border, srcImage->IntFormat); + dstDepth, border, srcImage->InternalFormat); dstImage->DriverData = NULL; dstImage->TexFormat = srcImage->TexFormat; dstImage->FetchTexelc = srcImage->FetchTexelc; @@ -3861,10 +3863,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, GLubyte *temp; /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = convertFormat->BaseFormat; - GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat, - dstWidth); + GLint dstRowStride + = _mesa_compressed_row_stride(srcImage->InternalFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); - dstImage->TexFormat->StoreImage(ctx, 2, dstImage->Format, + dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat, dstImage->TexFormat, dstImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 0f662c3d2be..3c9fdc4d757 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -743,7 +743,7 @@ texture_apply( const GLcontext *ctx, baseLevel = texUnit->_Current->BaseLevel; ASSERT(texUnit->_Current->Image[0][baseLevel]); - format = texUnit->_Current->Image[0][baseLevel]->Format; + format = texUnit->_Current->Image[0][baseLevel]->_BaseFormat; if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) { format = GL_RGBA; /* a bit of a hack */ diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 05618a1f802..f6e14a4d97d 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1041,7 +1041,7 @@ sample_2d_linear_repeat(GLcontext *ctx, ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(img->Border == 0); - ASSERT(img->Format != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); @@ -1234,7 +1234,7 @@ opt_sample_rgb_2d( GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->Format==GL_RGB); + ASSERT(img->_BaseFormat==GL_RGB); ASSERT(img->_IsPowerOfTwo); for (k=0; kWrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->Format==GL_RGBA); + ASSERT(img->_BaseFormat==GL_RGBA); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { @@ -1305,7 +1305,7 @@ sample_lambda_2d( GLcontext *ctx, const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) - && (tImg->Format != GL_COLOR_INDEX) + && (tImg->_BaseFormat != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; ASSERT(lambda != NULL); @@ -2045,7 +2045,7 @@ sample_nearest_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->Format != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); /* XXX move Wrap mode tests outside of loops for common cases */ for (i = 0; i < n; i++) { @@ -2100,7 +2100,7 @@ sample_linear_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->Format != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); /* XXX lots of opportunity for optimization in this loop */ for (i = 0; i < n; i++) { @@ -2248,8 +2248,8 @@ sample_depth_texture( GLcontext *ctx, (void) lambda; - ASSERT(tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT || - tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_STENCIL_EXT); + ASSERT(tObj->Image[0][tObj->BaseLevel]->_BaseFormat == GL_DEPTH_COMPONENT || + tObj->Image[0][tObj->BaseLevel]->_BaseFormat == GL_DEPTH_STENCIL_EXT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || @@ -2544,7 +2544,7 @@ sample_depth_texture2(const GLcontext *ctx, * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object * isn't a depth texture. */ - if (texImage->Format != GL_DEPTH_COMPONENT) { + if (texImage->_BaseFormat != GL_DEPTH_COMPONENT) { _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); return; } @@ -2647,7 +2647,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[0][t->BaseLevel]->Format; + const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat; switch (t->Target) { case GL_TEXTURE_1D: diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c index c0da83eb9fe..ff1f9d9992d 100644 --- a/src/mesa/swrast/s_texstore.c +++ b/src/mesa/swrast/s_texstore.c @@ -394,7 +394,7 @@ _swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, ASSERT(ctx->Driver.TexImage1D); - if (texImage->Format == GL_DEPTH_COMPONENT) { + if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, 1); if (!image) { @@ -408,7 +408,7 @@ _swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } - else if (texImage->Format == GL_DEPTH_STENCIL_EXT) { + else if (texImage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { /* read depth/stencil image from framebuffer */ GLuint *image = read_depth_stencil_image(ctx, x, y, width, 1); if (!image) { @@ -463,7 +463,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx, ASSERT(ctx->Driver.TexImage2D); - if (texImage->Format == GL_DEPTH_COMPONENT) { + if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { @@ -477,7 +477,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } - else if (texImage->Format == GL_DEPTH_STENCIL_EXT) { + else if (texImage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { /* read depth/stencil image from framebuffer */ GLuint *image = read_depth_stencil_image(ctx, x, y, width, height); if (!image) { @@ -534,7 +534,7 @@ _swrast_copy_texsubimage3d( GLcontext *ctx, ASSERT(ctx->Driver.TexImage3D); - if (texImage->Format == GL_DEPTH_COMPONENT) { + if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { @@ -548,7 +548,7 @@ _swrast_copy_texsubimage3d( GLcontext *ctx, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } - else if (texImage->Format == GL_DEPTH_STENCIL_EXT) { + else if (texImage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { /* read depth/stencil image from framebuffer */ GLuint *image = read_depth_stencil_image(ctx, x, y, width, height); if (!image) { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 6ed405f0536..42acdc8ff60 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -544,7 +544,7 @@ affine_span(GLcontext *ctx, struct sw_span *span, 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.format = obj->Image[0][b]->_BaseFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ span.arrayMask |= SPAN_RGBA; \ @@ -814,7 +814,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span, 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.format = obj->Image[0][b]->_BaseFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ \ -- cgit v1.2.3