tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

EGLSync.h (2040B)


      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 
      7 // EGLSync.h: Defines the egl::Sync classes, which support the EGL_KHR_fence_sync,
      8 // EGL_KHR_wait_sync and EGL 1.5 sync objects.
      9 
     10 #ifndef LIBANGLE_EGLSYNC_H_
     11 #define LIBANGLE_EGLSYNC_H_
     12 
     13 #include "libANGLE/Debug.h"
     14 #include "libANGLE/Error.h"
     15 #include "libANGLE/RefCountObject.h"
     16 
     17 #include "common/angleutils.h"
     18 
     19 namespace rx
     20 {
     21 class EGLImplFactory;
     22 class EGLSyncImpl;
     23 }  // namespace rx
     24 
     25 namespace gl
     26 {
     27 class Context;
     28 }  // namespace gl
     29 
     30 namespace egl
     31 {
     32 class Sync final : public angle::RefCountObject<Display, angle::Result>, public LabeledObject
     33 {
     34  public:
     35    Sync(rx::EGLImplFactory *factory, EGLenum type, const AttributeMap &attribs);
     36    ~Sync() override;
     37 
     38    void setLabel(EGLLabelKHR label) override;
     39    EGLLabelKHR getLabel() const override;
     40 
     41    void onDestroy(const Display *display) override;
     42 
     43    Error initialize(const Display *display, const gl::Context *context);
     44    Error clientWait(const Display *display,
     45                     const gl::Context *context,
     46                     EGLint flags,
     47                     EGLTime timeout,
     48                     EGLint *outResult);
     49    Error serverWait(const Display *display, const gl::Context *context, EGLint flags);
     50    Error signal(const Display *display, const gl::Context *context, EGLint mode);
     51    Error getStatus(const Display *display, EGLint *outStatus) const;
     52 
     53    Error copyMetalSharedEventANGLE(const Display *display, void **result) const;
     54    Error dupNativeFenceFD(const Display *display, EGLint *result) const;
     55 
     56    EGLenum getType() const { return mType; }
     57    EGLint getCondition() const { return mCondition; }
     58    EGLint getNativeFenceFD() const { return mNativeFenceFD; }
     59 
     60  private:
     61    std::unique_ptr<rx::EGLSyncImpl> mFence;
     62 
     63    EGLLabelKHR mLabel;
     64 
     65    EGLenum mType;
     66    EGLint mCondition;
     67    EGLint mNativeFenceFD;
     68 };
     69 
     70 }  // namespace egl
     71 
     72 #endif  // LIBANGLE_FENCE_H_