summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2009-12-04 00:35:14 +0100
committerRoland Scheidegger <sroland@vmware.com>2009-12-04 00:35:14 +0100
commit9c6a9363ef96c00dd0ad63e340b32479e43fea45 (patch)
treec1752752623301c7bc63d25173c396794b74922d /src/gallium/drivers/llvmpipe
parentcc8a537c57a62a196106b592e510e4c93bd1826e (diff)
parent94b5c28a98850f42fbcdab9ceda1450279e1e6fd (diff)
Merge branch 'gallium-noblocks'
Conflicts: src/gallium/state_trackers/xorg/xorg_exa.c
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_cache.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c48
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tile_cache.c6
4 files changed, 28 insertions, 30 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index ffcbc9a379..b4aabd4d7c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -166,7 +166,7 @@ shade_quads(struct llvmpipe_context *llvmpipe,
assert((y % 2) == 0);
depth = llvmpipe->zsbuf_map +
y*llvmpipe->zsbuf_transfer->stride +
- 2*x*llvmpipe->zsbuf_transfer->block.size;
+ 2*x*pf_get_blocksize(llvmpipe->zsbuf_transfer->texture->format);
}
else
depth = NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
index c7c4143bc6..5dbc597d2c 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
@@ -291,7 +291,7 @@ lp_find_cached_tex_tile(struct llvmpipe_tex_tile_cache *tc,
assert(0);
}
- util_format_read_4ub(tc->tex_trans->format,
+ util_format_read_4ub(tc->tex_trans->texture->format,
(uint8_t *)tile->color, sizeof tile->color[0],
tc->tex_trans_map, tc->tex_trans->stride,
x, y, w, h);
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 65d62fd072..f099f903bd 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -48,7 +48,6 @@
/* Simple, maximally packed layout.
*/
-
/* Conventional allocation path for non-display textures:
*/
static boolean
@@ -63,20 +62,15 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
unsigned buffer_size = 0;
- pf_get_block(lpt->base.format, &lpt->base.block);
-
for (level = 0; level <= pt->last_level; level++) {
unsigned nblocksx, nblocksy;
- pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
- pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
-
/* Allocate storage for whole quads. This is particularly important
* for depth surfaces, which are currently stored in a swizzled format. */
- nblocksx = pf_get_nblocksx(&pt->block, align(width, 2));
- nblocksy = pf_get_nblocksy(&pt->block, align(height, 2));
+ nblocksx = pf_get_nblocksx(pt->format, align(width, 2));
+ nblocksy = pf_get_nblocksy(pt->format, align(height, 2));
- lpt->stride[level] = align(nblocksx*pt->block.size, 16);
+ lpt->stride[level] = align(nblocksx * pf_get_blocksize(pt->format), 16);
lpt->level_offset[level] = buffer_size;
@@ -100,10 +94,6 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
{
struct llvmpipe_winsys *winsys = screen->winsys;
- pf_get_block(lpt->base.format, &lpt->base.block);
- lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
- lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
-
lpt->dt = winsys->displaytarget_create(winsys,
lpt->base.format,
lpt->base.width0,
@@ -180,8 +170,6 @@ llvmpipe_texture_blanket(struct pipe_screen * screen,
lpt->base = *base;
pipe_reference_init(&lpt->base.reference, 1);
lpt->base.screen = screen;
- lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0);
- lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0);
lpt->stride[0] = stride[0];
pipe_buffer_reference(&lpt->buffer, buffer);
@@ -255,11 +243,17 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
ps->level = level;
ps->zslice = zslice;
+ /* XXX shouldn't that rather be
+ tex_height = align(ps->height, 2);
+ to account for alignment done in llvmpipe_texture_layout ?
+ */
if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset += face * pt->nblocksy[level] * lpt->stride[level];
+ unsigned tex_height = ps->height;
+ ps->offset += face * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
}
else if (pt->target == PIPE_TEXTURE_3D) {
- ps->offset += zslice * pt->nblocksy[level] * lpt->stride[level];
+ unsigned tex_height = ps->height;
+ ps->offset += zslice * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
}
else {
assert(face == 0);
@@ -300,14 +294,10 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
if (lpt) {
struct pipe_transfer *pt = &lpt->base;
pipe_texture_reference(&pt->texture, texture);
- pt->format = texture->format;
- pt->block = texture->block;
pt->x = x;
pt->y = y;
pt->width = w;
pt->height = h;
- pt->nblocksx = texture->nblocksx[level];
- pt->nblocksy = texture->nblocksy[level];
pt->stride = lptex->stride[level];
pt->usage = usage;
pt->face = face;
@@ -316,11 +306,17 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
lpt->offset = lptex->level_offset[level];
+ /* XXX shouldn't that rather be
+ tex_height = align(u_minify(texture->height0, level), 2)
+ to account for alignment done in llvmpipe_texture_layout ?
+ */
if (texture->target == PIPE_TEXTURE_CUBE) {
- lpt->offset += face * pt->nblocksy * pt->stride;
+ unsigned tex_height = u_minify(texture->height0, level);
+ lpt->offset += face * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
}
else if (texture->target == PIPE_TEXTURE_3D) {
- lpt->offset += zslice * pt->nblocksy * pt->stride;
+ unsigned tex_height = u_minify(texture->height0, level);
+ lpt->offset += zslice * pf_get_nblocksy(texture->format, tex_height) * pt->stride;
}
else {
assert(face == 0);
@@ -352,9 +348,11 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
ubyte *map, *xfer_map;
struct llvmpipe_texture *lpt;
+ enum pipe_format format;
assert(transfer->texture);
lpt = llvmpipe_texture(transfer->texture);
+ format = lpt->base.format;
if(lpt->dt) {
struct llvmpipe_winsys *winsys = screen->winsys;
@@ -379,8 +377,8 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
}
xfer_map = map + llvmpipe_transfer(transfer)->offset +
- transfer->y / transfer->block.height * transfer->stride +
- transfer->x / transfer->block.width * transfer->block.size;
+ transfer->y / pf_get_blockheight(format) * transfer->stride +
+ transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format);
/*printf("map = %p xfer map = %p\n", map, xfer_map);*/
return xfer_map;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c
index ec3e002d62..50891c4227 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c
@@ -252,13 +252,13 @@ lp_flush_tile_cache(struct llvmpipe_tile_cache *tc)
case LP_TILE_STATUS_CLEAR:
/* Actually clear the tiles which were flagged as being in a
* clear state. */
- util_fill_rect(tc->transfer_map, &pt->block, pt->stride,
+ util_fill_rect(tc->transfer_map, pt->texture->format, pt->stride,
x, y, w, h,
tc->clear_val);
break;
case LP_TILE_STATUS_DEFINED:
- lp_tile_write_4ub(pt->format,
+ lp_tile_write_4ub(pt->texture->format,
tile->color,
tc->transfer_map, pt->stride,
x, y, w, h);
@@ -306,7 +306,7 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc,
y &= ~(TILE_SIZE - 1);
if (!pipe_clip_tile(x, y, &w, &h, tc->transfer))
- lp_tile_read_4ub(pt->format,
+ lp_tile_read_4ub(pt->texture->format,
tile->color,
tc->transfer_map, tc->transfer->stride,
x, y, w, h);