utest: Added some new helper macros for image2d test cases.
authorZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 16 Jan 2013 09:28:40 +0000 (17:28 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 10 Apr 2013 06:51:32 +0000 (14:51 +0800)
This is the first commit to prepare to add some image 2d
test cases.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Lu Guanqun <guanqun.lu@intel.com>
utests/utest_helper.hpp

index e1f2395..7987e75 100644 (file)
     if (status != CL_SUCCESS) OCL_THROW_ERROR(FN, status); \
   } while (0)
 
+#define OCL_CREATE_IMAGE(IMAGE, FLAGS, FORMAT, W, H, PITCH, DATA) \
+  do { \
+    cl_int status; \
+    IMAGE = clCreateImage2D(ctx, FLAGS, FORMAT, W, H, PITCH, DATA, &status);\
+    if (status != CL_SUCCESS) OCL_THROW_ERROR(FN, status); \
+  } while (0)
+
+#define OCL_CREATE_SAMPLER(SAMPLER, ADDRESS_MODE, FILTER_MODE)          \
+  do { \
+    cl_int status; \
+    SAMPLER = clCreateSampler(ctx, 0, CL_ADDRESS_CLAMP, CL_FILTER_NEAREST, &status);\
+    if (status != CL_SUCCESS) OCL_THROW_ERROR(FN, status); \
+  } while(0)
+
 #define OCL_MAP_BUFFER(ID) \
   do { \
     cl_int status; \