diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2012-10-08 00:13:09 +0300 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-10-17 12:44:20 -0700 |
commit | aedc5f0a0f128ad18a47d238c34cb603b817506a (patch) | |
tree | 8806b50549ea73d4f8e0f9b84cbd235e136e4a1d | |
parent | d2666c274aeecf59e9ed522a93dd19b882467e8e (diff) |
Relax the implementation of eglGetDisplay function to always return the Emscripten EGLDisplay handle. This allows EGL-using GLES2-related tests to pass, they expect to utilize eglGetDisplay as if running on X11.
-rw-r--r-- | src/library_egl.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/library_egl.js b/src/library_egl.js index db3acf77..62a6ce67 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -38,10 +38,17 @@ var LibraryEGL = { // EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); eglGetDisplay: function(nativeDisplayType) { EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); - if (nativeDisplayType == 0 /* EGL_DEFAULT_DISPLAY */) - return 62000; // Magic ID for Emscripten 'default display' - else - return 0; // EGL_NO_DISPLAY + // Note: As a 'conformant' implementation of EGL, we would prefer to init here only if the user + // calls this function with EGL_DEFAULT_DISPLAY. Other display IDs would be preferred to be unsupported + // and EGL_NO_DISPLAY returned. Uncomment the following code lines to do this. + // Instead, an alternative route has been preferred, namely that the Emscripten EGL implementation + // "emulates" X11, and eglGetDisplay is expected to accept/receive a pointer to an X11 Display object. + // Therefore, be lax and allow anything to be passed in, and return the magic handle to our default EGLDisplay object. + +// if (nativeDisplayType == 0 /* EGL_DEFAULT_DISPLAY */) + return 62000; // Magic ID for Emscripten 'default display' +// else +// return 0; // EGL_NO_DISPLAY }, // EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); |