summaryrefslogtreecommitdiff
path: root/utests/compiler_sampler.cpp
diff options
context:
space:
mode:
authorHomer Hsing <homer.xing@intel.com>2012-11-22 16:21:02 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-03-29 18:41:33 +0800
commitb5d68f0c9e9201c8acbb19f85b932f943c99d14d (patch)
treea055a288e5cf2a355eb80424313d0c900cd0384b /utests/compiler_sampler.cpp
parent32efa9238dc95f27548ada919182f52391c438b7 (diff)
downloadbeignet-b5d68f0c9e9201c8acbb19f85b932f943c99d14d.tar.gz
Test case for OpenCL 1.1 Sampler Objects
Diffstat (limited to 'utests/compiler_sampler.cpp')
-rw-r--r--utests/compiler_sampler.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/utests/compiler_sampler.cpp b/utests/compiler_sampler.cpp
new file mode 100644
index 00000000..807263ea
--- /dev/null
+++ b/utests/compiler_sampler.cpp
@@ -0,0 +1,39 @@
+/* test OpenCL 1.1 Sampler Objects (section 5.5) */
+#include "utest_helper.hpp"
+
+void compiler_sampler(void)
+{
+ OCL_ASSERT(ctx != 0);
+ cl_sampler s;
+ cl_int err;
+ int a1[] = {CL_TRUE, CL_FALSE},
+ a2[] = {CL_ADDRESS_MIRRORED_REPEAT,
+ CL_ADDRESS_REPEAT,
+ CL_ADDRESS_CLAMP_TO_EDGE,
+ CL_ADDRESS_CLAMP,
+ CL_ADDRESS_NONE},
+ a3[] = {CL_FILTER_NEAREST, CL_FILTER_LINEAR},
+ a4[] = {CL_SAMPLER_REFERENCE_COUNT,
+ CL_SAMPLER_CONTEXT,
+ CL_SAMPLER_NORMALIZED_COORDS,
+ CL_SAMPLER_ADDRESSING_MODE,
+ CL_SAMPLER_FILTER_MODE};
+ char pv[1000];
+ size_t pv_size;
+ int i, j, k, l;
+ for(i=0; i<2; i++)
+ for(j=0; j<5; j++)
+ for(k=0; k<2; k++) {
+ s = clCreateSampler(ctx, a1[i], a2[j], a3[k], &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);
+ }
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_sampler);
+
+