rust-windowing / glutin

A low-level library for OpenGL context creation
Apache License 2.0
2k stars 478 forks source link

Why is FallbackEgl the default instead of PreferEgl? #1719

Open e00E opened 6 days ago

e00E commented 6 days ago

In glutin-winit the default ApiPreference is FallbackEgl. This choice should be justified with a comment. Why is not PreferEgl so that by default we pick EGL over GLX and WGL?

kchibisov commented 6 days ago

If you want to learn more, you can click on DisplayApiPreference link and see for yourself.

If you have suggestions what should be there let me know, but generally, EGL is not broadly present on Windows, had long standing bugs on X11, and only worked ok on Wayland.

Also, if you want EGL for its specific features you just use glutin directly at this point.

e00E commented 6 days ago

I have read DisplayApiPreference. That documentation says the following:

But despite this issues it should be preferred on at least Linux over GLX, given that GLX is phasing away.

This means that on Linux, the default for FallbackEgl disagrees with this comment.

EGL is not broadly present on Windows

This is fine. If the default is PreferEgl, then glutin-winit will still use WGL if Egl is not available.

So I feel that on both Windows and Linux, the default PreferEgl makes more sense.

(I say this purely based on what I read in glutin. I haven't tested EGL, WGL, GLX.)

e00E commented 6 days ago

I'm not so much trying to change what the default is, but making sure that the choice is properly documented. At the moment this isn't the case.

kchibisov commented 6 days ago

The issue is:

  1. Up until a months ago, transparency on EGL on X11 was not working at all. For years.
  2. EGL on windows is not great, most drivers don't ship it, and can get the default impl of EGL which may be not great as well.

Like if you know what you want, you can change default, but platform specific over cross platform default should make more sense, even though, platform specific is meh.

GLX is obsolete because of Xorg being it.

e00E commented 6 days ago

Thanks for explaining it more!

I still feel what you say here does not match the comment on DisplayApiPreference. That comment explicitly says that on Linux you should prefer egl over glx. Here you say the opposite. And the comment is missing some information you have added here.

It's up to you if and how you want to change that comment. Feel free to close the issue if you feel it's fine.

kchibisov commented 6 days ago

If you don't care about transparency of your window on Linux, you should pick EGL, if you don't care, you should pick EGL.

EGL is better, but it GLX didn't had a bug with transparency, so it was used as a default, so you get things more or less working consistently.