1 /*
2  * Copyright 2020 Google LLC
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/gpu/d3d/GrD3DTypes.h"
13 #include "include/private/GrTypesPriv.h"
14 #include "src/gpu/GrSemaphore.h"
15 
16 class GrD3DGpu;
17 
18 class GrD3DSemaphore : public GrSemaphore {
19 public:
20     static std::unique_ptr<GrD3DSemaphore> Make(GrD3DGpu* gpu);
21 
22     static std::unique_ptr<GrD3DSemaphore> MakeWrapped(const GrD3DFenceInfo&);
23 
24     ~GrD3DSemaphore() override {}
25 
fence() const26     ID3D12Fence* fence() const { return fFenceInfo.fFence.get(); }
value() const27     uint64_t value() const { return fFenceInfo.fValue; }
28 
29     GrBackendSemaphore backendSemaphore() const override;
30 
31 private:
32     GrD3DSemaphore(const GrD3DFenceInfo&);
33 
34     void setIsOwned() override {}
35 
36     GrD3DFenceInfo fFenceInfo;
37 
38     using INHERITED = GrSemaphore;
39 };
40 
41 #endif
42