radeon: add tile size getter

This commit is contained in:
Maciej Cencora 2010-01-16 23:11:10 +01:00
parent 88a99bb305
commit 65faa27aa6
2 changed files with 41 additions and 1 deletions

View file

@ -243,4 +243,42 @@ void tile_image(const void * src, unsigned src_pitch,
assert(0);
break;
}
}
}
void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height)
{
switch (_mesa_get_format_bytes(format))
{
case 16:
*block_width = 1;
*block_height = 1;
break;
case 8:
*block_width = 2;
*block_height = 2;
break;
case 4:
*block_width = 4;
*block_height = 2;
break;
case 2:
if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
{
*block_width = 4;
*block_height = 4;
}
else
{
*block_width = 8;
*block_height = 2;
}
break;
case 1:
*block_width = 8;
*block_height = 4;
break;
default:
assert(0);
break;
}
}

View file

@ -30,3 +30,5 @@
void tile_image(const void * src, unsigned src_pitch,
void *dst, unsigned dst_pitch,
gl_format format, unsigned width, unsigned height);
void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height);