revery-ui / revery

:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
https://www.outrunlabs.com/revery/
MIT License
8.06k stars 196 forks source link

feat(windows): ANGLE support #983

Closed bryphe closed 4 years ago

bryphe commented 4 years ago

On Windows, Direct3D is much better supported than OpenGL - it's often the case where Direct3D is available, but OpenGL isn't (for example - on VMs). In addition, the driver support tends to be for Direct3D on Windows.

Google built a library called ANGLE which provides an OpenGL ES API backed by Direct3D (It's used by Chrome as well to back WebGL).

This brings in ANGLE to be used as the renderer back-end for Revery and Skia. It requires bringing in libEGL.dll and libGLESV2.dll, and then setting up SDL to render to an OpenGL ES context.

Switching to ANGLE will likely fix several issues running Onivim 2 on Windows w/o up-to-date OpenGL drivers:

(at least, enough to get the app visible & running - I can run Onivim 2 and the revery sample app on a Windows 10 VM w/ this change!)

Et7f3 commented 4 years ago

Skia already build angle on windows can't we copy this library ?

bryphe commented 4 years ago

@Et7f3 - hmm, good point! Let me see if the dlls are available - we could move the build step to esy-skia instead of adding a new dependency.

bryphe commented 4 years ago

@Et7f3 - I built esy-skia - (with and without skia_use_angle) - but didn't see the actual libEGL.dll or libGLESV2.dll produced in the build output. Do you know where they would be?

Et7f3 commented 4 years ago

I definitely see that it is created maybe we should need to tweak the ninja command https://github.com/google/skia/blob/52a4379f03f7cd4e1c67eb69a756abc5838a658f/third_party/angle2/BUILD.gn#L89

I would simply launch dir /s/b | findstr dll after launching esy.

edit: only the .lib exist so not enough. So just not enough. sorry

bryphe commented 4 years ago

Interesting, ya, I wasn't able to find it either:

D:\esy-skia>dir /s/b | findstr \.dll
D:\esy-skia\_esy\default\store\b\esy_skia-6e452493\third_party\externals\icu\windows\icudt.dll
D:\esy-skia\_esy\default\store\b\esy_skia-a137d801\out\Shared\skia.dll
D:\esy-skia\_esy\default\store\b\esy_skia-a137d801\third_party\externals\icu\windows\icudt.dll

It seems like we should be able to get it from here - but I'll hold off for now (the pull-from-electron approach in esy-angle-prebuilt is certainly awkward... but it seems to work OK!) Open to improving this for sure, though. 👍