Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glutin version 0.32.1 #1697

Merged
merged 10 commits into from
Sep 11, 2024
Merged

Glutin version 0.32.1 #1697

merged 10 commits into from
Sep 11, 2024

Conversation

kchibisov
Copy link
Member

No description provided.

MarijnS95 and others added 10 commits September 10, 2024 18:38
When testing the `glutin` example on Android, after suspending and
resuming the app no triangle appears.  As it turns out the `winit 0.30`
bump in #1678 never reuses the `not_current_context` that was set apart
in `suspend()`, but creates a new one, without re-running initialization
code such as creating the `Renderer`.

Partially restore original code before the `winit 0.30` bump, which
never created a context in `resume()` because it was already available
before the loop started (and moved back in place in `suspend()`). Note
also that more initialization code that now (unnecessarily) lives in
`resume()` used to be outside of the loop.
The previous test would mistakenly return an error if the extensions
contain "EGL_EXT_device_base" but not the two others. As stated by the
comment, and in EGL_EXT_device_base specification it is supposed to
contain the other two.

The cases that should not return an error are:

  contains EGL_EXT_device_base (B)
  contains both EGL_EXT_device_enumeration (E) and EGL_EXT_device_query (Q)

The overall effects of this patch in terms of those three extensions are:

  !B &  E & !Q leads to a different error message than before
   B & !E & !Q no longer errors
  !B &  E &  Q no longer errors
Change the calling convention of the `EglGetProcAddress` declaration to `extern "system"`
to automatically use the correct calling convention for the platform.
…EXT`

By casting a `null_mut()` ptr and passing it directly _by value_ to
`QueryDisplayAttribEXT()`, the function ignores writing the output as
it didn't receive an address (it received `NULL`) to write the device
to.  Instead we should take the _pointer address of this `null_mut()`
pointer_ and provide that to the function instead so that it can
_overwrite_ it with a pointer to the requested `eglDevice`.

This is even more clear when allocating a `MaybeUninit` in which the
pointer will be returned, which has a convenient `.as_mut_ptr()` member
to pass its pointer value directly into `QueryDisplayAttribEXT()`.
It was incorrectly ported that the display was recreated, though, given
that passing the same arguments to it will yield the same results it was
still working as expected.
EGL doesn't differentiate between objects created by different extensions,
and the display version check could be done, after we've created it, so
ensure what display we actually created and use its functions.
This extension (together with the optional
`EGL_EXT_device_drm_render_node` extension) allows querying the DRM
primary and render device node filenames from `EGLDevice`, to help
associating them with DRM devices.

Additionally a platform display _can_ be created with a DRM file
descriptor with master permissions, but this is only useful in
situations where EGL might fail to open a file descriptor itself or will
fail to acquire master permissions (which are only required when the
implementation needs to "modify output attributes": but no behaviour is
defined by this extension that requires this).

This file descriptor will be duplicated by the implementation if it
needs to use it beyond the call to `eglGetPlatformDisplayEXT()`, and
does not need to be kept alive by the caller.

Note that `EGL_EXT_output_drm` is omitted for now, because it relies on
the equally unimplemented `EGL_EXT_output_base` extension.
In particular `wantsBestResolutionOpenGLSurface` and `wantsLayer`.
This is currently done by libraries, like winit, but it's really our job to do this.
@kchibisov kchibisov merged commit 76dac27 into 0.32.x Sep 11, 2024
43 checks passed
@kchibisov kchibisov deleted the glutin-0321 branch September 11, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants