diff options
author | Junyan He <junyan.he@linux.intel.com> | 2015-02-04 12:51:04 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-02-04 19:16:24 +0800 |
commit | 56c97df60bc6d6aabf7c799091e1b4273a500cd4 (patch) | |
tree | 5fdfdfccd38bdbba19ca8672678aaf1b98406d83 | |
parent | 2642495c29af0e8e571b28220d11734bca9861d5 (diff) |
Fix a bug of 1d image array test case.
Because of the HW limitation, vertical stride is at
least aligned to 2. For 1D array image, the data has interval.
The image size is just twice as big as the buffer size we think.
Use clEnqueueWriteImage is safe and fix this bug.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r-- | utests/compiler_fill_image_1d_array.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/utests/compiler_fill_image_1d_array.cpp b/utests/compiler_fill_image_1d_array.cpp index cc7cf0a0..67f96436 100644 --- a/utests/compiler_fill_image_1d_array.cpp +++ b/utests/compiler_fill_image_1d_array.cpp @@ -10,6 +10,11 @@ static void compiler_fill_image_1d_array(void) size_t origin[3] = { }; size_t region[3]; uint32_t* dst; + uint32_t* src; + + region[0] = w; + region[1] = array; + region[2] = 1; memset(&desc, 0x0, sizeof(cl_image_desc)); memset(&format, 0x0, sizeof(cl_image_format)); @@ -26,9 +31,9 @@ static void compiler_fill_image_1d_array(void) OCL_CREATE_IMAGE(buf[0], 0, &format, &desc, NULL); - OCL_MAP_BUFFER_GTT(0); - memset(buf_data[0], 0, sizeof(uint32_t) * w * array); - OCL_UNMAP_BUFFER_GTT(0); + src = (uint32_t*)malloc(w*array*sizeof(uint32_t)); + memset(src, 0, sizeof(uint32_t) * w * array); + OCL_WRITE_IMAGE(buf[0], origin, region, src); // Run the kernel OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); @@ -39,9 +44,6 @@ static void compiler_fill_image_1d_array(void) OCL_NDRANGE(2); // Check result - region[0] = w; - region[1] = array; - region[2] = 1; dst = (uint32_t*)malloc(w*array*sizeof(uint32_t)); OCL_READ_IMAGE(buf[0], origin, region, dst); |