mirrored from https://chromium.googlesource.com/angle/angle
-
Notifications
You must be signed in to change notification settings - Fork 620
/
EGL_ANGLE_metal_shared_event_sync.txt
158 lines (109 loc) · 5.28 KB
/
EGL_ANGLE_metal_shared_event_sync.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Name
ANGLE_metal_shared_event_sync
Name Strings
EGL_ANGLE_metal_shared_event_sync
Contributors
Dan Glastonbury, Apple
Contacts
Dan Glastonbury, Apple (djg 'at' apple.com)
Status
Draft
Version
Version 2, 2022-09-08
Number
EGL Extensions XXX
Extension Type
EGL display extension
Dependencies
This extension is written against the wording of the EGL 1.5
Specification.
Overview
This extension enables the creation of EGL fence sync objects that are
associated with a native Metal event object. The EGL fence sync objects
have nearly identical semantics to those sync objects defined by the
EGL 1.5 Specification, except that they have an additional attribute
storing the id<MTLSharedEvent> referring to the metal event object and
the integer value to signal the event with.
New Types
None.
New Procedures and Functions
void* eglCopyMetalSharedEventANGLE(
EGLDisplay dpy,
EGLSync sync);
New Tokens
Accepted by the <type> parameter of eglCreateSync, and returned
in <value> when eglGetSyncAttrib is called with <attribute>
EGL_SYNC_TYPE:
EGL_SYNC_METAL_SHARED_EVENT_ANGLE 0x34D8
Accepted by the <attrib_list> parameter of eglCreateSync:
EGL_SYNC_METAL_SHARED_EVENT_OBJECT_ANGLE 0x34D9
EGL_SYNC_METAL_SHARED_EVENT_SIGNAL_VALUE_LO_ANGLE 0x34DA
EGL_SYNC_METAL_SHARED_EVENT_SIGNAL_VALUE_HI_ANGLE 0x34DB
EGL_SYNC_METAL_SHARED_EVENT_SIGNALED_ANGLE 0x34DC
Additions to the EGL Specification
Add the following after the first paragraph of Section 3.8.1.1 (Creating
Fence Sync Objects),
"If <type> is EGL_SYNC_METAL_SHARED_EVENT_ANGLE, an EGL metal event sync
object is created. In this case the
EGL_SYNC_METAL_SHARED_EVENT_OBJECT_ANGLE,
EGL_SYNC_METAL_SHARED_EVENT_SIGNAL_VALUE_LO_ANGLE,
EGL_SYNC_METAL_SHARED_EVENT_SIGNAL_VALUE_HI_ANGLE, and
EGL_SYNC_CONDITION may be specified.
If EGL_SYNC_METAL_SHARED_EVENT_OBJECT_ANGLE attribute is specified, it must
be set to a pointer to a valid id<MTLSharedEvent>, or to a NULL pointer. If
EGL_SYNC_METAL_SHARED_EVENT_OBJECT_ANGLE is not specified, or is a NULL
pointer, the EGL implementation will create a Metal event
object. Additionally, the EGL implementation assumes ownership of the Metal
event object and will follow Objective-C behavior and increase the Metal
event object's retain count.
EGL_SYNC_METAL_SHARED_EVENT_SIGNAL_VALUE_LO_ANGLE and
EGL_SYNC_METAL_SHARED_EVENT_HI_ANGLE are optional attributes specifying the
low and high 32-bit parts of an unsigned 64-bit value to be set when the
event is signaled. If these attributes are unspecified, the event is
signaled with one more than the event's signaledValue property at the time
of EGLSync creation. The signal value will wrap to 0 if the initial
signaledValue is the maximum value for uint64_t.
If EGL_SYNC_CONDITION attribute is specified, it must be either
EGL_SYNC_PRIOR_COMMANDS_COMPLETE or EGL_SYNC_METAL_SHARED_EVENT_SIGNALED_ANGLE.
The EGL_SYNC_METAL_SHARED_EVENT_SIGNALED_ANGLE condition is satisfied by the
signaling of the MTLSharedEvent referred to by the
EGL_SYNC_METAL_SHARED_EVENT_OBJECT_ANGLE attribute. When this happens any
eglClientWaitSync commands blocking on <sync> unblock.
The default values for the EGL metal event sync object attributes are as
follows:
Attribute Name Initial Attribute Value(s)
-------------- --------------------------
EGL_SYNC_TYPE EGL_SYNC_METAL_SHARED_EVENT_ANGLE
EGL_SYNC_STATUS EGL_UNSIGNALED
EGL_SYNC_CONDITION EGL_SYNC_PRIOR_COMMANDS_COMPLETE
Modify the list of eglCreateSync errors in Section 3.8.1.2 (Creating OpenCL
Event Sync Objects)
"Errors
------
..."
Modify the second paragraph of Section 3.8.1.1 (Creating Fence Sync Objects),
When a fence sync object is created or when an EGL metal shared event sync
object is created with the EGL_SYNC_CONDITION attribute set to
EGL_SYNC_PRIOR_COMMANDS_COMPLETE, eglCreateSync also inserts a fence command
into the command stream of the bound client API’s current context (i.e., the
context returned by eglGetCurrentContext), and associates it with the newly
created sync object.
Add the following after the last paragraph of Section 3.8.1 (Sync Objects):
"The command
void* eglCopyMetalSharedEventANGLE(
EGLDisplay dpy,
EGLSync sync);
increases the retain count of the id<MTLSharedEvent> stored in the
EGL_SYNC_METAL_SHARED_EVENT_OBJECT_ANGLE attribute of an EGL metal shared
event sync object and returns a pointer to the event as a void* pointer. If
this returns a non-null value, the caller is responsible for releasing the
MTLSharedEvent once after calling this function."
Issues
1. What should the name be? METAL_EVENT_ANGLE? MTL or METAL?
Revision History
Version 1, 2022-05-17
- Initial draft
Version 2, 2022-09-08
- Add eglCopyMetalSharedEventANGLE function
Version 3, 2023-03-06
- Add EGL_SYNC_METAL_SHARED_EVENT_SIGNALED_ANGLE