Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrBackendSemaphore.cpp
Go to the documentation of this file.
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
9
13
14#ifdef SK_DIRECT3D
16#endif
17
19 : fBackend(GrBackendApi::kUnsupported), fIsInitialized(false) {}
20
22
24#ifdef SK_DIRECT3D
25 if (fIsInitialized && GrBackendApi::kDirect3D == fBackend) {
26 delete fD3DFenceInfo;
27 fD3DFenceInfo = nullptr;
28 fIsInitialized = false;
29 }
30#endif
31}
32
34 fIsInitialized = false;
35 *this = that;
36}
37
39 SkASSERT(!fIsInitialized || fBackend == that.fBackend);
40 fBackend = that.fBackend;
41 fSemaphoreData.reset();
42 switch (that.fBackend) {
44 SK_ABORT("Unsupported");
45 break;
48 that.fSemaphoreData->copyTo(fSemaphoreData);
49 break;
50#ifdef SK_DIRECT3D
52 this->assignD3DFenceInfo(*that.fD3DFenceInfo);
53 break;
54#endif
55 default:
56 SK_ABORT("Unknown GrBackend");
57 }
58 fIsInitialized = true;
59 return *this;
60}
61
62#ifdef SK_DIRECT3D
63void GrBackendSemaphore::assignD3DFenceInfo(const GrD3DFenceInfo& info) {
65 if (fIsInitialized) {
66 *fD3DFenceInfo = info;
67 } else {
68 fD3DFenceInfo = new GrD3DFenceInfo(info);
69 }
70}
71
72bool GrBackendSemaphore::getD3DFenceInfo(GrD3DFenceInfo* outInfo) const {
73 if (fIsInitialized && GrBackendApi::kDirect3D == fBackend) {
74 *outInfo = *fD3DFenceInfo;
75 return true;
76 }
77 return false;
78}
79#endif // SK_DIRECT3D
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
GrBackendApi
Definition GrTypes.h:95
#define SK_ABORT(message,...)
Definition SkAssert.h:70
#define SkASSERT(cond)
Definition SkAssert.h:116
virtual void copyTo(AnySemaphoreData &) const =0
virtual ~GrBackendSemaphoreData()
GrBackendSemaphore & operator=(const GrBackendSemaphore &)