summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-04-19 17:05:05 -0600
committerBrian Paul <brianp@vmware.com>2010-04-19 17:07:25 -0600
commitf4071e55dba8c0f45f3a7f59135b34e5b81fdab8 (patch)
tree09145390a1500ea50a33ed8e7a1bdaea67d47278 /src/gallium/drivers/llvmpipe/lp_texture.c
parent2cad62475b8263472f6fbd541b5b8ec2a1d40e62 (diff)
llvmpipe: get 3D texture image stride from an array rather than computing it
This fixes broken 3D texture indexing when the height of the 3D texture was less than 64 (the tile size). It's simpler to pass this as an array (as we do with the row stride) than to compute it on the fly.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 002669adaa..45739e94cb 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -120,9 +120,11 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
*/
nblocksx = util_format_get_nblocksx(pt->format, align(width, TILE_SIZE));
- lpr->stride[level] =
+ lpr->row_stride[level] =
align(nblocksx * util_format_get_blocksize(pt->format), 16);
+ lpr->img_stride[level] = lpr->row_stride[level] * align(height, TILE_SIZE);
+
lpr->tiles_per_row[level] = width_t;
lpr->tiles_per_image[level] = width_t * height_t;
lpr->num_slices_faces[level] = num_slices;
@@ -155,6 +157,7 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
lpr->tiles_per_row[0] = width_t;
lpr->tiles_per_image[0] = width_t * height_t;
lpr->num_slices_faces[0] = 1;
+ lpr->img_stride[0] = 0;
lpr->layout[0] = alloc_layout_array(1, width, height);
@@ -163,7 +166,7 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
lpr->base.format,
width, height,
16,
- &lpr->stride[0] );
+ &lpr->row_stride[0] );
return lpr->dt != NULL;
}
@@ -409,7 +412,7 @@ llvmpipe_resource_from_handle(struct pipe_screen *screen,
lpr->dt = winsys->displaytarget_from_handle(winsys,
template,
whandle,
- &lpr->stride[0]);
+ &lpr->row_stride[0]);
if (!lpr->dt)
goto fail;
@@ -496,7 +499,7 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
pipe_resource_reference(&pt->resource, resource);
pt->box = *box;
pt->sr = sr;
- pt->stride = lprex->stride[sr.level];
+ pt->stride = lprex->row_stride[sr.level];
pt->usage = usage;
return pt;
@@ -684,7 +687,7 @@ tex_image_face_size(const struct llvmpipe_resource *lpr, unsigned level,
const enum pipe_format format = lpr->base.format;
const unsigned nblocksy =
util_format_get_nblocksy(format, align(height, TILE_SIZE));
- const unsigned buffer_size = nblocksy * lpr->stride[level];
+ const unsigned buffer_size = nblocksy * lpr->row_stride[level];
return buffer_size;
}
}
@@ -954,14 +957,14 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr,
x * TILE_SIZE, y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
else {
lp_tiled_to_linear(other_data, target_data,
x * TILE_SIZE, y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
}
@@ -1045,7 +1048,7 @@ llvmpipe_get_texture_tile_linear(struct llvmpipe_resource *lpr,
if (convert) {
lp_tiled_to_linear(tiled_img->data, linear_img->data,
x, y, TILE_SIZE, TILE_SIZE, lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
if (new_layout != cur_layout)
@@ -1094,7 +1097,7 @@ llvmpipe_get_texture_tile(struct llvmpipe_resource *lpr,
if (convert) {
lp_linear_to_tiled(linear_img->data, tiled_img->data,
x, y, TILE_SIZE, TILE_SIZE, lpr->base.format,
- lpr->stride[level]);
+ lpr->row_stride[level]);
}
if (new_layout != cur_layout)