summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_texture.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-10-13 11:03:18 +1000
committerDave Airlie <[email protected]>2010-10-13 15:55:48 +1000
commite3b089126c63c7178d725fbe245ca09d3f9edba1 (patch)
tree507edb38fd04c96b8b8652c5bd891f506903269d /src/gallium/drivers/r600/r600_texture.c
parentfa797f12b3e1e82020eb7bc8fd0181baa7515efe (diff)
r600g: remove bpt and start using pitch_in_bytes/pixels.
this mirror changes in r300g, bpt is kinda useless when it comes to some of the non-simple texture formats.
Diffstat (limited to 'src/gallium/drivers/r600/r600_texture.c')
-rw-r--r--src/gallium/drivers/r600/r600_texture.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 5bdfd499397..d1339f69e73 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -125,6 +125,14 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen,
return util_format_get_nblocksy(ptex->format, height);
}
+/* Get a width in pixels from a stride in bytes. */
+static unsigned pitch_to_width(enum pipe_format format,
+ unsigned pitch_in_bytes)
+{
+ return (pitch_in_bytes / util_format_get_blocksize(format)) *
+ util_format_get_blockwidth(format);
+}
+
static void r600_setup_miptree(struct pipe_screen *screen,
struct r600_resource_texture *rtex)
{
@@ -134,7 +142,6 @@ static void r600_setup_miptree(struct pipe_screen *screen,
unsigned long pitch, size, layer_size, i, offset;
unsigned nblocksy;
- rtex->bpt = util_format_get_blocksize(ptex->format);
for (i = 0, offset = 0; i <= ptex->last_level; i++) {
pitch = r600_texture_get_stride(screen, rtex, i);
nblocksy = r600_texture_get_nblocksy(screen, rtex, i);
@@ -152,6 +159,7 @@ static void r600_setup_miptree(struct pipe_screen *screen,
rtex->offset[i] = offset;
rtex->layer_size[i] = layer_size;
rtex->pitch_in_bytes[i] = pitch;
+ rtex->pitch_in_pixels[i] = pitch_to_width(ptex->format, pitch);
offset += size;
}
rtex->size = offset;