summaryrefslogtreecommitdiff
path: root/utests/compiler_copy_image.cpp
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2013-02-21 17:09:51 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-04-10 14:52:33 +0800
commit12f08a61b5933baf9ceb24609b95cb1cb85d88c8 (patch)
tree8f2c170525bb23bcf3069b535b78369ef00ab820 /utests/compiler_copy_image.cpp
parentc8d17cda7725791e346270563d13d1154605a9b9 (diff)
downloadbeignet-12f08a61b5933baf9ceb24609b95cb1cb85d88c8.tar.gz
Use new OCL1.2 API rather than those deprecated API.
Use clCreateImage to replace the old API clCreateImage2D. It will silent the compiler warnings. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com> Reviewed-by: Homer Hsing <homer.xing@intel.com>
Diffstat (limited to 'utests/compiler_copy_image.cpp')
-rw-r--r--utests/compiler_copy_image.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/utests/compiler_copy_image.cpp b/utests/compiler_copy_image.cpp
index ad19cf21..685a189c 100644
--- a/utests/compiler_copy_image.cpp
+++ b/utests/compiler_copy_image.cpp
@@ -5,11 +5,9 @@ static void compiler_copy_image(void)
const size_t w = 512;
const size_t h = 512;
cl_image_format format;
+ cl_image_desc desc;
cl_sampler sampler;
- format.image_channel_order = CL_RGBA;
- format.image_channel_data_type = CL_UNSIGNED_INT8;
-
// Setup kernel and images
OCL_CREATE_KERNEL("test_copy_image");
buf_data[0] = (uint32_t*) malloc(sizeof(uint32_t) * w * h);
@@ -17,8 +15,15 @@ static void compiler_copy_image(void)
for (uint32_t i = 0; i < w; i++)
((uint32_t*)buf_data[0])[j * w + i] = j * w + i;
- OCL_CREATE_IMAGE(buf[0], CL_MEM_COPY_HOST_PTR, &format, w, h, w * sizeof(uint32_t), buf_data[0]);
- OCL_CREATE_IMAGE(buf[1], 0, &format, w, h, w * sizeof(uint32_t), NULL);
+ format.image_channel_order = CL_RGBA;
+ format.image_channel_data_type = CL_UNSIGNED_INT8;
+ desc.image_type = CL_MEM_OBJECT_IMAGE2D;
+ desc.image_width = w;
+ desc.image_height = h;
+ desc.image_row_pitch = w * sizeof(uint32_t);
+
+ OCL_CREATE_IMAGE(buf[0], CL_MEM_COPY_HOST_PTR, &format, &desc, buf_data[0]);
+ OCL_CREATE_IMAGE(buf[1], 0, &format, &desc, NULL);
OCL_CREATE_SAMPLER(sampler, CL_ADDRESS_REPEAT, CL_FILTER_NEAREST);
free(buf_data[0]);
buf_data[0] = NULL;