st/mesa: get rid of compressed_num_bytes() code

This commit is contained in:
Brian Paul
2009-11-19 14:35:38 -07:00
parent 92863109af
commit dc41d62250
+4 -36
View File
@@ -93,32 +93,6 @@ gl_target_to_pipe(GLenum target)
}
/**
* Return nominal bytes per texel for a compressed format, 0 for non-compressed
* format.
*/
static GLuint
compressed_num_bytes(gl_format format)
{
switch (format) {
#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
#endif
#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
return 2;
case MESA_FORMAT_RGBA_DXT3:
case MESA_FORMAT_RGBA_DXT5:
return 4;
#endif
default:
return 0;
}
}
/** called via ctx->Driver.NewTextureImage() */
static struct gl_texture_image *
st_NewTextureImage(GLcontext * ctx)
@@ -1743,7 +1717,7 @@ st_finalize_texture(GLcontext *ctx,
{
struct st_texture_object *stObj = st_texture_object(tObj);
const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
GLuint cpp, face;
GLuint blockSize, face;
struct st_texture_image *firstImage;
*needFlush = GL_FALSE;
@@ -1775,13 +1749,8 @@ st_finalize_texture(GLcontext *ctx,
pipe_texture_reference(&stObj->pt, firstImage->pt);
}
/* FIXME: determine format block instead of cpp */
if (_mesa_is_format_compressed(firstImage->base.TexFormat)) {
cpp = compressed_num_bytes(firstImage->base.TexFormat);
}
else {
cpp = _mesa_get_format_bytes(firstImage->base.TexFormat);
}
/* bytes per pixel block (blocks are usually 1x1) */
blockSize = _mesa_get_format_bytes(firstImage->base.TexFormat);
/* If we already have a gallium texture, check that it matches the texture
* object's format, target, size, num_levels, etc.
@@ -1795,8 +1764,7 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt->width[0] != firstImage->base.Width2 ||
stObj->pt->height[0] != firstImage->base.Height2 ||
stObj->pt->depth[0] != firstImage->base.Depth2 ||
/* Nominal bytes per pixel: */
stObj->pt->block.size / stObj->pt->block.width != cpp)
stObj->pt->block.size != blockSize)
{
pipe_texture_reference(&stObj->pt, NULL);
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;