Hash :
3226cce3
Author :
Date :
2022-11-02T16:02:46
Update EGL_ANGLE_metal_shared_event_sync implementation. Rename the extension's .txt file to match the current name of the extension. Update function signatures to take EGLSync rather than EGLSyncKHR. The two types are conceptually incompatible. This extension requires the use of eglCreateSync rather than eglCreateSyncKHR because the latter takes an array of EGLInt, but EGLAttrib is needed to express pointers (to MTLSharedEvents) in the attribute list. Revise ContextMtl::flush to use WaitUntilScheduled on older operating systems not supporting MTLSharedEvent. Bug: angleproject:7809 Change-Id: I39197616dc3e1e7ec6dc68dd83b4fde05184debf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4000941 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kenneth Russell <kbr@chromium.org>
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
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 0x34DA
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, and
EGL_SYNC_METAL_SHARED_EVENT_SIGNAL_VALUE_HI_ANGLE 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.
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
------
..."
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