[Mesa-dev] [RFC 7/7] eglplatform.h: remove buggy/fragile autodetection

Emil Velikov emil.l.velikov at gmail.com
Thu Sep 22 08:38:12 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

With the previous EGL_USE_PLATFORM_*_KHR in place one no longer needs
any of this fragile and somewhat buggy heuristics.

Users are responsible for requesting their preferred platform, with
adding a default to none/native types.
---

XXX: Similar to previous patch - something we want in the long term,
although I'm not sure if at all/when it will be possible.
---
 include/EGL/eglplatform.h | 43 +++----------------------------------------
 1 file changed, 3 insertions(+), 40 deletions(-)

diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index 9ad874b..ba95184 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -133,48 +133,11 @@ typedef Pixmap   EGLNativePixmapType;
 typedef Window   EGLNativeWindowType;
 
 #else
-#warning "No known EGL_USE_PLATFORM_*_KHR is provided."
 
-/* 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
-#endif
-#include <windows.h>
-
-typedef HDC     EGLNativeDisplayType;
-typedef HBITMAP EGLNativePixmapType;
-typedef HWND    EGLNativeWindowType;
-
-#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
-
-typedef int   EGLNativeDisplayType;
-typedef void *EGLNativeWindowType;
-typedef void *EGLNativePixmapType;
-
-#elif defined(__ANDROID__) || defined(ANDROID)
-
-#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(__unix__)
-
-/* X11 (tentative)  */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap   EGLNativePixmapType;
-typedef Window   EGLNativeWindowType;
+typedef void            *EGLNativeDisplayType;
+typedef khronos_uintptr_t EGLNativePixmapType;
+typedef khronos_uintptr_t EGLNativeWindowType;
 
-#else
-#error "Platform not recognized"
 #endif
 
 /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
-- 
2.9.3



More information about the mesa-dev mailing list