[Beignet] [PATCH OCL20 05/11] Utest: Add sampler test

Xiuli Pan xiuli.pan at intel.com
Wed Mar 2 03:01:58 UTC 2016


From: Pan Xiuli <xiuli.pan at intel.com>

Reuse sampler test and add test for new api
clCreateSamplerWithProperties.

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 utests/CMakeLists.txt       |  1 +
 utests/compiler_sampler.cpp | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 1e03697..018705a 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -60,6 +60,7 @@ set (utests_sources
   compiler_copy_buffer_row.cpp
   compiler_degrees.cpp
   compiler_step.cpp
+  compiler_sampler.cpp
   compiler_fabs.cpp
   compiler_abs.cpp
   compiler_abs_diff.cpp
diff --git a/utests/compiler_sampler.cpp b/utests/compiler_sampler.cpp
index 32bf926..f8bf622 100644
--- a/utests/compiler_sampler.cpp
+++ b/utests/compiler_sampler.cpp
@@ -8,7 +8,7 @@ void compiler_sampler(void)
   OCL_ASSERT(ctx != 0);
   cl_sampler s;
   cl_int err;
-  int a1[] = {CL_TRUE, CL_FALSE},
+  cl_uint a1[] = {CL_TRUE, CL_FALSE},
       a2[] = {CL_ADDRESS_MIRRORED_REPEAT,
               CL_ADDRESS_REPEAT,
               CL_ADDRESS_CLAMP_TO_EDGE,
@@ -33,6 +33,18 @@ void compiler_sampler(void)
         for(l=0; l<5; l++)
           OCL_CALL(clGetSamplerInfo, s, a4[l], 1000, pv, &pv_size);
         OCL_CALL(clReleaseSampler, s);
+        cl_sampler_properties sam[] = {
+        CL_SAMPLER_NORMALIZED_COORDS, a1[i],
+        CL_SAMPLER_ADDRESSING_MODE, a2[j],
+        CL_SAMPLER_FILTER_MODE, a3[k],
+        0};
+        s = clCreateSamplerWithProperties(ctx, sam, &err);
+        OCL_ASSERT(err == CL_SUCCESS);
+        OCL_CALL(clRetainSampler, s);
+        OCL_CALL(clReleaseSampler, s);
+        for(l=0; l<5; l++)
+          OCL_CALL(clGetSamplerInfo, s, a4[l], 1000, pv, &pv_size);
+        OCL_CALL(clReleaseSampler, s);
       }
 }
 
-- 
2.5.0



More information about the Beignet mailing list