From: Brian Paul Date: Mon, 28 Sep 2009 02:07:41 +0000 (-0600) Subject: mesa/drivers: use _mesa_get_format_bytes() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e0bc4533ebccbfb844522e2b6ddd171b97d693e8;p=mesa.git mesa/drivers: use _mesa_get_format_bytes() --- diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index aa363906892..5c98860cdad 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -333,8 +333,7 @@ intelTexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (texImage->TexFormat->TexelBytes == 0) { - /* must be a compressed format */ + if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = @@ -342,7 +341,7 @@ intelTexImage(GLcontext * ctx, texImage->Height, texImage->Depth, texImage->TexFormat->MesaFormat); } else { - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index f75d2ae004b..c8de38bc723 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -91,7 +91,7 @@ intelTexSubimage(GLcontext * ctx, assert(dims != 3); } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } } diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c index 9a2d62b53b7..86816c0d816 100644 --- a/src/mesa/drivers/dri/mga/mgatexmem.c +++ b/src/mesa/drivers/dri/mga/mgatexmem.c @@ -137,7 +137,7 @@ static void mgaUploadSubImage( mgaContextPtr mmesa, * directly used by the hardware for texturing. */ - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); length = texImage->Width * texImage->Height * texelBytes; if ( t->base.heap->heapId == MGA_CARD_HEAP ) { unsigned tex_offset = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 38db305e2a7..11c21037c44 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -325,7 +325,7 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, if (!texImage->IsCompressed && !mt->compressed && - texImage->TexFormat->TexelBytes != mt->bpp) + _mesa_get_format_bytes(texImage->TexFormat->MesaFormat) != mt->bpp) return GL_FALSE; lvl = &mt->levels[level - mt->firstLevel]; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 4a221314861..a35c783d2ee 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -544,7 +544,7 @@ static void radeon_teximage( texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); _mesa_set_fetch_functions(texImage, dims); - if (texImage->TexFormat->TexelBytes == 0) { + if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = @@ -555,7 +555,7 @@ static void radeon_teximage( texImage->IsCompressed = GL_FALSE; texImage->CompressedSize = 0; - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { postConvWidth = 32 / texelBytes; @@ -593,7 +593,7 @@ static void radeon_teximage( if (texImage->IsCompressed) { size = texImage->CompressedSize; } else { - size = texImage->Width * texImage->Height * texImage->Depth * texImage->TexFormat->TexelBytes; + size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } texImage->Data = _mesa_alloc_texmemory(size); } @@ -631,7 +631,7 @@ static void radeon_teximage( radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } if (dims == 3) { @@ -642,7 +642,7 @@ static void radeon_teximage( _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); for (i = 0; i < depth; ++i) { - dstImageOffsets[i] = dstRowStride/texImage->TexFormat->TexelBytes * height * i; + dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat->MesaFormat) * height * i; } } else { dstImageOffsets = texImage->ImageOffsets; @@ -757,7 +757,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } if (compressed) { diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 28ced6cfd5f..f40a8732098 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -425,7 +425,7 @@ static void sisTexSubImage1D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); copySize = width * texelBytes; src = (char *)texImage->Data + xoffset * texelBytes; @@ -513,7 +513,7 @@ static void sisTexSubImage2D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); copySize = width * texelBytes; src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) * diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 91650088b98..e87ee9eba2b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1407,7 +1407,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; texImage->FetchTexelc = fxFetchFunction(mesaFormat); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { texImage->CompressedSize = _mesa_compressed_texture_size(ctx, @@ -1494,7 +1494,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, assert(texImage->Data); /* must have an existing texture image! */ assert(texImage->_BaseFormat); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width); } else {