aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLSemaphore.h
blob: 40dc53b396f6a22509aad1d71670d6bc33796960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrGLSemaphore_DEFINED
#define GrGLSemaphore_DEFINED

#include "GrSemaphore.h"

#include "GrGLGpu.h"

class GrGLSemaphore : public GrSemaphore {
public:
    static sk_sp<GrGLSemaphore> Make(const GrGLGpu* gpu) {
        return sk_sp<GrGLSemaphore>(new GrGLSemaphore(gpu));
    }

    ~GrGLSemaphore() override {
        if (fGpu) {
            static_cast<const GrGLGpu*>(fGpu)->deleteSync(fSync);
        }
    }

    GrGLsync sync() const { return fSync; }
    void setSync(const GrGLsync& sync) { fSync = sync; }

private:
    GrGLSemaphore(const GrGLGpu* gpu) : INHERITED(gpu), fSync(0) {}

    GrGLsync fSync;

    typedef GrSemaphore INHERITED;
};

#endif