FenceSync.h 933 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright 2016 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 FenceSync_DEFINED
  8. #define FenceSync_DEFINED
  9. #include "include/core/SkTypes.h"
  10. namespace sk_gpu_test {
  11. using PlatformFence = uint64_t;
  12. static constexpr PlatformFence kInvalidFence = 0;
  13. /*
  14. * This class provides an interface to interact with fence syncs. A fence sync is an object that the
  15. * client can insert into the GPU command stream, and then at any future time, wait until all
  16. * commands that were issued before the fence have completed.
  17. */
  18. class FenceSync {
  19. public:
  20. virtual PlatformFence SK_WARN_UNUSED_RESULT insertFence() const = 0;
  21. virtual bool waitFence(PlatformFence) const = 0;
  22. virtual void deleteFence(PlatformFence) const = 0;
  23. virtual bool validate() const { return true; }
  24. virtual ~FenceSync() {}
  25. };
  26. } // namespace sk_gpu_test
  27. #endif