summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_resource.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-06-19 19:41:25 -0700
committerEric Anholt <[email protected]>2015-06-20 00:16:32 -0700
commitbb107110a4d97191841985076dd9f2fbd0937dfc (patch)
tree5c27e3cbb9d1a5b203406208fc1db17465dd2457 /src/gallium/drivers/vc4/vc4_resource.c
parent028590cbc758e877b963ba430f0a0cb49e882a6b (diff)
vc4: Fix write-only texsubimage when we had to align.
We need to make sure that when we store the aligned box, we've got initialized contents in the border. We could potentially just load the border area, but for now let's get text rendering working in X (and fix the GL_TEXTURE_2D errors in piglit's texsubimage test and gl-2.1-pbo/test_tex_image)
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_resource.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_resource.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index 14b135e2f45..cab76406055 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -162,6 +162,8 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
/* We need to align the box to utile boundaries, since that's
* what load/store operate on.
*/
+ uint32_t orig_width = ptrans->box.width;
+ uint32_t orig_height = ptrans->box.height;
uint32_t box_start_x = ptrans->box.x & (utile_w - 1);
uint32_t box_start_y = ptrans->box.y & (utile_h - 1);
ptrans->box.width += box_start_x;
@@ -175,7 +177,9 @@ vc4_resource_transfer_map(struct pipe_context *pctx,
ptrans->layer_stride = ptrans->stride;
trans->map = malloc(ptrans->stride * ptrans->box.height);
- if (usage & PIPE_TRANSFER_READ) {
+ if (usage & PIPE_TRANSFER_READ ||
+ ptrans->box.width != orig_width ||
+ ptrans->box.height != orig_height) {
vc4_load_tiled_image(trans->map, ptrans->stride,
buf + slice->offset +
box->z * rsc->cube_map_stride,