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