Fix delegating eglCreateWindowSurface to CreatePlatformWindowSurface Only with X11 does eglCreatePlatformWindowSurface take a pointer to a window handle instead of a handle value directly. Since eglCreateWindowSurface delegates to CreatePlatformWindowSurface, it must take the address of the window handle. Bug: b/168821209 Change-Id: I69c7bf3315a871c2cd806a736fd73606cac34ad2 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/48789 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: Nicolas Caramelli <caramelli.devel@gmail.com>
diff --git a/src/OpenGL/libEGL/libEGL.cpp b/src/OpenGL/libEGL/libEGL.cpp index ce2fe96..b0eeddc 100644 --- a/src/OpenGL/libEGL/libEGL.cpp +++ b/src/OpenGL/libEGL/libEGL.cpp
@@ -361,9 +361,9 @@ return EGL_NO_SURFACE; } -#if defined(USE_X11) - native_window = (void *)(*(::Window*)native_window); -#endif + #if defined(USE_X11) + native_window = (void *)(*(::Window*)native_window); + #endif if(!display->isValidWindow((EGLNativeWindowType)native_window)) { @@ -388,7 +388,12 @@ "const EGLint *attrib_list = %p)", dpy, config, window, attrib_list); EGLAttribs attribs(attrib_list); - return CreatePlatformWindowSurface(dpy, config, (void*)window, &attribs); + + #if defined(USE_X11) + return CreatePlatformWindowSurface(dpy, config, (void*)&window, &attribs); + #else + return CreatePlatformWindowSurface(dpy, config, (void*)window, &attribs); + #endif } EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)