xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/cl/CLPlatformCL.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 // CLPlatformCL.h: Defines the class interface for CLPlatformCL, implementing CLPlatformImpl.
7 
8 #ifndef LIBANGLE_RENDERER_CL_CLPLATFORMCL_H_
9 #define LIBANGLE_RENDERER_CL_CLPLATFORMCL_H_
10 
11 #include "libANGLE/renderer/CLPlatformImpl.h"
12 
13 namespace rx
14 {
15 
16 class CLPlatformCL : public CLPlatformImpl
17 {
18   public:
19     ~CLPlatformCL() override;
20 
21     cl_platform_id getNative() const;
22 
23     Info createInfo() const override;
24     CLDeviceImpl::CreateDatas createDevices() const override;
25 
26     angle::Result createContext(cl::Context &context,
27                                 const cl::DevicePtrs &devices,
28                                 bool userSync,
29                                 CLContextImpl::Ptr *contextOut) override;
30 
31     angle::Result createContextFromType(cl::Context &context,
32                                         cl::DeviceType deviceType,
33                                         bool userSync,
34                                         CLContextImpl::Ptr *contextOut) override;
35 
36     angle::Result unloadCompiler() override;
37 
38     static void Initialize(CreateFuncs &createFuncs, bool isIcd);
39 
40   private:
41     CLPlatformCL(const cl::Platform &platform, cl_platform_id native, bool isIcd);
42 
43     const cl_platform_id mNative;
44     const bool mIsIcd;
45 
46     friend class CLContextCL;
47 };
48 
getNative()49 inline cl_platform_id CLPlatformCL::getNative() const
50 {
51     return mNative;
52 }
53 
54 }  // namespace rx
55 
56 #endif  // LIBANGLE_RENDERER_CL_CLPLATFORMCL_H_
57