From d49a5a4de1d189c5b3834600239ddd62696f3e5a Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Mon, 5 Mar 2018 20:54:39 -0800 Subject: [PATCH] vrend: a layer be should block_width * block_height * depth The previous calculation (block_stride * block_height * depth) led to data corruption since we don't take stride into account when allocating the temporary buffer. With this fix, dEQP-GLES3.functional.texture.specification.basic_texsubimage3d.rgba32f_3d doesn't crash the virtual machine (though the test fails). Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 7c7515f..4eda713 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -4682,7 +4682,7 @@ static void read_transfer_data(struct pipe_resource *res, if (invert) { for (d = 0; d < box->depth; d++) { for (h = bh - 1; h >= 0; h--) { - void *ptr = data + (h * bwx) + d * (bh * src_stride); + void *ptr = data + (h * bwx) + d * (bh * bwx); vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx); myoffset += src_stride; } @@ -4690,7 +4690,7 @@ static void read_transfer_data(struct pipe_resource *res, } else { for (d = 0; d < box->depth; d++) { for (h = 0; h < bh; h++) { - void *ptr = data + (h * bwx) + d * (bh * src_stride); + void *ptr = data + (h * bwx) + d * (bh * bwx); vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx); myoffset += src_stride; } @@ -4724,7 +4724,7 @@ static void write_transfer_data(struct pipe_resource *res, } else if (invert) { for (d = 0; d < box->depth; d++) { for (h = bh - 1; h >= 0; h--) { - void *ptr = data + (h * bwx) + d * (bh * stride); + void *ptr = data + (h * bwx) + d * (bh * bwx); vrend_write_to_iovec(iov, num_iovs, myoffset, ptr, bwx); myoffset += stride; } @@ -4732,7 +4732,7 @@ static void write_transfer_data(struct pipe_resource *res, } else { for (d = 0; d < box->depth; d++) { for (h = 0; h < bh; h++) { - void *ptr = data + (h * bwx) + d * (bh * stride); + void *ptr = data + (h * bwx) + d * (bh * bwx); vrend_write_to_iovec(iov, num_iovs, myoffset, ptr, bwx); myoffset += stride; }