Flutter Engine
The Flutter Engine
third_party
skia
src
gpu
ganesh
mtl
GrMtlBackendSemaphore.mm
Go to the documentation of this file.
1
/*
2
* Copyright 2024 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
#include "
include/gpu/ganesh/mtl/GrMtlBackendSemaphore.h
"
8
9
#include "
include/gpu/GrTypes.h
"
10
#include "
include/private/base/SkAssert.h
"
11
#include "
src/gpu/ganesh/GrBackendSemaphorePriv.h
"
12
13
#if !__has_feature(objc_arc)
14
#error This file must be compiled with Arc. Use -fobjc-arc flag
15
#endif
16
17
class
GrMtlBackendSemaphoreData
final :
public
GrBackendSemaphoreData
{
18
public
:
19
GrMtlBackendSemaphoreData
(
GrMTLHandle
event
, uint64_t
value
) : fEvent(
event
), fValue(
value
) {}
20
21
GrMTLHandle
event
()
const
{
return
fEvent; }
22
uint64_t
value
()
const
{
return
fValue; }
23
24
private
:
25
void
copyTo(
AnySemaphoreData
&
data
)
const override
{
26
data
.emplace<
GrMtlBackendSemaphoreData
>(fEvent, fValue);
27
}
28
29
#if defined(SK_DEBUG)
30
GrBackendApi
type
()
const override
{
return
GrBackendApi::kMetal
; }
31
#endif
32
33
GrMTLHandle
fEvent;
34
uint64_t fValue;
35
};
36
37
static
const
GrMtlBackendSemaphoreData
*
get_and_cast_data
(
const
GrBackendSemaphore
& sem) {
38
auto
data
=
GrBackendSemaphorePriv::GetBackendData
(sem);
39
SkASSERT
(!
data
||
data
->type() ==
GrBackendApi::kMetal
);
40
return
static_cast<
const
GrMtlBackendSemaphoreData
*
>
(
data
);
41
}
42
43
namespace
GrBackendSemaphores
{
44
GrBackendSemaphore
MakeMtl
(
GrMTLHandle
event
, uint64_t
value
) {
45
GrMtlBackendSemaphoreData
data
(
event
,
value
);
46
return
GrBackendSemaphorePriv::MakeGrBackendSemaphore
(
GrBackendApi::kMetal
,
data
);
47
}
48
49
GrMTLHandle
GetMtlHandle
(
const
GrBackendSemaphore
& sem) {
50
SkASSERT
(sem.
backend
() ==
GrBackendApi::kMetal
);
51
const
GrMtlBackendSemaphoreData
*
data
=
get_and_cast_data
(sem);
52
SkASSERT
(
data
);
53
return
data
->event();
54
}
55
56
uint64_t
GetMtlValue
(
const
GrBackendSemaphore
& sem) {
57
SkASSERT
(sem.
backend
() ==
GrBackendApi::kMetal
);
58
const
GrMtlBackendSemaphoreData
*
data
=
get_and_cast_data
(sem);
59
SkASSERT
(
data
);
60
return
data
->value();
61
}
62
}
// namespace GrBackendSemaphores
GrBackendSemaphorePriv.h
GrMtlBackendSemaphore.h
get_and_cast_data
static const GrMtlBackendSemaphoreData * get_and_cast_data(const GrBackendSemaphore &sem)
Definition:
GrMtlBackendSemaphore.mm:37
GrMTLHandle
const void * GrMTLHandle
Definition:
GrMtlTypes.h:20
GrTypes.h
GrBackendApi
GrBackendApi
Definition:
GrTypes.h:95
GrBackendApi::kMetal
@ kMetal
SkAssert.h
SkASSERT
#define SkASSERT(cond)
Definition:
SkAssert.h:116
type
GLenum type
Definition:
blit_command_gles.cc:126
GrBackendSemaphoreData
Definition:
GrBackendSemaphorePriv.h:16
GrBackendSemaphoreData::AnySemaphoreData
GrBackendSemaphore::AnySemaphoreData AnySemaphoreData
Definition:
GrBackendSemaphorePriv.h:27
GrBackendSemaphorePriv::GetBackendData
static const GrBackendSemaphoreData * GetBackendData(const GrBackendSemaphore &sem)
Definition:
GrBackendSemaphorePriv.h:42
GrBackendSemaphorePriv::MakeGrBackendSemaphore
static GrBackendSemaphore MakeGrBackendSemaphore(GrBackendApi backend, const SemaphoreData &data)
Definition:
GrBackendSemaphorePriv.h:37
GrBackendSemaphore
Definition:
GrBackendSemaphore.h:26
GrBackendSemaphore::backend
GrBackendApi backend() const
Definition:
GrBackendSemaphore.h:44
GrMtlBackendSemaphoreData
Definition:
GrMtlBackendSemaphore.mm:17
GrMtlBackendSemaphoreData::GrMtlBackendSemaphoreData
GrMtlBackendSemaphoreData(GrMTLHandle event, uint64_t value)
Definition:
GrMtlBackendSemaphore.mm:19
GrMtlBackendSemaphoreData::event
GrMTLHandle event() const
Definition:
GrMtlBackendSemaphore.mm:21
GrMtlBackendSemaphoreData::value
uint64_t value() const
Definition:
GrMtlBackendSemaphore.mm:22
event
FlKeyEvent * event
Definition:
fl_key_channel_responder.cc:118
value
uint8_t value
Definition:
fl_standard_message_codec.cc:36
GrBackendSemaphores
Definition:
GrMtlBackendSemaphore.h:15
GrBackendSemaphores::GetMtlValue
SK_API uint64_t GetMtlValue(const GrBackendSemaphore &)
Definition:
GrMtlBackendSemaphore.mm:56
GrBackendSemaphores::GetMtlHandle
SK_API GrMTLHandle GetMtlHandle(const GrBackendSemaphore &)
Definition:
GrMtlBackendSemaphore.mm:49
GrBackendSemaphores::MakeMtl
SK_API GrBackendSemaphore MakeMtl(GrMTLHandle event, uint64_t value)
Definition:
GrMtlBackendSemaphore.mm:44
data
std::shared_ptr< const fml::Mapping > data
Definition:
texture_gles.cc:63
Generated on Sun Jun 23 2024 21:56:22 for Flutter Engine by
1.9.4