]> git.cworth.org Git - apitrace/blobdiff - glws_egl_xlib.cpp
snapdiff: Add filename column to HTML report
[apitrace] / glws_egl_xlib.cpp
index 211cb62b3b7eecbf4c88427fb1545550adb0237d..66557815017fda939a5edc4e622b84c7e0ee7459 100644 (file)
@@ -137,7 +137,7 @@ public:
         eglWaitNative(EGL_CORE_NATIVE_ENGINE);
 
         EGLConfig config = static_cast<const EglVisual *>(visual)->config;
-        surface = eglCreateWindowSurface(eglDisplay, config, window, NULL);
+        surface = eglCreateWindowSurface(eglDisplay, config, (EGLNativeWindowType)window, NULL);
     }
 
     void waitForEvent(int type) {
@@ -150,7 +150,9 @@ public:
 
     ~EglDrawable() {
         eglDestroySurface(eglDisplay, surface);
+        eglWaitClient();
         XDestroyWindow(display, window);
+        eglWaitNative(EGL_CORE_NATIVE_ENGINE);
     }
 
     void
@@ -245,7 +247,7 @@ init(void) {
 
     screen = DefaultScreen(display);
 
-    eglDisplay = eglGetDisplay(display);
+    eglDisplay = eglGetDisplay((EGLNativeDisplayType)display);
     if (eglDisplay == EGL_NO_DISPLAY) {
         std::cerr << "error: unable to get EGL display\n";
         XCloseDisplay(display);
@@ -270,17 +272,50 @@ cleanup(void) {
 }
 
 Visual *
-createVisual(bool doubleBuffer) {
+createVisual(bool doubleBuffer, Profile profile) {
     EglVisual *visual = new EglVisual();
     // possible combinations
-    const EGLint api_bits[7] = {
+    const EGLint api_bits_gl[7] = {
         EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
-        EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
         EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT,
         EGL_OPENGL_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_BIT,
+        EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_ES_BIT,
+    };
+    const EGLint api_bits_gles1[7] = {
+        EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT,
         EGL_OPENGL_ES_BIT,
+        EGL_OPENGL_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_BIT,
         EGL_OPENGL_ES2_BIT,
+    };
+    const EGLint api_bits_gles2[7] = {
+        EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_BIT | EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_ES2_BIT,
+        EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT,
         EGL_OPENGL_BIT,
+        EGL_OPENGL_ES_BIT,
+    };
+    const EGLint *api_bits;
+
+    switch(profile) {
+    case PROFILE_COMPAT:
+        api_bits = api_bits_gl;
+        break;
+    case PROFILE_ES1:
+        api_bits = api_bits_gles1;
+        break;
+    case PROFILE_ES2:
+        api_bits = api_bits_gles2;
+        break;
+    default:
+        return NULL;
     };
 
     for (int i = 0; i < 7; i++) {
@@ -339,15 +374,20 @@ createContext(const Visual *_visual, Context *shareContext, Profile profile)
         load("libGL.so.1");
         eglBindAPI(EGL_OPENGL_API);
         break;
+    case PROFILE_CORE:
+        assert(0);
+        return NULL;
     case PROFILE_ES1:
         load("libGLESv1_CM.so.1");
         eglBindAPI(EGL_OPENGL_ES_API);
         break;
     case PROFILE_ES2:
-        load("libGLESv2.so.1");
+        load("libGLESv2.so.2");
         eglBindAPI(EGL_OPENGL_ES_API);
         attribs.add(EGL_CONTEXT_CLIENT_VERSION, 2);
         break;
+    default:
+        return NULL;
     }
 
     attribs.end(EGL_NONE);