| 1 |
/* |
| 2 |
* Copyright 2023 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 "include/gpu/graphite/BackendSemaphore.h" |
| 9 |
|
| 10 |
#include "include/gpu/GpuTypes.h" |
| 11 |
#include "include/private/base/SkAssert.h" |
| 12 |
#include "src/gpu/graphite/BackendSemaphorePriv.h" |
| 13 |
|
| 14 |
namespace skgpu::graphite { |
| 15 |
|
| 16 |
BackendSemaphore::BackendSemaphore() = default; |
| 17 |
|
| 18 |
BackendSemaphore::~BackendSemaphore() = default; |
| 19 |
|
| 20 |
BackendSemaphore::BackendSemaphore(const BackendSemaphore& that) { |
| 21 |
*this = that; |
| 22 |
} |
| 23 |
|
| 24 |
BackendSemaphore& BackendSemaphore::operator=(const BackendSemaphore& that) { |
| 25 |
if (!that.isValid()) { |
| 26 |
fIsValid = false; |
| 27 |
return *this; |
| 28 |
} |
| 29 |
SkASSERT(!this->isValid() || this->backend() == that.backend()); |
| 30 |
fIsValid = true; |
| 31 |
fBackend = that.fBackend; |
| 32 |
|
| 33 |
switch (that.backend()) { |
| 34 |
case BackendApi::kDawn: |
| 35 |
SK_ABORT("Unsupported Backend"); |
| 36 |
case BackendApi::kMetal: |
| 37 |
case BackendApi::kVulkan: |
| 38 |
fSemaphoreData.reset(); |
| 39 |
that.fSemaphoreData->copyTo(fSemaphoreData); |
| 40 |
break; |
| 41 |
default: |
| 42 |
SK_ABORT("Unsupported Backend"); |
| 43 |
} |
| 44 |
return *this; |
| 45 |
} |
| 46 |
|
| 47 |
BackendSemaphoreData::~BackendSemaphoreData() {} |
| 48 |
|
| 49 |
} // End of namespace skgpu::graphite |