From 0f3d2d6d09310b144c829144ab855699534b815c Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sat, 28 Oct 2023 11:31:59 +0200 Subject: [PATCH] examples/glupload: Sanity-check that the EGL display via Wayland equals glutin Part-of: --- examples/src/glupload.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index 1221ae9ec..3f8776ead 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -360,13 +360,27 @@ impl App { #[cfg(feature = "gst-gl-wayland")] if let Some(display) = inner_window.wayland_display() { - gl_display = Some( + let gl_display = gl_display.insert( unsafe { gst_gl_wayland::GLDisplayWayland::with_display(display as usize) } .unwrap() .upcast::(), - ) + ); + + // If using a Wayland display, resolving that to an EGL display _should_ + // result in the same handle that glutin found (both via eglGetPlatformDisplay(EXT)()). + #[cfg(feature = "gst-gl-egl")] + { + let gl_display = + gst_gl_egl::GLDisplayEGL::from_gl_display(gl_display).unwrap(); + assert_eq!( + unsafe { windowed_context.get_egl_display() } + .expect("Wayland clients use EGL"), + gl_display.handle() as *const std::ffi::c_void, + "GLDisplayWayland must use the same EGLDisplay as glutin!" + ); + } }; (