• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 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 GrMtlSemaphore_DEFINED
9 #define GrMtlSemaphore_DEFINED
10 
11 #include "include/gpu/GrBackendSemaphore.h"
12 #include "include/private/GrTypesPriv.h"
13 #include "src/gpu/GrSemaphore.h"
14 #include "src/gpu/mtl/GrMtlUtil.h"
15 
16 #include <Metal/Metal.h>
17 
18 class GrMtlGpu;
19 
20 class GrMtlSemaphore : public GrSemaphore {
21 public:
22     static std::unique_ptr<GrMtlSemaphore> Make(GrMtlGpu* gpu);
23 
24     static std::unique_ptr<GrMtlSemaphore> MakeWrapped(GrMTLHandle event, uint64_t value);
25 
~GrMtlSemaphore()26     ~GrMtlSemaphore() override {}
27 
event()28     id<MTLEvent> event() const SK_API_AVAILABLE(macos(10.14), ios(12.0)) { return fEvent; }
value()29     uint64_t value() const { return fValue; }
30 
31     GrBackendSemaphore backendSemaphore() const override;
32 
33 private:
34     GrMtlSemaphore(id<MTLEvent> event, uint64_t value) SK_API_AVAILABLE(macos(10.14), ios(12.0));
35 
setIsOwned()36     void setIsOwned() override {}
37 
38     id<MTLEvent> fEvent SK_API_AVAILABLE(macos(10.14), ios(12.0));
39     uint64_t     fValue;
40 
41     using INHERITED = GrSemaphore;
42 };
43 
44 #endif
45