1 // 2 // Copyright (c) 2020 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 IMAGES_COMMON_H 17 #define IMAGES_COMMON_H 18 19 #include "testBase.h" 20 #include "harness/kernelHelpers.h" 21 #include "harness/errorHelpers.h" 22 #include "harness/conversions.h" 23 24 #include <array> 25 26 extern cl_channel_type gChannelTypeToUse; 27 extern cl_channel_order gChannelOrderToUse; 28 29 extern cl_channel_type floatFormats[]; 30 extern cl_channel_type intFormats[]; 31 extern cl_channel_type uintFormats[]; 32 33 struct ImageTestTypes 34 { 35 TypesToTest type; 36 ExplicitType explicitType; 37 cl_channel_type *channelTypes; 38 const char *name; 39 }; 40 41 extern std::array<ImageTestTypes, 3> imageTestTypes; 42 43 const char *convert_image_type_to_string(cl_mem_object_type imageType); 44 int filter_formats(cl_image_format *formatList, bool *filterFlags, 45 unsigned int formatCount, 46 cl_channel_type *channelDataTypesToFilter, 47 bool testMipmaps = false); 48 int get_format_list(cl_context context, cl_mem_object_type imageType, 49 cl_image_format *&outFormatList, 50 unsigned int &outFormatCount, cl_mem_flags flags); 51 size_t random_in_ranges(size_t minimum, size_t rangeA, size_t rangeB, MTdata d); 52 53 #endif // IMAGES_COMMON_H 54