1*8975f5c5SAndroid Build Coastguard Worker // 2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2019 The ANGLE Project Authors. All rights reserved. 3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker // 6*8975f5c5SAndroid Build Coastguard Worker // MemoryObject.h: Defines the gl::MemoryObject class [EXT_external_objects] 7*8975f5c5SAndroid Build Coastguard Worker 8*8975f5c5SAndroid Build Coastguard Worker #ifndef LIBANGLE_MEMORYOBJECT_H_ 9*8975f5c5SAndroid Build Coastguard Worker #define LIBANGLE_MEMORYOBJECT_H_ 10*8975f5c5SAndroid Build Coastguard Worker 11*8975f5c5SAndroid Build Coastguard Worker #include "angle_gl.h" 12*8975f5c5SAndroid Build Coastguard Worker #include "common/PackedEnums.h" 13*8975f5c5SAndroid Build Coastguard Worker #include "common/angleutils.h" 14*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Error.h" 15*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/RefCountObject.h" 16*8975f5c5SAndroid Build Coastguard Worker 17*8975f5c5SAndroid Build Coastguard Worker namespace rx 18*8975f5c5SAndroid Build Coastguard Worker { 19*8975f5c5SAndroid Build Coastguard Worker class GLImplFactory; 20*8975f5c5SAndroid Build Coastguard Worker class MemoryObjectImpl; 21*8975f5c5SAndroid Build Coastguard Worker } // namespace rx 22*8975f5c5SAndroid Build Coastguard Worker 23*8975f5c5SAndroid Build Coastguard Worker namespace gl 24*8975f5c5SAndroid Build Coastguard Worker { 25*8975f5c5SAndroid Build Coastguard Worker class Context; 26*8975f5c5SAndroid Build Coastguard Worker 27*8975f5c5SAndroid Build Coastguard Worker class MemoryObject final : public RefCountObject<MemoryObjectID> 28*8975f5c5SAndroid Build Coastguard Worker { 29*8975f5c5SAndroid Build Coastguard Worker public: 30*8975f5c5SAndroid Build Coastguard Worker MemoryObject(rx::GLImplFactory *factory, MemoryObjectID id); 31*8975f5c5SAndroid Build Coastguard Worker ~MemoryObject() override; 32*8975f5c5SAndroid Build Coastguard Worker 33*8975f5c5SAndroid Build Coastguard Worker void onDestroy(const Context *context) override; 34*8975f5c5SAndroid Build Coastguard Worker getImplementation()35*8975f5c5SAndroid Build Coastguard Worker rx::MemoryObjectImpl *getImplementation() const { return mImplementation.get(); } 36*8975f5c5SAndroid Build Coastguard Worker isImmutable()37*8975f5c5SAndroid Build Coastguard Worker bool isImmutable() const { return mImmutable; } 38*8975f5c5SAndroid Build Coastguard Worker 39*8975f5c5SAndroid Build Coastguard Worker angle::Result setDedicatedMemory(const Context *context, bool dedicatedMemory); isDedicatedMemory()40*8975f5c5SAndroid Build Coastguard Worker bool isDedicatedMemory() const { return mDedicatedMemory; } 41*8975f5c5SAndroid Build Coastguard Worker angle::Result setProtectedMemory(const Context *context, bool protectedMemory); isProtectedMemory()42*8975f5c5SAndroid Build Coastguard Worker bool isProtectedMemory() const { return mProtectedMemory; } 43*8975f5c5SAndroid Build Coastguard Worker 44*8975f5c5SAndroid Build Coastguard Worker angle::Result importFd(Context *context, GLuint64 size, HandleType handleType, GLint fd); 45*8975f5c5SAndroid Build Coastguard Worker angle::Result importZirconHandle(Context *context, 46*8975f5c5SAndroid Build Coastguard Worker GLuint64 size, 47*8975f5c5SAndroid Build Coastguard Worker HandleType handleType, 48*8975f5c5SAndroid Build Coastguard Worker GLuint handle); 49*8975f5c5SAndroid Build Coastguard Worker 50*8975f5c5SAndroid Build Coastguard Worker private: 51*8975f5c5SAndroid Build Coastguard Worker std::unique_ptr<rx::MemoryObjectImpl> mImplementation; 52*8975f5c5SAndroid Build Coastguard Worker 53*8975f5c5SAndroid Build Coastguard Worker bool mImmutable; 54*8975f5c5SAndroid Build Coastguard Worker bool mDedicatedMemory; 55*8975f5c5SAndroid Build Coastguard Worker bool mProtectedMemory; 56*8975f5c5SAndroid Build Coastguard Worker }; 57*8975f5c5SAndroid Build Coastguard Worker 58*8975f5c5SAndroid Build Coastguard Worker } // namespace gl 59*8975f5c5SAndroid Build Coastguard Worker 60*8975f5c5SAndroid Build Coastguard Worker #endif // LIBANGLE_MEMORYOBJECT_H_ 61