[intel] Whitespace and comment changes to bring intel_mipmap_tree.c closer.

This commit is contained in:
Eric Anholt 2007-12-15 13:09:58 -08:00
parent 3fe9d5cbb7
commit 659baa3f25
2 changed files with 73 additions and 67 deletions

View file

@ -34,7 +34,8 @@
#define FILE_DEBUG_FLAG DEBUG_MIPTREE
static GLenum target_to_target( GLenum target )
static GLenum
target_to_target(GLenum target)
{
switch (target) {
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
@ -49,16 +50,17 @@ static GLenum target_to_target( GLenum target )
}
}
struct intel_mipmap_tree *intel_miptree_create( struct intel_context *intel,
GLenum target,
GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,
GLuint height0,
GLuint depth0,
GLuint cpp,
GLboolean compressed)
struct intel_mipmap_tree *
intel_miptree_create(struct intel_context *intel,
GLenum target,
GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,
GLuint height0,
GLuint depth0,
GLuint cpp,
GLboolean compressed)
{
GLboolean ok;
struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
@ -132,11 +134,12 @@ void intel_miptree_destroy( struct intel_context *intel,
void intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
GLuint level,
GLuint nr_images,
GLuint x, GLuint y,
GLuint w, GLuint h, GLuint d)
void
intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
GLuint level,
GLuint nr_images,
GLuint x, GLuint y,
GLuint w, GLuint h, GLuint d)
{
mt->level[level].width = w;
mt->level[level].height = h;
@ -163,10 +166,10 @@ void intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
GLuint level,
GLuint img,
GLuint x, GLuint y)
void
intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
GLuint level, GLuint img,
GLuint x, GLuint y)
{
if (INTEL_DEBUG & DEBUG_TEXTURE)
_mesa_printf("%s level %d img %d pos %d,%d\n", __FUNCTION__, level, img, x, y);
@ -185,22 +188,21 @@ void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
*
* These functions present that view to mesa:
*/
const GLuint *intel_miptree_depth_offsets(struct intel_mipmap_tree *mt,
GLuint level)
const GLuint *
intel_miptree_depth_offsets(struct intel_mipmap_tree *mt, GLuint level)
{
static const GLuint zero = 0;
if (mt->target != GL_TEXTURE_3D ||
mt->level[level].nr_images == 1)
if (mt->target != GL_TEXTURE_3D || mt->level[level].nr_images == 1)
return &zero;
else
return mt->level[level].image_offset;
}
GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt,
GLuint face,
GLuint level)
GLuint
intel_miptree_image_offset(struct intel_mipmap_tree *mt,
GLuint face, GLuint level)
{
if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
return (mt->level[level].level_offset +
@ -216,13 +218,14 @@ GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt,
extern GLuint intel_compressed_alignment(GLenum);
/* Upload data for a particular image.
*/
GLboolean intel_miptree_image_data(struct intel_context *intel,
struct intel_mipmap_tree *dst,
GLuint face,
GLuint level,
const void *src,
GLuint src_row_pitch,
GLuint src_image_pitch)
GLboolean
intel_miptree_image_data(struct intel_context *intel,
struct intel_mipmap_tree *dst,
GLuint face,
GLuint level,
const void *src,
GLuint src_row_pitch,
GLuint src_image_pitch)
{
GLuint depth = dst->level[level].depth;
GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
@ -244,14 +247,12 @@ GLboolean intel_miptree_image_data(struct intel_context *intel,
for (i = 0; i < depth; i++) {
intel_region_data(intel,
dst->region,
dst_offset + dst_depth_offset[i],
0,
0,
dst_offset + dst_depth_offset[i], /* dst_offset */
0, 0, /* dstx, dsty */
src,
src_row_pitch,
0, 0, /* source x,y */
width,
height);
0, 0, /* source x, y */
width, height);
src += src_image_pitch;
}
return GL_TRUE;

View file

@ -50,13 +50,15 @@ target_to_target(GLenum target)
struct intel_mipmap_tree *
intel_miptree_create(struct intel_context *intel,
GLenum target,
GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,
GLuint height0,
GLuint depth0, GLuint cpp, GLuint compress_byte)
GLenum target,
GLenum internal_format,
GLuint first_level,
GLuint last_level,
GLuint width0,
GLuint height0,
GLuint depth0,
GLuint cpp,
GLuint compress_byte)
{
GLboolean ok;
struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
@ -207,11 +209,11 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
void
intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
GLuint level,
GLuint nr_images,
GLuint x, GLuint y, GLuint w, GLuint h, GLuint d)
GLuint level,
GLuint nr_images,
GLuint x, GLuint y,
GLuint w, GLuint h, GLuint d)
{
mt->level[level].width = w;
mt->level[level].height = h;
mt->level[level].depth = d;
@ -238,7 +240,8 @@ intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
void
intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
GLuint level, GLuint img, GLuint x, GLuint y)
GLuint level, GLuint img,
GLuint x, GLuint y)
{
if (img == 0 && level == 0)
assert(x == 0 && y == 0);
@ -271,12 +274,12 @@ intel_miptree_depth_offsets(struct intel_mipmap_tree *mt, GLuint level)
GLuint
intel_miptree_image_offset(struct intel_mipmap_tree * mt,
GLuint face, GLuint level)
intel_miptree_image_offset(struct intel_mipmap_tree *mt,
GLuint face, GLuint level)
{
if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
return (mt->level[level].level_offset +
mt->level[level].image_offset[face] * mt->cpp);
mt->level[level].image_offset[face] * mt->cpp);
else
return mt->level[level].level_offset;
}
@ -323,11 +326,12 @@ intel_miptree_image_unmap(struct intel_context *intel,
*/
void
intel_miptree_image_data(struct intel_context *intel,
struct intel_mipmap_tree *dst,
GLuint face,
GLuint level,
void *src,
GLuint src_row_pitch, GLuint src_image_pitch)
struct intel_mipmap_tree *dst,
GLuint face,
GLuint level,
void *src,
GLuint src_row_pitch,
GLuint src_image_pitch)
{
GLuint depth = dst->level[level].depth;
GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
@ -340,13 +344,14 @@ intel_miptree_image_data(struct intel_context *intel,
height = dst->level[level].height;
if(dst->compressed)
height /= 4;
intel_region_data(intel, dst->region,
dst_offset + dst_depth_offset[i], /* dst_offset */
0, 0, /* dstx, dsty */
src,
src_row_pitch,
0, 0, /* source x, y */
dst->level[level].width, height); /* width, height */
intel_region_data(intel,
dst->region,
dst_offset + dst_depth_offset[i], /* dst_offset */
0, 0, /* dstx, dsty */
src,
src_row_pitch,
0, 0, /* source x, y */
dst->level[level].width, height); /* width, height */
src += src_image_pitch * dst->cpp;
}