• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //    http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include "testBase.h"
17 #include "harness/testHarness.h"
18 
19 
20 const char *kernel_with_bool[] = {
21     "__kernel void kernel_with_bool(__global float *src, __global int *dst)\n"
22     "{\n"
23     "    int  tid = get_global_id(0);\n"
24     "\n"
25     "    bool myBool = (src[tid] < 0.5f) && (src[tid] > -0.5f);\n"
26     "    if(myBool)\n"
27     "    {\n"
28     "        dst[tid] = (int)src[tid];\n"
29     "    }\n"
30     "    else\n"
31     "    {\n"
32     "        dst[tid] = 0;\n"
33     "    }\n"
34     "\n"
35     "}\n"
36 };
37 
test_bool_type(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)38 int test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
39 {
40 
41     clProgramWrapper program;
42     clKernelWrapper kernel;
43 
44     int err = create_single_kernel_helper(context,
45                       &program,
46                       &kernel,
47                       1, kernel_with_bool,
48                       "kernel_with_bool" );
49     return err;
50 }
51 
52