• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2021 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // entry_points_cl_utils.h: These helpers are used in CL entry point routines.
7 
8 #ifndef LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_
9 #define LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_
10 
11 #include "libANGLE/CLBitField.h"
12 #include "libANGLE/Debug.h"
13 
14 #include "common/PackedCLEnums_autogen.h"
15 
16 #include <cinttypes>
17 #include <cstdio>
18 
19 #if defined(ANGLE_ENABLE_DEBUG_TRACE)
20 #    define CL_EVENT(entryPoint, ...)                    \
21         std::printf("CL " #entryPoint ": " __VA_ARGS__); \
22         std::printf("\n")
23 #else
24 #    define CL_EVENT(entryPoint, ...) (void(0))
25 #endif
26 
27 namespace cl
28 {
29 
30 // Handling packed enums
31 template <typename PackedT, typename FromT>
PackParam(FromT from)32 typename std::enable_if_t<std::is_enum<PackedT>::value, PackedT> PackParam(FromT from)
33 {
34     return FromCLenum<PackedT>(from);
35 }
36 
37 // Handling bit fields
38 template <typename PackedT, typename FromT>
PackParam(FromT from)39 typename std::enable_if_t<std::is_same<PackedT, BitField>::value, PackedT> PackParam(FromT from)
40 {
41     return PackedT(from);
42 }
43 
44 void InitBackEnds(bool isIcd);
45 
46 }  // namespace cl
47 
48 #endif  // LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_
49