[virglrenderer-devel] [PATCH 2/3] vrend: a layer be should block_width * block_height * depth
Gurchetan Singh
gurchetansingh at chromium.org
Tue Mar 6 04:54:39 UTC 2018
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).
---
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;
}
--
2.16.2.395.g2e18187dfd-goog
More information about the virglrenderer-devel
mailing list