1 //
2 // Copyright 2015 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 // FenceNVGL.h: Defines the class interface for FenceNVGL.
8 
9 #ifndef LIBANGLE_RENDERER_GL_FENCENVGL_H_
10 #define LIBANGLE_RENDERER_GL_FENCENVGL_H_
11 
12 #include "libANGLE/renderer/FenceNVImpl.h"
13 
14 namespace rx
15 {
16 class FunctionsGL;
17 
18 // FenceNV implemented with the native GL_NV_fence extension
19 class FenceNVGL : public FenceNVImpl
20 {
21   public:
22     explicit FenceNVGL(const FunctionsGL *functions);
23     ~FenceNVGL() override;
24 
onDestroy(const gl::Context * context)25     void onDestroy(const gl::Context *context) override {}
26     angle::Result set(const gl::Context *context, GLenum condition) override;
27     angle::Result test(const gl::Context *context, GLboolean *outFinished) override;
28     angle::Result finish(const gl::Context *context) override;
29 
30     static bool Supported(const FunctionsGL *functions);
31 
32   private:
33     GLuint mFence;
34 
35     const FunctionsGL *mFunctions;
36 };
37 
38 // FenceNV implemented with the GLsync API
39 class FenceNVSyncGL : public FenceNVImpl
40 {
41   public:
42     explicit FenceNVSyncGL(const FunctionsGL *functions);
43     ~FenceNVSyncGL() override;
44 
onDestroy(const gl::Context * context)45     void onDestroy(const gl::Context *context) override {}
46     angle::Result set(const gl::Context *context, GLenum condition) override;
47     angle::Result test(const gl::Context *context, GLboolean *outFinished) override;
48     angle::Result finish(const gl::Context *context) override;
49 
50     static bool Supported(const FunctionsGL *functions);
51 
52   private:
53     GLsync mSyncObject;
54 
55     const FunctionsGL *mFunctions;
56 };
57 }  // namespace rx
58 
59 #endif  // LIBANGLE_RENDERER_GL_FENCENVGL_H_
60