summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-01 16:29:44 -0600
committerBrian Paul <[email protected]>2009-10-01 16:29:44 -0600
commitb6bdafdf2cf1110b4a5ca7cf9e1c3dcb124b800f (patch)
treeaf668a98fe8ec899b8da9c25533f299c5c3f90d1 /src/mesa/drivers/dri
parent040fd7ed44c21a1faaa6475888e9365e8f0de42b (diff)
mesa: remove gl_texture_image::IsCompressed field
Use _mesa_is_format_compressed() instead.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c4
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tex.c13
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c5
10 files changed, 27 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 6bb7481ae44..a11869e7e88 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -293,6 +293,8 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
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 ||
@@ -302,10 +304,10 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
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;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index bbbeac8f7f1..29cca451483 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -125,7 +125,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
}
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);
@@ -339,7 +339,6 @@ intelTexImage(GLcontext * ctx,
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,
@@ -405,7 +404,7 @@ intelTexImage(GLcontext * ctx,
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);
}
@@ -494,7 +493,7 @@ intelTexImage(GLcontext * ctx,
}
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);
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index bba1b53009d..cc329dae58b 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -85,7 +85,7 @@ intelTexSubimage(GLcontext * ctx,
&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);
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 0296c92523d..d5b562f5e57 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -165,7 +165,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
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;
}
@@ -190,7 +190,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
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);
}
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index daca318684d..1a6fa9f548f 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -1504,7 +1504,7 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t)
| ((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);
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index b602bfb4b0f..5429525587d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -314,16 +314,17 @@ static void calculate_first_last_level(struct gl_texture_object *tObj,
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;
@@ -354,7 +355,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu
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 &&
@@ -374,7 +375,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu
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;
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 1064602504f..5d22a118595 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -81,8 +81,10 @@ struct tx_table {
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),
@@ -1083,7 +1085,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int
| ((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);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 0378b3c9fcd..442116a2dd1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -546,13 +546,11 @@ static void radeon_teximage(
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);
@@ -590,7 +588,7 @@ static void radeon_teximage(
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);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
index 427d315a01d..8b68137eedf 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c
@@ -191,7 +191,6 @@ tdfxGenerateMipmap(GLcontext *ctx, GLenum target,
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
- assert(!texImage->IsCompressed);
mml = TDFX_TEXIMAGE_DATA(texImage);
@@ -1233,7 +1232,7 @@ adjust2DRatio (GLcontext *ctx,
GLvoid *tempImage;
GLuint dstImageOffsets = 0;
- if (!texImage->IsCompressed) {
+ if (!_mesa_is_format_compressed(texImage->TexFormat)) {
GLubyte *destAddr;
tempImage = MALLOC(width * height * texelBytes);
@@ -1366,7 +1365,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
* 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:
@@ -1393,7 +1392,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
}
if (texNapalm) {
texImage->InternalFormat = internalFormat = texNapalm;
- texImage->IsCompressed = GL_TRUE;
+ _mesa_is_format_compressed(texImage->TexFormat) = GL_TRUE;
}
}
#endif
@@ -1409,7 +1408,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
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,
@@ -1492,7 +1491,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
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;
@@ -1594,8 +1593,6 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
return;
}
- assert(texImage->IsCompressed);
-
ti = TDFX_TEXTURE_DATA(texObj);
if (!ti) {
texObj->DriverData = fxAllocTexObjData(fxMesa);
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index b6be06d1ee2..a4cf5466fdb 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -696,7 +696,6 @@ static void viaTexImage(GLcontext *ctx,
if (texelBytes == 0) {
/* compressed format */
- texImage->IsCompressed = GL_TRUE;
texImage->CompressedSize =
ctx->Driver.CompressedTextureSize(ctx, texImage->Width,
texImage->Height, texImage->Depth,
@@ -713,7 +712,7 @@ static void viaTexImage(GLcontext *ctx,
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;
@@ -793,7 +792,7 @@ static void viaTexImage(GLcontext *ctx,
GLint dstRowStride;
GLboolean success;
- if (texImage->IsCompressed) {
+ if (_mesa_is_format_compressed(texImage->TexFormat)) {
dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width);
}
else {