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
17namespace rx
18{
19class GLImplFactory;
20class MemoryObjectImpl;
21} // namespace rx
22
23namespace gl
24{
25class Context;
26
27class 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
35 rx::MemoryObjectImpl *getImplementation() const { return mImplementation.get(); }
36
37 bool isImmutable() const { return mImmutable; }
38
39 angle::Result setDedicatedMemory(const Context *context, bool dedicatedMemory);
40 bool isDedicatedMemory() const { return mDedicatedMemory; }
41 angle::Result setProtectedMemory(const Context *context, bool protectedMemory);
42 bool isProtectedMemory() const { return mProtectedMemory; }
43
44 angle::Result importFd(Context *context, GLuint64 size, HandleType handleType, GLint fd);
45 angle::Result importZirconHandle(Context *context,
46 GLuint64 size,
47 HandleType handleType,
48 GLuint handle);
49
50 private:
51 std::unique_ptr<rx::MemoryObjectImpl> mImplementation;
52
53 bool mImmutable;
54 bool mDedicatedMemory;
55 bool mProtectedMemory;
56};
57
58} // namespace gl
59
60#endif // LIBANGLE_MEMORYOBJECT_H_
61

source code of flutter_engine/third_party/angle/src/libANGLE/MemoryObject.h