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 // CLMemoryCL.h: Defines the class interface for CLMemoryCL, implementing CLMemoryImpl.
7 
8 #ifndef LIBANGLE_RENDERER_CL_CLMEMORYCL_H_
9 #define LIBANGLE_RENDERER_CL_CLMEMORYCL_H_
10 
11 #include "libANGLE/renderer/CLMemoryImpl.h"
12 
13 namespace rx
14 {
15 
16 class CLMemoryCL : public CLMemoryImpl
17 {
18   public:
19     CLMemoryCL(const cl::Memory &memory, cl_mem native);
20     ~CLMemoryCL() override;
21 
22     cl_mem getNative() const;
23 
24     size_t getSize(cl_int &errorCode) const override;
25 
26     CLMemoryImpl::Ptr createSubBuffer(const cl::Buffer &buffer,
27                                       cl::MemFlags flags,
28                                       size_t size,
29                                       cl_int &errorCode) override;
30 
31   private:
32     const cl_mem mNative;
33 };
34 
getNative()35 inline cl_mem CLMemoryCL::getNative() const
36 {
37     return mNative;
38 }
39 
40 }  // namespace rx
41 
42 #endif  // LIBANGLE_RENDERER_CL_CLMEMORYCL_H_
43