From: Emil Velikov <>

In order to avoid the current, somewhat fragile detection in
eglplatform.h introduce explicit platform selection.

The approach is based on the one used in Vulkan and allows one to
explicitly "request" the platform they will be using without the need of
local hacks.

XXX: Strictly speaking the default/else case would be the None/native
one, but since we still have the "autodetection" heuristics...

Admittedly some of the names can be improved, plus there's a limited
about of Symbian users still in the wild. The latter kept for
compatibility reasons.
 include/EGL/eglplatform.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index b376e64..923b5f6 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -67,6 +67,62 @@
  * implementations.
+#include <android/native_window.h>
+struct egl_native_pixmap_t;
+typedef struct ANativeWindow*           EGLNativeWindowType;
+typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
+typedef void*                           EGLNativeDisplayType;
+#elif defined(EGL_USE_PLATFORM_GBM_KHR) // XXX: Name GBM vs DRM vs other
+typedef struct gbm_device  *EGLNativeDisplayType;
+typedef struct gbm_bo      *EGLNativePixmapType;
+typedef void               *EGLNativeWindowType;
+#elif defined(EGL_USE_PLATFORM_NONE_KHR) // XXX: Name NONE vs Native vs other
+typedef void            *EGLNativeDisplayType;
+typedef khronos_uintptr_t EGLNativePixmapType;
+typedef khronos_uintptr_t EGLNativeWindowType;
+typedef int   EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+typedef struct wl_display     *EGLNativeDisplayType;
+typedef struct wl_egl_pixmap  *EGLNativePixmapType;
+typedef struct wl_egl_window  *EGLNativeWindowType;
+#elif defined(EGL_USE_PLATFORM_WIN32_KHR)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+typedef HDC     EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+typedef HWND    EGLNativeWindowType;
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap   EGLNativePixmapType;
+typedef Window   EGLNativeWindowType;
+/* Fallback to autodetection of the current platform */
 #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && 
!defined(__SCITECH_SNAP__) /* Win32 and WinCE */
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN 1

mesa-dev mailing list

Reply via email to