Greg Daniel | 6ecc911 | 2017-06-16 16:17:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "src/gpu/gl/GrGLSemaphore.h" |
Greg Daniel | 6ecc911 | 2017-06-16 16:17:03 +0000 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "src/gpu/gl/GrGLGpu.h" |
Greg Daniel | 6ecc911 | 2017-06-16 16:17:03 +0000 | [diff] [blame] | 11 | |
Brian Salomon | 62db8d5 | 2018-08-30 10:37:47 -0400 | [diff] [blame] | 12 | GrGLSemaphore::GrGLSemaphore(GrGLGpu* gpu, bool isOwned) |
| 13 | : INHERITED(gpu), fSync(0), fIsOwned(isOwned) { |
Brian Salomon | aa6ca0a | 2019-01-24 16:03:07 -0500 | [diff] [blame] | 14 | isOwned ? this->registerWithCache(SkBudgeted::kNo) |
| 15 | : this->registerWithCacheWrapped(GrWrapCacheable::kNo); |
Greg Daniel | 6ecc911 | 2017-06-16 16:17:03 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Brian Salomon | 62db8d5 | 2018-08-30 10:37:47 -0400 | [diff] [blame] | 18 | void GrGLSemaphore::onRelease() { |
| 19 | if (fSync && fIsOwned) { |
| 20 | static_cast<const GrGLGpu*>(this->getGpu())->deleteSync(fSync); |
Greg Daniel | 6ecc911 | 2017-06-16 16:17:03 +0000 | [diff] [blame] | 21 | } |
Brian Salomon | 62db8d5 | 2018-08-30 10:37:47 -0400 | [diff] [blame] | 22 | fSync = 0; |
| 23 | INHERITED::onRelease(); |
| 24 | } |
| 25 | |
| 26 | void GrGLSemaphore::onAbandon() { |
| 27 | fSync = 0; |
| 28 | INHERITED::onAbandon(); |
Greg Daniel | 6ecc911 | 2017-06-16 16:17:03 +0000 | [diff] [blame] | 29 | } |