diff options
author | cdalton <cdalton@nvidia.com> | 2015-06-23 13:23:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-23 13:23:44 -0700 |
commit | d416a5b10ff9e6d4f55a1f5b0419722132d68ff3 (patch) | |
tree | f9f39528fd8fd7c033882c137d711e12939c6fa2 /src/gpu/SkGpuFenceSync.h | |
parent | b607767703ff7898611cf88c1218d5d69535e984 (diff) |
Implement SkGLContext swapBuffers with fence syncs
Improves the GPU measuring accuracy of nanobench by using fence syncs.
Fence syncs are very widely supported and available on almost every
platform.
NO_MERGE_BUILDS
BUG=skia:
Review URL: https://codereview.chromium.org/1194783003
Diffstat (limited to 'src/gpu/SkGpuFenceSync.h')
-rw-r--r-- | src/gpu/SkGpuFenceSync.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gpu/SkGpuFenceSync.h b/src/gpu/SkGpuFenceSync.h new file mode 100644 index 0000000000..b78398fed8 --- /dev/null +++ b/src/gpu/SkGpuFenceSync.h @@ -0,0 +1,29 @@ + +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkGpuFenceSync_DEFINED +#define SkGpuFenceSync_DEFINED + +#include "SkTypes.h" + +typedef void* SkPlatformGpuFence; + +/* + * This class provides an interface to interact with fence syncs. A fence sync is an object that the + * client can insert into the GPU command stream, and then at any future time, wait until all + * commands that were issued before the fence have completed. + */ +class SkGpuFenceSync { +public: + virtual SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const = 0; + virtual bool flushAndWaitFence(SkPlatformGpuFence) const = 0; + virtual void deleteFence(SkPlatformGpuFence) const = 0; + + virtual ~SkGpuFenceSync() {} +}; + +#endif |