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