blob: d3a224ee1bb16f085bbcacc4c4a76efd2bcb4712 [file] [log] [blame]
Greg Daniel6ecc9112017-06-16 16:17:03 +00001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "src/gpu/gl/GrGLSemaphore.h"
Greg Daniel6ecc9112017-06-16 16:17:03 +00009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "src/gpu/gl/GrGLGpu.h"
Greg Daniel6ecc9112017-06-16 16:17:03 +000011
Brian Salomon62db8d52018-08-30 10:37:47 -040012GrGLSemaphore::GrGLSemaphore(GrGLGpu* gpu, bool isOwned)
13 : INHERITED(gpu), fSync(0), fIsOwned(isOwned) {
Brian Salomonaa6ca0a2019-01-24 16:03:07 -050014 isOwned ? this->registerWithCache(SkBudgeted::kNo)
15 : this->registerWithCacheWrapped(GrWrapCacheable::kNo);
Greg Daniel6ecc9112017-06-16 16:17:03 +000016}
17
Brian Salomon62db8d52018-08-30 10:37:47 -040018void GrGLSemaphore::onRelease() {
19 if (fSync && fIsOwned) {
20 static_cast<const GrGLGpu*>(this->getGpu())->deleteSync(fSync);
Greg Daniel6ecc9112017-06-16 16:17:03 +000021 }
Brian Salomon62db8d52018-08-30 10:37:47 -040022 fSync = 0;
23 INHERITED::onRelease();
24}
25
26void GrGLSemaphore::onAbandon() {
27 fSync = 0;
28 INHERITED::onAbandon();
Greg Daniel6ecc9112017-06-16 16:17:03 +000029}