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 extern bool gDebugTrace; 26 extern bool gTestSmallImages; 27 extern bool gEnablePitch; 28 extern bool gTestMaxImages; 29 extern bool gTestMipmaps; 30 31 // Amount to offset pixels for checking normalized reads 32 #define NORM_OFFSET 0.1f 33 34 enum TypesToTest 35 { 36 kTestInt = ( 1 << 0 ), 37 kTestUInt = ( 1 << 1 ), 38 kTestFloat = ( 1 << 2 ), 39 kTestAllTypes = kTestInt | kTestUInt | kTestFloat 40 }; 41 42 // For the clCopyImage test 43 enum MethodsToTest 44 { 45 k1D = ( 1 << 0 ), 46 k2D = ( 1 << 1 ), 47 k1DArray = ( 1 << 2 ), 48 k2DArray = ( 1 << 3 ), 49 k3D = ( 1 << 4 ), 50 k2DTo3D = ( 1 << 5 ), 51 k3DTo2D = ( 1 << 6 ), 52 k2DArrayTo2D = ( 1 << 7 ), 53 k2DTo2DArray = ( 1 << 8 ), 54 k2DArrayTo3D = ( 1 << 9 ), 55 k3DTo2DArray = ( 1 << 10 ), 56 }; 57 58 59 enum TestTypes 60 { 61 kReadTests = 1 << 0 , 62 kWriteTests = 1 << 1, 63 kReadWriteTests = 1 << 2, 64 kAllTests = ( kReadTests | kWriteTests | kReadWriteTests ) 65 }; 66 67 typedef int (*test_format_set_fn)( 68 cl_device_id device, cl_context context, cl_command_queue queue, 69 const std::vector<cl_image_format> &formatList, 70 const std::vector<bool> &filterFlags, image_sampler_data *imageSampler, 71 ExplicitType outputType, cl_mem_object_type imageType); 72 73 extern int test_read_image_formats( 74 cl_device_id device, cl_context context, cl_command_queue queue, 75 const std::vector<cl_image_format> &formatList, 76 const std::vector<bool> &filterFlags, image_sampler_data *imageSampler, 77 ExplicitType outputType, cl_mem_object_type imageType); 78 extern int test_write_image_formats( 79 cl_device_id device, cl_context context, cl_command_queue queue, 80 const std::vector<cl_image_format> &formatList, 81 const std::vector<bool> &filterFlags, image_sampler_data *imageSampler, 82 ExplicitType outputType, cl_mem_object_type imageType); 83 84 #endif // _testBase_h 85 86 87 88