<div dir="ltr">Thank you very much, Pekka.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter., 30 de abr. de 2024 às 11:39, Pekka Paalanen <<a href="mailto:pekka.paalanen@haloniitty.fi">pekka.paalanen@haloniitty.fi</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 30 Apr 2024 09:58:32 -0300<br>
Thiago Milczarek Sayão <<a href="mailto:thiago.sayao@gmail.com" target="_blank">thiago.sayao@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
> <br>
> I'm looking the docs at<br>
> <a href="https://registry.khronos.org/EGL/sdk/docs/man/html/eglGetDisplay.xhtml" rel="noreferrer" target="_blank">https://registry.khronos.org/EGL/sdk/docs/man/html/eglGetDisplay.xhtml</a><br>
> <br>
> But I'm still in doubt how it actually works, especially on Mesa.<br>
> <br>
> Will it detect which platform it's on if I pass EGL_DEFAULT_DISPLAY ? For<br>
> example, if I want to use the same code for Wayland and X11.<br>
<br>
I think Mesa EGL will first look at environment variable EGL_PLATFORM<br>
for a hard-override of the chosen platform. Otherwise, it tries to<br>
detect a platform from the native display passed in, which<br>
EGL_DEFAULT_DISPLAY does not provide. Finally there is a build-time<br>
chosen fallback.<br>
<br>
eglGetDisplay itself is a bit problematic since it was not intended to<br>
support choosing the platform at runtime (only at EGL implementation<br>
build time). New code would be better using eglGetPlatformDisplay(EXT)<br>
if at all possible, especially when you want it to work on multiple<br>
platforms, or just to be safe that EGL does not guess wrong what kind<br>
of native display you are passing in. Guessing it wrong would cause<br>
nonsensical errors or crashes. This is also why using EGL_PLATFORM<br>
environment variable is not a good idea.<br>
<br>
FWIW, on Wayland, EGL_DEFAULT_DISPLAY will not allow you to render into<br>
a window. It would open a new Wayland connection, but your application<br>
windows are created through a connection you made yourself, so EGL<br>
would not be able to target your windows. Each wl_surface is private to<br>
the connection where it was created.<br>
<br>
<br>
Thanks,<br>
pq<br>
</blockquote></div>