• 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 // CLtypes.h: Defines common types for the OpenCL support in ANGLE.
7 
8 #ifndef LIBANGLE_CLTYPES_H_
9 #define LIBANGLE_CLTYPES_H_
10 
11 #include "libANGLE/CLBitField.h"
12 #include "libANGLE/CLRefPointer.h"
13 #include "libANGLE/Debug.h"
14 
15 #include "common/PackedCLEnums_autogen.h"
16 #include "common/angleutils.h"
17 
18 // Include frequently used standard headers
19 #include <algorithm>
20 #include <array>
21 #include <functional>
22 #include <list>
23 #include <memory>
24 #include <string>
25 #include <utility>
26 #include <vector>
27 
28 #define ANGLE_CL_TRY(expression)              \
29     do                                        \
30     {                                         \
31         const cl_int _errorCode = expression; \
32         if (_errorCode != CL_SUCCESS)         \
33         {                                     \
34             return _errorCode;                \
35         }                                     \
36     } while (0)
37 
38 namespace cl
39 {
40 
41 class Buffer;
42 class CommandQueue;
43 class Context;
44 class Device;
45 class Event;
46 class Image;
47 class Kernel;
48 class Memory;
49 class Object;
50 class Platform;
51 class Program;
52 class Sampler;
53 
54 using BufferPtr       = RefPointer<Buffer>;
55 using CommandQueuePtr = RefPointer<CommandQueue>;
56 using ContextPtr      = RefPointer<Context>;
57 using DevicePtr       = RefPointer<Device>;
58 using EventPtr        = RefPointer<Event>;
59 using KernelPtr       = RefPointer<Kernel>;
60 using MemoryPtr       = RefPointer<Memory>;
61 using PlatformPtr     = RefPointer<Platform>;
62 using ProgramPtr      = RefPointer<Program>;
63 using SamplerPtr      = RefPointer<Sampler>;
64 
65 using BufferPtrs   = std::vector<BufferPtr>;
66 using DevicePtrs   = std::vector<DevicePtr>;
67 using EventPtrs    = std::vector<EventPtr>;
68 using KernelPtrs   = std::vector<KernelPtr>;
69 using MemoryPtrs   = std::vector<MemoryPtr>;
70 using PlatformPtrs = std::vector<PlatformPtr>;
71 using ProgramPtrs  = std::vector<ProgramPtr>;
72 
73 struct ImageDescriptor
74 {
75     MemObjectType type;
76     size_t width;
77     size_t height;
78     size_t depth;
79     size_t arraySize;
80     size_t rowPitch;
81     size_t slicePitch;
82     cl_uint numMipLevels;
83     cl_uint numSamples;
84 };
85 
86 }  // namespace cl
87 
88 #endif  // LIBANGLE_CLTYPES_H_
89