1*6467f958SSadaf Ebrahimi // 2*6467f958SSadaf Ebrahimi // Copyright (c) 2017 The Khronos Group Inc. 3*6467f958SSadaf Ebrahimi // 4*6467f958SSadaf Ebrahimi // Licensed under the Apache License, Version 2.0 (the "License"); 5*6467f958SSadaf Ebrahimi // you may not use this file except in compliance with the License. 6*6467f958SSadaf Ebrahimi // You may obtain a copy of the License at 7*6467f958SSadaf Ebrahimi // 8*6467f958SSadaf Ebrahimi // http://www.apache.org/licenses/LICENSE-2.0 9*6467f958SSadaf Ebrahimi // 10*6467f958SSadaf Ebrahimi // Unless required by applicable law or agreed to in writing, software 11*6467f958SSadaf Ebrahimi // distributed under the License is distributed on an "AS IS" BASIS, 12*6467f958SSadaf Ebrahimi // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*6467f958SSadaf Ebrahimi // See the License for the specific language governing permissions and 14*6467f958SSadaf Ebrahimi // limitations under the License. 15*6467f958SSadaf Ebrahimi // 16*6467f958SSadaf Ebrahimi #ifndef _testBase_h 17*6467f958SSadaf Ebrahimi #define _testBase_h 18*6467f958SSadaf Ebrahimi 19*6467f958SSadaf Ebrahimi #include "harness/compat.h" 20*6467f958SSadaf Ebrahimi #include "harness/testHarness.h" 21*6467f958SSadaf Ebrahimi #include "harness/kernelHelpers.h" 22*6467f958SSadaf Ebrahimi #include "harness/clImageHelper.h" 23*6467f958SSadaf Ebrahimi #include "harness/imageHelpers.h" 24*6467f958SSadaf Ebrahimi 25*6467f958SSadaf Ebrahimi extern bool gDebugTrace; 26*6467f958SSadaf Ebrahimi extern bool gTestSmallImages; 27*6467f958SSadaf Ebrahimi extern bool gEnablePitch; 28*6467f958SSadaf Ebrahimi extern bool gTestMaxImages; 29*6467f958SSadaf Ebrahimi extern bool gTestMipmaps; 30*6467f958SSadaf Ebrahimi 31*6467f958SSadaf Ebrahimi // Amount to offset pixels for checking normalized reads 32*6467f958SSadaf Ebrahimi #define NORM_OFFSET 0.1f 33*6467f958SSadaf Ebrahimi 34*6467f958SSadaf Ebrahimi enum TypesToTest 35*6467f958SSadaf Ebrahimi { 36*6467f958SSadaf Ebrahimi kTestInt = ( 1 << 0 ), 37*6467f958SSadaf Ebrahimi kTestUInt = ( 1 << 1 ), 38*6467f958SSadaf Ebrahimi kTestFloat = ( 1 << 2 ), 39*6467f958SSadaf Ebrahimi kTestAllTypes = kTestInt | kTestUInt | kTestFloat 40*6467f958SSadaf Ebrahimi }; 41*6467f958SSadaf Ebrahimi 42*6467f958SSadaf Ebrahimi // For the clCopyImage test 43*6467f958SSadaf Ebrahimi enum MethodsToTest 44*6467f958SSadaf Ebrahimi { 45*6467f958SSadaf Ebrahimi k1D = ( 1 << 0 ), 46*6467f958SSadaf Ebrahimi k2D = ( 1 << 1 ), 47*6467f958SSadaf Ebrahimi k1DArray = ( 1 << 2 ), 48*6467f958SSadaf Ebrahimi k2DArray = ( 1 << 3 ), 49*6467f958SSadaf Ebrahimi k3D = ( 1 << 4 ), 50*6467f958SSadaf Ebrahimi k2DTo3D = ( 1 << 5 ), 51*6467f958SSadaf Ebrahimi k3DTo2D = ( 1 << 6 ), 52*6467f958SSadaf Ebrahimi k2DArrayTo2D = ( 1 << 7 ), 53*6467f958SSadaf Ebrahimi k2DTo2DArray = ( 1 << 8 ), 54*6467f958SSadaf Ebrahimi k2DArrayTo3D = ( 1 << 9 ), 55*6467f958SSadaf Ebrahimi k3DTo2DArray = ( 1 << 10 ), 56*6467f958SSadaf Ebrahimi }; 57*6467f958SSadaf Ebrahimi 58*6467f958SSadaf Ebrahimi 59*6467f958SSadaf Ebrahimi enum TestTypes 60*6467f958SSadaf Ebrahimi { 61*6467f958SSadaf Ebrahimi kReadTests = 1 << 0 , 62*6467f958SSadaf Ebrahimi kWriteTests = 1 << 1, 63*6467f958SSadaf Ebrahimi kReadWriteTests = 1 << 2, 64*6467f958SSadaf Ebrahimi kAllTests = ( kReadTests | kWriteTests | kReadWriteTests ) 65*6467f958SSadaf Ebrahimi }; 66*6467f958SSadaf Ebrahimi 67*6467f958SSadaf Ebrahimi typedef int (*test_format_set_fn)( 68*6467f958SSadaf Ebrahimi cl_device_id device, cl_context context, cl_command_queue queue, 69*6467f958SSadaf Ebrahimi const std::vector<cl_image_format> &formatList, 70*6467f958SSadaf Ebrahimi const std::vector<bool> &filterFlags, image_sampler_data *imageSampler, 71*6467f958SSadaf Ebrahimi ExplicitType outputType, cl_mem_object_type imageType); 72*6467f958SSadaf Ebrahimi 73*6467f958SSadaf Ebrahimi extern int test_read_image_formats( 74*6467f958SSadaf Ebrahimi cl_device_id device, cl_context context, cl_command_queue queue, 75*6467f958SSadaf Ebrahimi const std::vector<cl_image_format> &formatList, 76*6467f958SSadaf Ebrahimi const std::vector<bool> &filterFlags, image_sampler_data *imageSampler, 77*6467f958SSadaf Ebrahimi ExplicitType outputType, cl_mem_object_type imageType); 78*6467f958SSadaf Ebrahimi extern int test_write_image_formats( 79*6467f958SSadaf Ebrahimi cl_device_id device, cl_context context, cl_command_queue queue, 80*6467f958SSadaf Ebrahimi const std::vector<cl_image_format> &formatList, 81*6467f958SSadaf Ebrahimi const std::vector<bool> &filterFlags, image_sampler_data *imageSampler, 82*6467f958SSadaf Ebrahimi ExplicitType outputType, cl_mem_object_type imageType); 83*6467f958SSadaf Ebrahimi 84*6467f958SSadaf Ebrahimi #endif // _testBase_h 85*6467f958SSadaf Ebrahimi 86*6467f958SSadaf Ebrahimi 87*6467f958SSadaf Ebrahimi 88