GrSemaphore.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #ifndef GrSemaphore_DEFINED
  8. #define GrSemaphore_DEFINED
  9. #include "include/gpu/GrBackendSemaphore.h"
  10. #include "include/gpu/GrGpuResource.h"
  11. /**
  12. * Represents a semaphore-like GPU synchronization object. This is a slightly odd fit for
  13. * GrGpuResource because we don't care about budgeting, recycling, or read/write references for
  14. * these. However, making it a GrGpuResource makes it simpler to handle releasing/abandoning these
  15. * along with other resources. If more cases like this arise we could consider moving some of the
  16. * unused functionality off of GrGpuResource.
  17. */
  18. class GrSemaphore : public GrGpuResource {
  19. public:
  20. // The derived class can return its GrBackendSemaphore. This is used when flushing with signal
  21. // semaphores so we can set the client's GrBackendSemaphore object after we've created the
  22. // internal semaphore.
  23. virtual GrBackendSemaphore backendSemaphore() const = 0;
  24. const char* getResourceType() const override { return "semaphore"; }
  25. protected:
  26. explicit GrSemaphore(GrGpu* gpu) : INHERITED(gpu) {}
  27. private:
  28. size_t onGpuMemorySize() const override { return 0; }
  29. typedef GrGpuResource INHERITED;
  30. };
  31. #endif