summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2013-10-02 13:26:36 -0400
committerTom Stellard <thomas.stellard@amd.com>2013-10-02 13:26:36 -0400
commit96b5be2ab2c9267ea5d3cc1b741bbc5d933bfd50 (patch)
treecea3188b5a97d7eaf32d07f1a91bc2c2c31efdee
parentc41823f233e9032ca17985e009727441b28e49c7 (diff)
clover: Fix pitch calculation for buffer transfers.clover-next
-rw-r--r--src/gallium/state_trackers/clover/api/transfer.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp
index b16912072f4..5c9ff1fa885 100644
--- a/src/gallium/state_trackers/clover/api/transfer.cpp
+++ b/src/gallium/state_trackers/clover/api/transfer.cpp
@@ -36,6 +36,16 @@ namespace {
return range(p, 3);
}
+ vector_t
+ pitch(const size_t *region, vector_t v) {
+ for (unsigned i = 1; i < v.size(); ++i) {
+ if (!v[i])
+ v[i] = v[i - 1] * v[i - 1];
+ }
+
+ return v;
+ }
+
///
/// Common argument checking shared by memory transfer commands.
///
@@ -210,9 +220,9 @@ clEnqueueReadBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
q, CL_COMMAND_READ_BUFFER_RECT, deps,
soft_copy_op(q,
ptr, vector(host_origin),
- {{ 1, host_row_pitch, host_slice_pitch }},
+ pitch(region, {{ 1, host_row_pitch, host_slice_pitch }}),
&mem, vector(obj_origin),
- {{ 1, obj_row_pitch, obj_slice_pitch }},
+ pitch(region, {{ 1, obj_row_pitch, obj_slice_pitch }}),
vector(region)));
ret_object(rd_ev, hev);
@@ -245,9 +255,9 @@ clEnqueueWriteBufferRect(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
q, CL_COMMAND_WRITE_BUFFER_RECT, deps,
soft_copy_op(q,
&mem, vector(obj_origin),
- {{ 1, obj_row_pitch, obj_slice_pitch }},
+ pitch(region, {{ 1, obj_row_pitch, obj_slice_pitch }}),
ptr, vector(host_origin),
- {{ 1, host_row_pitch, host_slice_pitch }},
+ pitch(region, {{ 1, host_row_pitch, host_slice_pitch }}),
vector(region)));
ret_object(rd_ev, hev);
@@ -302,9 +312,9 @@ clEnqueueCopyBufferRect(cl_command_queue d_q, cl_mem d_src_mem,
q, CL_COMMAND_COPY_BUFFER_RECT, deps,
soft_copy_op(q,
&dst_mem, vector(dst_origin),
- {{ 1, dst_row_pitch, dst_slice_pitch }},
+ pitch(region, {{ 1, dst_row_pitch, dst_slice_pitch }}),
&src_mem, vector(src_origin),
- {{ 1, src_row_pitch, src_slice_pitch }},
+ pitch(region, {{ 1, src_row_pitch, src_slice_pitch }}),
vector(region)));
ret_object(rd_ev, hev);
@@ -333,7 +343,7 @@ clEnqueueReadImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
q, CL_COMMAND_READ_IMAGE, deps,
soft_copy_op(q,
ptr, {},
- {{ 1, row_pitch, slice_pitch }},
+ pitch(region, {{ 1, row_pitch, slice_pitch }}),
&img, vector(origin),
{{ 1, img.row_pitch(), img.slice_pitch() }},
vector(region)));
@@ -366,7 +376,7 @@ clEnqueueWriteImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking,
&img, vector(origin),
{{ 1, img.row_pitch(), img.slice_pitch() }},
ptr, {},
- {{ 1, row_pitch, slice_pitch }},
+ pitch(region, {{ 1, row_pitch, slice_pitch }}),
vector(region)));
ret_object(rd_ev, hev);
@@ -421,7 +431,7 @@ clEnqueueCopyImageToBuffer(cl_command_queue d_q,
q, CL_COMMAND_COPY_IMAGE_TO_BUFFER, deps,
soft_copy_op(q,
&dst_mem, {{ dst_offset }},
- {{ 0, 0, 0 }},
+ pitch(region, {{ 1, 0, 0 }}),
&src_img, vector(src_origin),
{{ 1, src_img.row_pitch(), src_img.slice_pitch() }},
vector(region)));
@@ -453,7 +463,7 @@ clEnqueueCopyBufferToImage(cl_command_queue d_q,
&dst_img, vector(dst_origin),
{{ 1, dst_img.row_pitch(), dst_img.slice_pitch() }},
&src_mem, {{ src_offset }},
- {{ 0, 0, 0 }},
+ pitch(region, {{ 1, 0, 0 }}),
vector(region)));
ret_object(rd_ev, hev);