1//
2// Copyright (c) 2002-2013 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// Fence.h: Defines the gl::Fence class, which supports the GL_NV_fence extension.
8
9#ifndef LIBGLESV2_FENCE_H_
10#define LIBGLESV2_FENCE_H_
11
12#include "common/angleutils.h"
13#include "common/RefCountObject.h"
14
15namespace rx
16{
17class Renderer;
18class FenceImpl;
19}
20
21namespace gl
22{
23
24class FenceNV
25{
26  public:
27    explicit FenceNV(rx::Renderer *renderer);
28    virtual ~FenceNV();
29
30    GLboolean isFence() const;
31    void setFence(GLenum condition);
32    GLboolean testFence();
33    void finishFence();
34    GLint getFencei(GLenum pname);
35
36    GLboolean getStatus() const { return mStatus; }
37    GLuint getCondition() const { return mCondition; }
38
39  private:
40    DISALLOW_COPY_AND_ASSIGN(FenceNV);
41
42    rx::FenceImpl *mFence;
43
44    GLboolean mStatus;
45    GLenum mCondition;
46};
47
48class FenceSync : public RefCountObject
49{
50  public:
51    explicit FenceSync(rx::Renderer *renderer, GLuint id);
52    virtual ~FenceSync();
53
54    void set(GLenum condition);
55    GLenum clientWait(GLbitfield flags, GLuint64 timeout);
56    void serverWait();
57    GLenum getStatus() const;
58
59    GLuint getCondition() const { return mCondition; }
60
61  private:
62    DISALLOW_COPY_AND_ASSIGN(FenceSync);
63
64    rx::FenceImpl *mFence;
65    LONGLONG mCounterFrequency;
66
67    GLenum mCondition;
68};
69
70}
71
72#endif   // LIBGLESV2_FENCE_H_
73