• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2019 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 // MemoryObject.h: Defines the gl::MemoryObject class [EXT_external_objects]
7 
8 #ifndef LIBANGLE_MEMORYOBJECT_H_
9 #define LIBANGLE_MEMORYOBJECT_H_
10 
11 #include "angle_gl.h"
12 #include "common/PackedEnums.h"
13 #include "common/angleutils.h"
14 #include "libANGLE/Error.h"
15 #include "libANGLE/RefCountObject.h"
16 
17 namespace rx
18 {
19 class GLImplFactory;
20 class MemoryObjectImpl;
21 }  // namespace rx
22 
23 namespace gl
24 {
25 class Context;
26 
27 class MemoryObject final : public RefCountObject<MemoryObjectID>
28 {
29   public:
30     MemoryObject(rx::GLImplFactory *factory, MemoryObjectID id);
31     ~MemoryObject() override;
32 
33     void onDestroy(const Context *context) override;
34 
getImplementation()35     rx::MemoryObjectImpl *getImplementation() const { return mImplementation.get(); }
36 
isImmutable()37     bool isImmutable() const { return mImmutable; }
38 
39     angle::Result setDedicatedMemory(const Context *context, bool dedicatedMemory);
isDedicatedMemory()40     bool isDedicatedMemory() const { return mDedicatedMemory; }
41 
42     angle::Result importFd(Context *context, GLuint64 size, HandleType handleType, GLint fd);
43     angle::Result importZirconHandle(Context *context,
44                                      GLuint64 size,
45                                      HandleType handleType,
46                                      GLuint handle);
47 
48   private:
49     std::unique_ptr<rx::MemoryObjectImpl> mImplementation;
50 
51     bool mImmutable;
52     bool mDedicatedMemory;
53 };
54 
55 }  // namespace gl
56 
57 #endif  // LIBANGLE_MEMORYOBJECT_H_
58