diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mesa/drivers/dri/i965/brw_tex_layout.c | 61 | 
1 files changed, 30 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 51a617fcb4..be8ce546a9 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -28,7 +28,6 @@    * Authors:    *   Keith Whitwell <keith@tungstengraphics.com>    */ -          /* Code to layout images in a mipmap tree for i965.   */ @@ -40,14 +39,14 @@  #define FILE_DEBUG_FLAG DEBUG_MIPTREE -GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_tree *mt ) +GLboolean brw_miptree_layout(struct intel_context *intel, +			     struct intel_mipmap_tree *mt)  { -   /* XXX: these vary depending on image format:  -    */ -/*    GLint align_w = 4; */ +   /* XXX: these vary depending on image format: */ +   /* GLint align_w = 4; */     switch (mt->target) { -   case GL_TEXTURE_CUBE_MAP:  +   case GL_TEXTURE_CUBE_MAP:     case GL_TEXTURE_3D: {        GLuint width  = mt->width0;        GLuint height = mt->height0; @@ -59,7 +58,7 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t        GLuint align_w = 4;        mt->total_height = 0; -       +        if (mt->compressed) {            align_w = intel_compressed_alignment(mt->internal_format);            mt->pitch = ALIGN(width, align_w); @@ -72,12 +71,12 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t        pack_x_pitch = mt->pitch;        pack_x_nr = 1; -      for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { +      for (level = mt->first_level ; level <= mt->last_level ; level++) {  	 GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6;  	 GLint x = 0;  	 GLint y = 0;  	 GLint q, j; -	     +  	 intel_miptree_set_level_info(mt, level, nr_images,  				      0, mt->total_height,  				      width, height, depth); @@ -89,7 +88,7 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t  	    }  	    x = 0; -	    y += pack_y_pitch;	     +	    y += pack_y_pitch;  	 } @@ -98,25 +97,25 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t  	 height = minify(height);  	 depth  = minify(depth); -    if (mt->compressed) { -        pack_y_pitch = (height + 3) / 4; -         -        if (pack_x_pitch > ALIGN(width, align_w)) { -            pack_x_pitch = ALIGN(width, align_w); -            pack_x_nr <<= 1; -        } -    } else { -        if (pack_x_pitch > 4) { -            pack_x_pitch >>= 1; -            pack_x_nr <<= 1; -            assert(pack_x_pitch * pack_x_nr <= mt->pitch); -        } +	 if (mt->compressed) { +	    pack_y_pitch = (height + 3) / 4; + +	    if (pack_x_pitch > ALIGN(width, align_w)) { +	       pack_x_pitch = ALIGN(width, align_w); +	       pack_x_nr <<= 1; +	    } +	 } else { +	    if (pack_x_pitch > 4) { +	       pack_x_pitch >>= 1; +	       pack_x_nr <<= 1; +	       assert(pack_x_pitch * pack_x_nr <= mt->pitch); +	    } -        if (pack_y_pitch > 2) { -            pack_y_pitch >>= 1; -            pack_y_pitch = ALIGN(pack_y_pitch, align_h); -        } -    } +	    if (pack_y_pitch > 2) { +	       pack_y_pitch >>= 1; +	       pack_y_pitch = ALIGN(pack_y_pitch, align_h); +	    } +	 }        }        break; @@ -126,12 +125,12 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t        i945_miptree_layout_2d(intel, mt);        break;     } -   DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,  -		mt->pitch,  +   DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, +		mt->pitch,  		mt->total_height,  		mt->cpp,  		mt->pitch * mt->total_height * mt->cpp ); -		 +     return GL_TRUE;  }  | 
