aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_tex_validate.c
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2007-08-10 15:14:12 +0800
committerXiang, Haihao <[email protected]>2007-08-10 15:14:12 +0800
commit2cafd749b8e4fa44863c176389f7201c7f74eca9 (patch)
tree9cba8dc795790a9517ac5ef964ab0b949a3e48b4 /src/mesa/drivers/dri/i965/intel_tex_validate.c
parent48c37a29fa527aabcec76731de0bee508869e835 (diff)
i965: set mt->cpp differently with compressed texture
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_tex_validate.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex_validate.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c b/src/mesa/drivers/dri/i965/intel_tex_validate.c
index 44ee94614d5..8c05e7cdabc 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c
@@ -122,6 +122,29 @@ static void intel_texture_invalidate_cb( struct intel_context *intel,
intel_texture_invalidate( (struct intel_texture_object *) ptr );
}
+#include "texformat.h"
+static GLuint intel_compressed_num_bytes(GLenum mesaFormat)
+{
+ GLuint bytes = 0;
+
+ switch (mesaFormat) {
+ case MESA_FORMAT_RGB_FXT1:
+ case MESA_FORMAT_RGBA_FXT1:
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
+ bytes = 2;
+ break;
+
+ case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_RGBA_DXT5:
+ bytes = 4;
+
+ default:
+ break;
+ }
+
+ return bytes;
+}
/*
*/
@@ -132,7 +155,8 @@ GLuint intel_finalize_mipmap_tree( struct intel_context *intel,
GLuint face, i;
GLuint nr_faces = 0;
struct gl_texture_image *firstImage;
-
+ GLuint cpp = 0;
+
if( tObj == intel->frame_buffer_texobj )
return GL_FALSE;
@@ -165,6 +189,12 @@ GLuint intel_finalize_mipmap_tree( struct intel_context *intel,
+ if (firstImage->IsCompressed) {
+ cpp = intel_compressed_num_bytes(firstImage->TexFormat->MesaFormat);
+ } else {
+ cpp = firstImage->TexFormat->TexelBytes;
+ }
+
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
*/
@@ -176,7 +206,7 @@ GLuint intel_finalize_mipmap_tree( struct intel_context *intel,
intelObj->mt->width0 != firstImage->Width ||
intelObj->mt->height0 != firstImage->Height ||
intelObj->mt->depth0 != firstImage->Depth ||
- intelObj->mt->cpp != firstImage->TexFormat->TexelBytes ||
+ intelObj->mt->cpp != cpp ||
intelObj->mt->compressed != firstImage->IsCompressed))
{
intel_miptree_destroy(intel, intelObj->mt);
@@ -199,7 +229,7 @@ GLuint intel_finalize_mipmap_tree( struct intel_context *intel,
firstImage->Width,
firstImage->Height,
firstImage->Depth,
- firstImage->TexFormat->TexelBytes,
+ cpp,
firstImage->IsCompressed);
/* Tell the buffer manager that we will manage the backing