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