blob: 4fe724a15b3cd0500574fbdd65b28a11848a2760 [file] [log] [blame]
csmartdalton421a3c12016-10-04 11:08:45 -07001/*
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
8#ifndef FenceSync_DEFINED
9#define FenceSync_DEFINED
10
11#include "SkTypes.h"
12
13namespace sk_gpu_test {
14
csmartdalton024229a2016-10-04 14:24:23 -070015using PlatformFence = uint64_t;
csmartdaltonc6618dd2016-10-05 08:42:03 -070016static constexpr PlatformFence kInvalidFence = 0;
csmartdalton421a3c12016-10-04 11:08:45 -070017
18/*
19 * This class provides an interface to interact with fence syncs. A fence sync is an object that the
20 * client can insert into the GPU command stream, and then at any future time, wait until all
21 * commands that were issued before the fence have completed.
22 */
23class FenceSync {
24public:
25 virtual PlatformFence SK_WARN_UNUSED_RESULT insertFence() const = 0;
26 virtual bool waitFence(PlatformFence) const = 0;
27 virtual void deleteFence(PlatformFence) const = 0;
28
Brian Osman5fbd1832017-10-10 16:39:50 -040029 virtual bool validate() const { return true; }
30
csmartdalton421a3c12016-10-04 11:08:45 -070031 virtual ~FenceSync() {}
32};
33
csmartdaltonc6618dd2016-10-05 08:42:03 -070034} // namespace sk_gpu_test
csmartdalton421a3c12016-10-04 11:08:45 -070035
36#endif