ANGLE in Android Studio

513 views
Skip to first unread message

Артём Мартынович

unread,
Sep 30, 2017, 2:53:58 AM9/30/17
to angleproject
Recently Android Studio got an update with support of ANGLE as rendering backend. ANGLE is not thread-safe, that's what people say here in this group. However, version of ANGLE shipped with Android Studio is thread-safe, I've tested it myself. My only concern is that the commit hash embedded into the library version is not in ANGLE repo. It is currently b02bd4976a1d, and I couldn't find it anywhere. Also, this library uses D3D11 and D3D9 at the same time.

Can anybody give me some hints about this? Is this purely proprietary code, or is it some code from another repo?

Excuse me if I'm asking this in the wrong group, I just don't know where else to ask.

Geoff Lang

unread,
Oct 2, 2017, 10:20:07 AM10/2/17
to artem.ma...@gmail.com, angleproject
They likely have some patches on top of ANGLE to make integration easier.  As far as I know, they achieve thread-safety by adding locks around some GL and EGL calls, not by modifying ANGLE.

--
You received this message because you are subscribed to the Google Groups "angleproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Артём Мартынович

unread,
Oct 5, 2017, 1:02:27 PM10/5/17
to angleproject
You're right about integration, but their version of ANGLE is obviously modified further, because it is thread-safe itself, it doesn't need locks around EGL/GLES calls. The "original" ANGLE won't work properly even if you put a lock around every EGL/GLES call.
I found this repo: https://android.googlesource.com/platform/external/angle/ but seems like it doesn't have latest commits.

понедельник, 2 октября 2017 г., 20:20:07 UTC+6 пользователь Geoff Lang написал:

Geoff Lang

unread,
Oct 5, 2017, 1:12:39 PM10/5/17
to artem.ma...@gmail.com, angleproject
My mistake, the thread-safety is added in this commit: https://android.googlesource.com/platform/external/angle/+/52bc44fb2be0a2d23891eadf12ba1b55d8b15f47.   When we implement this feature in the main ANGLE repository, we will not be implementing it this way due the performance overhead of locking on most GL/EGL calls.

Артём Мартынович

unread,
Oct 5, 2017, 1:36:14 PM10/5/17
to angleproject
Oh, I see, it's the EVENT macro which adds scoped locks. Thank you so much for pointing this out! I can't build this branch because latest gclient throws exceptions, but hopefully I'll find a way.
I tried locking around every EGL/GLES call using latest ANGLE from stable branch, but still got errors from D3D11 concerning multithreading. Perhaps I was doing it wrong.

четверг, 5 октября 2017 г., 23:12:39 UTC+6 пользователь Geoff Lang написал:

Артём Мартынович

unread,
Oct 6, 2017, 2:52:33 PM10/6/17
to angleproject
Also, could you give me an idea of how you're going to implement this in the main repo then?

четверг, 5 октября 2017 г., 23:12:39 UTC+6 пользователь Geoff Lang написал:

Geoff Lang

unread,
Oct 10, 2017, 10:16:42 AM10/10/17
to artem.ma...@gmail.com, angleproject
To not use locks around our usage of the backend APIs, we will need to use the backend API's multithreading features.  This means using deferred D3D11 contexts or multiple OpenGL contexts.  It's not going to be a simple fix and I don't have more details right now unfortunately.
Reply all
Reply to author
Forward
0 new messages