Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrMtlSemaphore.mm
Go to the documentation of this file.
1/*
2 * Copyright 2019 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
9
12
13#if !__has_feature(objc_arc)
14#error This file must be compiled with Arc. Use -fobjc-arc flag
15#endif
16
17GR_NORETAIN_BEGIN
18
20 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
21 id<MTLEvent> event = [gpu->device() newEvent];
23 } else {
24 return nullptr;
25 }
26}
27
29 // The GrMtlEvent will have strong ownership at this point.
30 // The GrMTLHandle will subsequently only have weak ownership.
31 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
32 id<MTLEvent> mtlEvent = (__bridge_transfer id<MTLEvent>)event;
34 } else {
35 return nullptr;
36 }
37}
38
41 // The GrMtlSemaphore and the GrBackendSemaphore will have strong ownership at this point.
42 // Whoever uses the GrBackendSemaphore will subsquently steal this ref (see MakeWrapped, above).
43 if (@available(macOS 10.14, iOS 12.0, tvOS 12.0, *)) {
44 GrMTLHandle handle = (__bridge_retained GrMTLHandle)(fEvent->mtlEvent());
46 }
47 return backendSemaphore;
48}
49
50GR_NORETAIN_END
const void * GrMTLHandle
Definition GrMtlTypes.h:20
id< MTLEvent > mtlEvent() const SK_API_AVAILABLE(macos(10.14)
static sk_sp< GrMtlEvent > Make(GrMtlGpu *gpu)
static sk_sp< GrMtlEvent > MakeWrapped(GrMTLHandle event)
id< MTLDevice > device() const
Definition GrMtlGpu.h:49
GrBackendSemaphore backendSemaphore() const override
FlKeyEvent * event
SK_API GrBackendSemaphore MakeMtl(GrMTLHandle event, uint64_t value)