metal: Synchronize imported IOSurfaces with command buffer We want to skip the various Metal waitUntilScheduled calls in Chromium on single GPU systems and use only shared events for synchronization. However, this doesn't work correctly today because ANGLE can do CPU readbacks from the IOSurface without synchronizing with the command buffer which contains the shared event wait. This is because ANGLE doesn't know about the dependency between the IOSurface texture and the shared event wait in the command buffer. This CL makes BindTexImage mark the IOSurface texture as used so that we wait for command buffer execution if we do a CPU readback. It reuses the setWriteDependency mechanism on mtl::CommandBuffer. Bug: chromium:40273077 Change-Id: I5d480f2c28abbd6d36cf1e1045461c84b3e4a1f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6514098 Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>