Use _mesa_is_format_compressed() instead.
struct gl_texture_image *image,
GLuint face, GLuint level)
{
+ GLboolean isCompressed = _mesa_is_format_compressed(image->TexFormat);
+
/* Images with borders are never pulled into mipmap trees.
*/
if (image->Border ||
return GL_FALSE;
if (image->InternalFormat != mt->internal_format ||
- image->IsCompressed != mt->compressed)
+ isCompressed != mt->compressed)
return GL_FALSE;
- if (!image->IsCompressed &&
+ if (!isCompressed &&
!mt->compressed &&
_mesa_get_format_bytes(image->TexFormat) != mt->cpp)
return GL_FALSE;
}
assert(!intelObj->mt);
- if (intelImage->base.IsCompressed)
+ if (_mesa_is_format_compressed(intelImage->base.TexFormat))
comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat);
texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat);
if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
- texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
int comp_byte = 0;
GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat);
GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat);
- if (intelImage->base.IsCompressed) {
+ if (_mesa_is_format_compressed(intelImage->base.TexFormat)) {
comp_byte =
intel_compressed_num_bytes(intelImage->base.TexFormat);
}
}
else {
/* Allocate regular memory and store the image there temporarily. */
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
sizeInBytes = texImage->CompressedSize;
dstRowStride =
_mesa_compressed_row_stride(texImage->TexFormat, width);
&dstRowStride,
texImage->ImageOffsets);
else {
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
dstRowStride =
_mesa_compressed_row_stride(texImage->TexFormat, width);
assert(dims != 3);
intel_miptree_reference(&intelObj->mt, firstImage->mt);
}
- if (firstImage->base.IsCompressed) {
+ if (_mesa_is_format_compressed(firstImage->base.TexFormat)) {
comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat);
cpp = comp_byte;
}
intelObj->mt->height0 != firstImage->base.Height ||
intelObj->mt->depth0 != firstImage->base.Depth ||
intelObj->mt->cpp != cpp ||
- intelObj->mt->compressed != firstImage->base.IsCompressed)) {
+ intelObj->mt->compressed != _mesa_is_format_compressed(firstImage->base.TexFormat))) {
intel_miptree_release(intel, &intelObj->mt);
}
| ((firstImage->Height - 1) << R200_PP_TX_HEIGHTMASK_SHIFT));
if ( !t->image_override ) {
- if (firstImage->IsCompressed)
+ if (_mesa_is_format_compressed(firstImage->TexFormat))
t->pp_txpitch = (firstImage->Width + 63) & ~(63);
else
t->pp_txpitch = ((firstImage->Width * texelBytes) + 63) & ~(63);
GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt,
struct gl_texture_image *texImage, GLuint face, GLuint level)
{
+ GLboolean isCompressed = _mesa_is_format_compressed(texImage->TexFormat);
radeon_mipmap_level *lvl;
if (face >= mt->faces || level < mt->firstLevel || level > mt->lastLevel)
return GL_FALSE;
if (texImage->InternalFormat != mt->internal_format ||
- texImage->IsCompressed != mt->compressed)
+ isCompressed != mt->compressed)
return GL_FALSE;
- if (!texImage->IsCompressed &&
+ if (!isCompressed &&
!mt->compressed &&
_mesa_get_format_bytes(texImage->TexFormat) != mt->bpp)
return GL_FALSE;
numfaces = 6;
firstImage = texObj->Image[0][firstLevel];
- compressed = firstImage->IsCompressed ? firstImage->TexFormat : 0;
+ compressed = _mesa_is_format_compressed(firstImage->TexFormat) ? firstImage->TexFormat : 0;
texelBytes = _mesa_get_format_bytes(firstImage->TexFormat);
return (mt->firstLevel == firstLevel &&
void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t,
radeon_texture_image *image, GLuint face, GLuint level)
{
- GLuint compressed = image->base.IsCompressed ? image->base.TexFormat : 0;
+ GLuint compressed = _mesa_is_format_compressed(image->base.TexFormat) ? image->base.TexFormat : 0;
GLuint numfaces = 1;
GLuint firstLevel, lastLevel;
GLuint texelBytes;
GLuint format, filter;
};
+/* XXX verify this table against MESA_FORMAT_x values */
static const struct tx_table tx_table[] =
{
+ 0, /* MESA_FORMAT_NONE */
_ALPHA(RGBA8888),
_ALPHA_REV(RGBA8888),
_ALPHA(ARGB8888),
| ((firstImage->Height - 1) << RADEON_TEX_VSIZE_SHIFT));
if ( !t->image_override ) {
- if (firstImage->IsCompressed)
+ if (_mesa_is_format_compressed(firstImage->TexFormat))
t->pp_txpitch = (firstImage->Width + 63) & ~(63);
else
t->pp_txpitch = ((firstImage->Width * texelBytes) + 63) & ~(63);
if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
- texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
texImage->TexFormat);
} else {
- texImage->IsCompressed = GL_FALSE;
texImage->CompressedSize = 0;
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
dstRowStride = lvl->rowstride;
} else {
int size;
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
size = texImage->CompressedSize;
} else {
size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat);
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
- assert(!texImage->IsCompressed);
mml = TDFX_TEXIMAGE_DATA(texImage);
GLvoid *tempImage;
GLuint dstImageOffsets = 0;
- if (!texImage->IsCompressed) {
+ if (!_mesa_is_format_compressed(texImage->TexFormat)) {
GLubyte *destAddr;
tempImage = MALLOC(width * height * texelBytes);
* be correct, since it would mess with "compressedSize".
* Ditto for GL_RGBA[4]_S3TC, which is always mapped to DXT3.
*/
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
}
if (texNapalm) {
texImage->InternalFormat = internalFormat = texNapalm;
- texImage->IsCompressed = GL_TRUE;
+ _mesa_is_format_compressed(texImage->TexFormat) = GL_TRUE;
}
}
#endif
texImage->FetchTexelc = fxFetchFunction(mesaFormat);
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
mml->width,
mml->height,
assert(texImage->_BaseFormat);
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width);
} else {
dstRowStride = mml->width * texelBytes;
return;
}
- assert(texImage->IsCompressed);
-
ti = TDFX_TEXTURE_DATA(texObj);
if (!ti) {
texObj->DriverData = fxAllocTexObjData(fxMesa);
if (texelBytes == 0) {
/* compressed format */
- texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes);
/* allocate memory */
- if (texImage->IsCompressed)
+ if (_mesa_is_format_compressed(texImage->TexFormat))
sizeInBytes = texImage->CompressedSize;
else
sizeInBytes = postConvWidth * postConvHeight * texelBytes;
GLint dstRowStride;
GLboolean success;
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width);
}
else {
const GLint newHeight = height * mml->hScale;
GLvoid *tempImage;
- if (!texImage->IsCompressed) {
+ if (!_mesa_is_format_compressed(texImage->TexFormat)) {
GLubyte *destAddr;
tempImage = MALLOC(width * height * texelBytes);
#if FX_COMPRESS_S3TC_AS_FXT1_HACK
/* [koolsmoky] substitute FXT1 for DXTn and Legacy S3TC */
- if (!ctx->Mesa_DXTn && texImage->IsCompressed) {
+ if (!ctx->Mesa_DXTn && _mesa_is_format_compressed(texImage->TexFormat)) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_RGB_S3TC:
}
if (texNapalm) {
texImage->InternalFormat = internalFormat = texNapalm;
- texImage->IsCompressed = GL_TRUE;
}
}
#endif
/* allocate mipmap buffer */
assert(!texImage->Data);
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
texImage->CompressedSize = _mesa_compressed_texture_size(ctx,
mml->width,
mml->height,
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
const GLint maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
- assert(!texImage->IsCompressed);
+ assert(!_mesa_is_format_compressed(texImage->TexFormat));
while (level < texObj->MaxLevel && level < maxLevels - 1) {
mipWidth = width / 2;
assert(texImage->_BaseFormat);
texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat);
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width);
} else {
dstRowStride = mml->width * texelBytes;
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
const GLint maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
- assert(!texImage->IsCompressed);
+ assert(!_mesa_is_format_compressed(texImage->TexFormat));
width = texImage->Width;
height = texImage->Height;
width, height);
}
- assert(texImage->IsCompressed);
+ assert(_mesa_is_format_compressed(texImage->TexFormat));
if (!fxIsTexSupported(target, internalFormat, texImage)) {
_mesa_problem(NULL, "fx Driver: unsupported texture in fxDDCompressedTexImg()\n");
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- assert(!texImage->IsCompressed);
+ assert(!_mesa_is_format_compressed(texImage->TexFormat));
}
fxTexInvalidate(ctx, texObj);
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- assert(!texImage->IsCompressed);
+ assert(!_mesa_is_format_compressed(texImage->TexFormat));
}
if (ti->validated && ti->isInTM)
ASSERT(maxLevels > 0); /* bad target */
/* Find convertFormat - the format that do_row() will process */
- if (srcImage->IsCompressed) {
+ if (_mesa_is_format_compressed(srcImage->TexFormat)) {
/* setup for compressed textures */
GLuint row;
GLint components, size;
&dstWidth, &dstHeight, &dstDepth);
if (!nextLevel) {
/* all done */
- if (srcImage->IsCompressed) {
+ if (_mesa_is_format_compressed(srcImage->TexFormat)) {
_mesa_free((void *) srcData);
_mesa_free(dstData);
}
dstImage->TexFormat = srcImage->TexFormat;
dstImage->FetchTexelc = srcImage->FetchTexelc;
dstImage->FetchTexelf = srcImage->FetchTexelf;
- dstImage->IsCompressed = srcImage->IsCompressed;
- if (dstImage->IsCompressed) {
+ if (_mesa_is_format_compressed(dstImage->TexFormat)) {
dstImage->CompressedSize
= ctx->Driver.CompressedTextureSize(ctx, dstImage->Width,
dstImage->Height,
/* Alloc new teximage data buffer.
* Setup src and dest data pointers.
*/
- if (dstImage->IsCompressed) {
+ if (_mesa_is_format_compressed(dstImage->TexFormat)) {
dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize);
if (!dstImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
dstData, dstImage->RowStride);
- if (dstImage->IsCompressed) {
+ if (_mesa_is_format_compressed(dstImage->TexFormat)) {
GLubyte *temp;
/* compress image from dstData into dstImage->Data */
const GLenum srcFormat = _mesa_get_format_base_format(convertFormat);
FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */
FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */
- GLboolean IsCompressed; /**< GL_ARB_texture_compression */
GLuint CompressedSize; /**< GL_ARB_texture_compression */
GLuint RowStride; /**< Padded width in units of texels */
{
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (texImage) {
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
/* this typically calls _mesa_get_compressed_teximage() */
ctx->Driver.GetCompressedTexImage(ctx, target, level, img,
texObj, texImage);
img->TexFormat = MESA_FORMAT_NONE;
img->FetchTexelc = NULL;
img->FetchTexelf = NULL;
- img->IsCompressed = 0;
img->CompressedSize = 0;
}
img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
- img->IsCompressed = GL_FALSE;
img->CompressedSize = 0;
if ((width == 1 || _mesa_is_pow_two(img->Width2)) &&
}
#endif
- if (destTex->IsCompressed) {
+ if (_mesa_is_format_compressed(destTex->TexFormat)) {
if (!target_can_be_compressed(ctx, target)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexSubImage%D(target)", dimensions);
}
}
- if (teximage->IsCompressed) {
+ if (_mesa_is_format_compressed(teximage->TexFormat)) {
if (!target_can_be_compressed(ctx, target)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glCopyTexSubImage%d(target)", dimensions);
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
- if (img->IsCompressed && !isProxy) {
+ if (_mesa_is_format_compressed(img->TexFormat) && !isProxy) {
/* Don't use ctx->Driver.CompressedTextureSize() since that
* may returned a padded hardware size.
*/
}
break;
case GL_TEXTURE_COMPRESSED:
- *params = (GLint) img->IsCompressed;
+ *params = (GLint) _mesa_is_format_compressed(img->TexFormat);
break;
/* GL_ARB_texture_float */
static void
compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage)
{
- texImage->IsCompressed =
- _mesa_is_format_compressed(texImage->TexFormat);
-
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
}
+/** Return texture size in bytes */
+static GLuint
+texture_size(const struct gl_texture_image *texImage)
+{
+ GLuint sz;
+
+ if (_mesa_is_format_compressed(texImage->TexFormat))
+ sz = texImage->CompressedSize;
+ else
+ sz = texImage->Width * texImage->Height * texImage->Depth *
+ _mesa_get_format_bytes(texImage->TexFormat);
+
+ return sz;
+}
+
+
+/** Return row stride in bytes */
+static GLuint
+texture_row_stride(const struct gl_texture_image *texImage)
+{
+ GLuint stride;
+
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
+ stride = _mesa_compressed_row_stride(texImage->TexFormat,
+ texImage->Width);
+ }
+ else {
+ GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
+ stride = texImage->RowStride * texelBytes;
+ }
+
+ return stride;
+}
+
+
/**
* This is the software fallback for Driver.TexImage1D()
compute_texture_size(ctx, texImage);
/* allocate memory */
- if (texImage->IsCompressed)
- sizeInBytes = texImage->CompressedSize;
- else
- sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat);
+ sizeInBytes = texture_size(texImage);
+
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
}
else {
const GLint dstRowStride = 0;
- GLboolean success;
-
- success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, 1, 1,
- format, type, pixels, packing);
+ GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, 1, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
}
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* allocate memory */
- if (texImage->IsCompressed)
- sizeInBytes = texImage->CompressedSize;
- else
- sizeInBytes = texImage->Width * texImage->Height * texelBytes;
+ sizeInBytes = texture_size(texImage);
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
return;
}
else {
- GLint dstRowStride;
- GLboolean success;
-
- if (texImage->IsCompressed) {
- dstRowStride
- = _mesa_compressed_row_stride(texImage->TexFormat, width);
- }
- else {
- dstRowStride = texImage->RowStride * texelBytes;
- }
-
- success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
-
+ GLint dstRowStride = texture_row_stride(texImage);
+ GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
}
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
/* allocate memory */
- if (texImage->IsCompressed)
- sizeInBytes = texImage->CompressedSize;
- else
- sizeInBytes = width * height * depth * texelBytes;
+ sizeInBytes = texture_size(texImage);
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
return;
}
else {
- GLint dstRowStride;
- GLboolean success;
-
- if (texImage->IsCompressed) {
- dstRowStride
- = _mesa_compressed_row_stride(texImage->TexFormat, width);
- }
- else {
- dstRowStride = texImage->RowStride * texelBytes;
- }
-
- success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
+ GLint dstRowStride = texture_row_stride(texImage);
+ GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ 0, 0, 0, /* dstX/Y/Zoffset */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, depth,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
}
{
const GLint dstRowStride = 0;
- GLboolean success;
-
- success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, 0, 0, /* offsets */
- dstRowStride,
- texImage->ImageOffsets,
- width, 1, 1,
- format, type, pixels, packing);
+ GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, 0, 0, /* offsets */
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, 1, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D");
}
return;
{
- GLint dstRowStride = 0;
- GLboolean success;
-
- if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat,
- texImage->Width);
- }
- else {
- dstRowStride = texImage->RowStride *
- _mesa_get_format_bytes(texImage->TexFormat);
- }
-
- success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, 0,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, 1,
- format, type, pixels, packing);
+ GLint dstRowStride = texture_row_stride(texImage);
+ GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, yoffset, 0,
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, 1,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
}
return;
{
- GLint dstRowStride;
- GLboolean success;
-
- if (texImage->IsCompressed) {
- dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat,
- texImage->Width);
- }
- else {
- dstRowStride = texImage->RowStride *
- _mesa_get_format_bytes(texImage->TexFormat);
- }
-
- success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, zoffset,
- dstRowStride,
- texImage->ImageOffsets,
- width, height, depth,
- format, type, pixels, packing);
+ GLint dstRowStride = texture_row_stride(texImage);
+ GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat,
+ texImage->TexFormat,
+ texImage->Data,
+ xoffset, yoffset, zoffset,
+ dstRowStride,
+ texImage->ImageOffsets,
+ width, height, depth,
+ format, type, pixels, packing);
if (!success) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D");
}
if (_mesa_is_format_compressed(texImage->TexFormat)) {
/* must be a compressed format */
texelBytes = 0;
- texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
}
else {
/* Allocate regular memory and store the image there temporarily. */
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
sizeInBytes = texImage->CompressedSize;
dstRowStride =
_mesa_compressed_row_stride(texImage->TexFormat, width);
}
/* FIXME: determine format block instead of cpp */
- if (firstImage->base.IsCompressed) {
+ if (_mesa_is_format_compressed(firstImage->base.TexFormat)) {
cpp = compressed_num_bytes(firstImage->base.TexFormat);
}
else {