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 <airlied@redhat.com>
macos/master
Gurchetan Singh 7 years ago committed by Dave Airlie
parent 30403b8241
commit d49a5a4de1
  1. 8
      src/vrend_renderer.c

@ -4682,7 +4682,7 @@ static void read_transfer_data(struct pipe_resource *res,
if (invert) { if (invert) {
for (d = 0; d < box->depth; d++) { for (d = 0; d < box->depth; d++) {
for (h = bh - 1; h >= 0; h--) { 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); vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx);
myoffset += src_stride; myoffset += src_stride;
} }
@ -4690,7 +4690,7 @@ static void read_transfer_data(struct pipe_resource *res,
} else { } else {
for (d = 0; d < box->depth; d++) { for (d = 0; d < box->depth; d++) {
for (h = 0; h < bh; h++) { 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); vrend_read_from_iovec(iov, num_iovs, myoffset, ptr, bwx);
myoffset += src_stride; myoffset += src_stride;
} }
@ -4724,7 +4724,7 @@ static void write_transfer_data(struct pipe_resource *res,
} else if (invert) { } else if (invert) {
for (d = 0; d < box->depth; d++) { for (d = 0; d < box->depth; d++) {
for (h = bh - 1; h >= 0; h--) { 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); vrend_write_to_iovec(iov, num_iovs, myoffset, ptr, bwx);
myoffset += stride; myoffset += stride;
} }
@ -4732,7 +4732,7 @@ static void write_transfer_data(struct pipe_resource *res,
} else { } else {
for (d = 0; d < box->depth; d++) { for (d = 0; d < box->depth; d++) {
for (h = 0; h < bh; h++) { 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); vrend_write_to_iovec(iov, num_iovs, myoffset, ptr, bwx);
myoffset += stride; myoffset += stride;
} }

Loading…
Cancel
Save