Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
BackendSemaphore.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
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 skgpu_graphite_BackendSemaphore_DEFINED
9#define skgpu_graphite_BackendSemaphore_DEFINED
10
13
14#ifdef SK_METAL
16#endif
17
18#ifdef SK_VULKAN
20#endif
21
22namespace skgpu::graphite {
23
25public:
27#ifdef SK_METAL
28 // TODO: Determine creator's responsibility for setting refcnt.
29 BackendSemaphore(CFTypeRef mtlEvent, uint64_t value);
30#endif
31
32#ifdef SK_VULKAN
33 BackendSemaphore(VkSemaphore semaphore);
34#endif
35
37
39
40 BackendSemaphore& operator=(const BackendSemaphore&);
41
42 bool isValid() const { return fIsValid; }
43 BackendApi backend() const { return fBackend; }
44
45#ifdef SK_METAL
46 CFTypeRef getMtlEvent() const;
47 uint64_t getMtlValue() const;
48#endif
49
50#ifdef SK_VULKAN
51 VkSemaphore getVkSemaphore() const;
52#endif
53
54private:
55 // TODO: For now, implement as a union until we figure out the plan for this and BackendTexture.
56 union {
57#ifdef SK_DAWN
58 // TODO: WebGPU doesn't seem to have the notion of an Event or Semaphore
59#endif
60#ifdef SK_METAL
61 struct {
62 CFTypeRef fMtlEvent; // Expected to be an id<MTLEvent>
63 uint64_t fMtlValue;
64 };
65#endif
66#ifdef SK_VULKAN
67 VkSemaphore fVkSemaphore;
68#endif
70 };
71 bool fIsValid = false;
72 BackendApi fBackend;
73};
74
75} // namespace skgpu::graphite
76
77#endif // skgpu_graphite_BackendSemaphore_DEFINED
78
#define SK_API
Definition SkAPI.h:35
BackendApi
Definition GpuTypes.h:22