• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <vector>
26 
27 extern cl_channel_type gChannelTypeToUse;
28 extern cl_channel_order gChannelOrderToUse;
29 
30 extern cl_channel_type floatFormats[];
31 extern cl_channel_type intFormats[];
32 extern cl_channel_type uintFormats[];
33 
34 struct ImageTestTypes
35 {
36     TypesToTest type;
37     ExplicitType explicitType;
38     cl_channel_type *channelTypes;
39     const char *name;
40 };
41 
42 extern std::array<ImageTestTypes, 3> imageTestTypes;
43 
44 int filter_formats(const std::vector<cl_image_format> &formatList,
45                    std::vector<bool> &filterFlags,
46                    cl_channel_type *channelDataTypesToFilter,
47                    bool testMipmaps = false);
48 int get_format_list(cl_context context, cl_mem_object_type imageType,
49                     std::vector<cl_image_format> &outFormatList,
50                     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