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