clEnqueueReadImage(cl_command_queue command_queue,
cl_mem mem,
cl_bool blocking_read,
- const size_t * origin,
- const size_t * region,
+ const size_t * porigin,
+ const size_t * pregion,
size_t row_pitch,
size_t slice_pitch,
void * ptr,
CHECK_QUEUE(command_queue);
CHECK_IMAGE(mem, image);
+ FIXUP_IMAGE_REGION(image, pregion, region);
+ FIXUP_IMAGE_ORIGIN(image, porigin, origin);
if (command_queue->ctx != mem->ctx) {
err = CL_INVALID_CONTEXT;
goto error;
clEnqueueWriteImage(cl_command_queue command_queue,
cl_mem mem,
cl_bool blocking_write,
- const size_t * origin,
- const size_t * region,
+ const size_t * porigin,
+ const size_t * pregion,
size_t row_pitch,
size_t slice_pitch,
const void * ptr,
CHECK_QUEUE(command_queue);
CHECK_IMAGE(mem, image);
+ FIXUP_IMAGE_REGION(image, pregion, region);
+ FIXUP_IMAGE_ORIGIN(image, porigin, origin);
if (command_queue->ctx != mem->ctx) {
err = CL_INVALID_CONTEXT;
goto error;
clEnqueueCopyImage(cl_command_queue command_queue,
cl_mem src_mem,
cl_mem dst_mem,
- const size_t * src_origin,
- const size_t * dst_origin,
- const size_t * region,
+ const size_t * psrc_origin,
+ const size_t * pdst_origin,
+ const size_t * pregion,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
cl_event * event)
CHECK_QUEUE(command_queue);
CHECK_IMAGE(src_mem, src_image);
CHECK_IMAGE(dst_mem, dst_image);
+ FIXUP_IMAGE_REGION(src_image, pregion, region);
+ FIXUP_IMAGE_ORIGIN(src_image, psrc_origin, src_origin);
+ FIXUP_IMAGE_ORIGIN(dst_image, pdst_origin, dst_origin);
if (command_queue->ctx != src_mem->ctx ||
command_queue->ctx != dst_mem->ctx) {
err = CL_INVALID_CONTEXT;
clEnqueueCopyImageToBuffer(cl_command_queue command_queue,
cl_mem src_mem,
cl_mem dst_buffer,
- const size_t * src_origin,
- const size_t * region,
+ const size_t * psrc_origin,
+ const size_t * pregion,
size_t dst_offset,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
CHECK_QUEUE(command_queue);
CHECK_IMAGE(src_mem, src_image);
CHECK_MEM(dst_buffer);
+ FIXUP_IMAGE_REGION(src_image, pregion, region);
+ FIXUP_IMAGE_ORIGIN(src_image, psrc_origin, src_origin);
if (command_queue->ctx != src_mem->ctx ||
command_queue->ctx != dst_buffer->ctx) {
err = CL_INVALID_CONTEXT;
cl_mem src_buffer,
cl_mem dst_mem,
size_t src_offset,
- const size_t * dst_origin,
- const size_t * region,
+ const size_t * pdst_origin,
+ const size_t * pregion,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
cl_event * event)
CHECK_QUEUE(command_queue);
CHECK_MEM(src_buffer);
CHECK_IMAGE(dst_mem, dst_image);
+ FIXUP_IMAGE_REGION(dst_image, pregion, region);
+ FIXUP_IMAGE_ORIGIN(dst_image, pdst_origin, dst_origin);
if (command_queue->ctx != src_buffer->ctx ||
command_queue->ctx != dst_mem->ctx) {
err = CL_INVALID_CONTEXT;
cl_mem mem,
cl_bool blocking_map,
cl_map_flags map_flags,
- const size_t * origin,
- const size_t * region,
+ const size_t * porigin,
+ const size_t * pregion,
size_t * image_row_pitch,
size_t * image_slice_pitch,
cl_uint num_events_in_wait_list,
CHECK_QUEUE(command_queue);
CHECK_IMAGE(mem, image);
+ FIXUP_IMAGE_REGION(image, pregion, region);
+ FIXUP_IMAGE_ORIGIN(image, porigin, origin);
if (command_queue->ctx != mem->ctx) {
err = CL_INVALID_CONTEXT;
goto error;
struct _cl_mem_image *IMAGE; \
IMAGE = cl_mem_image(MEM); \
+#define FIXUP_IMAGE_REGION(IMAGE, PREGION, REGION) \
+const size_t *REGION; \
+size_t REGION ##_REC[3]; \
+do { \
+ if (IMAGE->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) { \
+ REGION ##_REC[0] = PREGION[0]; \
+ REGION ##_REC[1] = 1; \
+ REGION ##_REC[2] = PREGION[1]; \
+ REGION = REGION ##_REC; \
+ } else { \
+ REGION = PREGION; \
+ } \
+} while(0)
+
+#define FIXUP_IMAGE_ORIGIN(IMAGE, PREGION, REGION) \
+const size_t *REGION; \
+size_t REGION ##_REC[3]; \
+do { \
+ if (IMAGE->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) { \
+ REGION ##_REC[0] = PREGION[0]; \
+ REGION ##_REC[1] = 0; \
+ REGION ##_REC[2] = PREGION[1]; \
+ REGION = REGION ##_REC; \
+ } else { \
+ REGION = PREGION; \
+ } \
+} while(0)
+
+
#define CHECK_EVENT(EVENT) \
do { \
if (UNLIKELY(EVENT == NULL)) { \