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 // Semaphore.h: Defines the gl::Semaphore class [EXT_external_objects] 7 8 #ifndef LIBANGLE_SEMAPHORE_H_ 9 #define LIBANGLE_SEMAPHORE_H_ 10 11 #include <memory> 12 13 #include "angle_gl.h" 14 #include "common/PackedEnums.h" 15 #include "common/angleutils.h" 16 #include "libANGLE/Error.h" 17 #include "libANGLE/RefCountObject.h" 18 #include "libANGLE/angletypes.h" 19 20 namespace rx 21 { 22 class GLImplFactory; 23 class SemaphoreImpl; 24 } // namespace rx 25 26 namespace gl 27 { 28 class Context; 29 30 class Semaphore final : public RefCountObject<SemaphoreID> 31 { 32 public: 33 Semaphore(rx::GLImplFactory *factory, SemaphoreID id); 34 ~Semaphore() override; 35 36 void onDestroy(const Context *context) override; 37 getImplementation()38 rx::SemaphoreImpl *getImplementation() const { return mImplementation.get(); } 39 40 angle::Result importFd(Context *context, HandleType handleType, GLint fd); 41 angle::Result importZirconHandle(Context *context, HandleType handleType, GLuint handle); 42 43 angle::Result wait(Context *context, 44 const BufferBarrierVector &bufferBarriers, 45 const TextureBarrierVector &textureBarriers); 46 47 angle::Result signal(Context *context, 48 const BufferBarrierVector &bufferBarriers, 49 const TextureBarrierVector &textureBarriers); 50 51 private: 52 std::unique_ptr<rx::SemaphoreImpl> mImplementation; 53 }; 54 55 } // namespace gl 56 57 #endif // LIBANGLE_SEMAPHORE_H_ 58