xref: /aosp_15_r20/external/skia/src/gpu/ganesh/gl/GrGLSemaphore.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2017 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrGLSemaphore_DEFINED
9 #define GrGLSemaphore_DEFINED
10 
11 #include "include/gpu/ganesh/GrBackendSemaphore.h"
12 #include "include/gpu/ganesh/gl/GrGLTypes.h"
13 #include "include/private/base/SkAssert.h"
14 #include "src/gpu/ganesh/GrSemaphore.h"
15 
16 #include <memory>
17 
18 class GrGLGpu;
19 
20 class GrGLSemaphore : public GrSemaphore {
21 public:
Make(GrGLGpu * gpu,bool isOwned)22     static std::unique_ptr<GrGLSemaphore> Make(GrGLGpu* gpu, bool isOwned) {
23         return std::unique_ptr<GrGLSemaphore>(new GrGLSemaphore(gpu, isOwned));
24     }
25 
26     ~GrGLSemaphore() override;
27 
sync()28     GrGLsync sync() const { return fSync; }
setSync(const GrGLsync & sync)29     void setSync(const GrGLsync& sync) { fSync = sync; }
30 
backendSemaphore()31     GrBackendSemaphore backendSemaphore() const override {
32         SK_ABORT("Unsupported");
33     }
34 
35 private:
36     GrGLSemaphore(GrGLGpu* gpu, bool isOwned);
37 
setIsOwned()38     void setIsOwned() override {
39         fIsOwned = true;
40     }
41 
42     GrGLGpu* fGpu;
43     GrGLsync fSync;
44     bool     fIsOwned;
45 
46     using INHERITED = GrSemaphore;
47 };
48 
49 #endif
50