• 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 #ifndef _testBase_h
17 #define _testBase_h
18 
19 #include "harness/compat.h"
20 #include "harness/testHarness.h"
21 #include "harness/kernelHelpers.h"
22 #include "harness/clImageHelper.h"
23 #include "harness/imageHelpers.h"
24 
25 // Amount to offset pixels for checking normalized reads
26 #define NORM_OFFSET 0.1f
27 
28 enum TypesToTest
29 {
30     kTestInt = ( 1 << 0 ),
31     kTestUInt = ( 1 << 1 ),
32     kTestFloat = ( 1 << 2 ),
33     kTestAllTypes = kTestInt | kTestUInt | kTestFloat
34 };
35 
36 // For the clCopyImage test
37 enum MethodsToTest
38 {
39     k1D = ( 1 << 0 ),
40     k2D    = ( 1 << 1 ),
41     k1DArray = ( 1 << 2 ),
42     k2DArray = ( 1 << 3 ),
43     k3D = ( 1 << 4 ),
44     k2DTo3D = ( 1 << 5 ),
45     k3DTo2D = ( 1 << 6 ),
46     k2DArrayTo2D = ( 1 << 7 ),
47     k2DTo2DArray = ( 1 << 8 ),
48     k2DArrayTo3D = ( 1 << 9 ),
49     k3DTo2DArray = ( 1 << 10 ),
50 };
51 
52 
53 enum TestTypes
54 {
55     kReadTests = 1 << 0 ,
56     kWriteTests = 1 << 1,
57     kReadWriteTests = 1 << 2,
58     kAllTests = ( kReadTests | kWriteTests | kReadWriteTests )
59 };
60 
61 typedef int (*test_format_set_fn)( cl_device_id device, cl_context context, cl_command_queue queue,
62   cl_image_format *formatList, bool *filterFlags, unsigned int numFormats,
63   image_sampler_data *imageSampler, ExplicitType outputType,
64   cl_mem_object_type imageType );
65 
66 extern int test_read_image_formats( cl_device_id device, cl_context context, cl_command_queue queue,
67   cl_image_format *formatList, bool *filterFlags, unsigned int numFormats,
68   image_sampler_data *imageSampler, ExplicitType outputType,
69   cl_mem_object_type imageType );
70 extern int test_write_image_formats( cl_device_id device, cl_context context, cl_command_queue queue,
71   cl_image_format *formatList, bool *filterFlags, unsigned int numFormats,
72   image_sampler_data *imageSampler, ExplicitType outputType,
73   cl_mem_object_type imageType );
74 
75 #endif // _testBase_h
76 
77 
78 
79