GrGLSemaphore.cpp 722 B

1234567891011121314151617181920212223242526272829
  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. #include "src/gpu/gl/GrGLSemaphore.h"
  8. #include "src/gpu/gl/GrGLGpu.h"
  9. GrGLSemaphore::GrGLSemaphore(GrGLGpu* gpu, bool isOwned)
  10. : INHERITED(gpu), fSync(0), fIsOwned(isOwned) {
  11. isOwned ? this->registerWithCache(SkBudgeted::kNo)
  12. : this->registerWithCacheWrapped(GrWrapCacheable::kNo);
  13. }
  14. void GrGLSemaphore::onRelease() {
  15. if (fSync && fIsOwned) {
  16. static_cast<const GrGLGpu*>(this->getGpu())->deleteSync(fSync);
  17. }
  18. fSync = 0;
  19. INHERITED::onRelease();
  20. }
  21. void GrGLSemaphore::onAbandon() {
  22. fSync = 0;
  23. INHERITED::onAbandon();
  24. }