| 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 |
#include "src/gpu/ganesh/d3d/GrD3DSemaphore.h" |
| 9 |
|
| 10 |
#include "src/gpu/ganesh/d3d/GrD3DGpu.h" |
| 11 |
|
| 12 |
|
| 13 |
std::unique_ptr<GrD3DSemaphore> GrD3DSemaphore::Make(GrD3DGpu* gpu) { |
| 14 |
GrD3DFenceInfo fenceInfo; |
| 15 |
gpu->device()->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fenceInfo.fFence)); |
| 16 |
fenceInfo.fValue = 1; |
| 17 |
|
| 18 |
return std::unique_ptr<GrD3DSemaphore>(new GrD3DSemaphore(fenceInfo)); |
| 19 |
} |
| 20 |
|
| 21 |
std::unique_ptr<GrD3DSemaphore> GrD3DSemaphore::MakeWrapped(const GrD3DFenceInfo& fenceInfo) { |
| 22 |
return std::unique_ptr<GrD3DSemaphore>(new GrD3DSemaphore(fenceInfo)); |
| 23 |
} |
| 24 |
|
| 25 |
GrD3DSemaphore::GrD3DSemaphore(const GrD3DFenceInfo& fenceInfo) : fFenceInfo(fenceInfo) {} |
| 26 |
|
| 27 |
GrBackendSemaphore GrD3DSemaphore::backendSemaphore() const { |
| 28 |
GrBackendSemaphore backendSemaphore; |
| 29 |
backendSemaphore.initDirect3D(fFenceInfo); |
| 30 |
return backendSemaphore; |
| 31 |
} |