<div dir="ltr"><div class="gmail_extra">The patch so far is looking good. I only suggest to instead define the missing tokens instead of flat out disabling the test when the EGL_KHR_gl_texture_2D_image test fails. This is based on reading over the EGL_KHR_gl_texture_2D_image spec ( located at <a href="http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_gl_image.txt">http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_gl_image.txt</a> )<br>
<br></div><div class="gmail_extra">Although a secondary fix could be to go ahead and push a patch to include an updated eglext.h file since the egl.h file does not change all that often.<br></div><div class="gmail_extra">
<div class="gmail_quote">On Sun, Nov 24, 2013 at 9:09 PM,  <span dir="ltr"><<a href="mailto:christopher.halse.rogers@canonical.com" target="_blank">christopher.halse.rogers@canonical.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Christopher James Halse Rogers <<a href="mailto:raof@ubuntu.com" target="_blank">raof@ubuntu.com</a>><br>


<br>
---<br>
<br>
This looks pretty much right to me, but it may be missing some necessary<br>
flushing - it will occasionally fail on i965, and more frequently on<br>
radeon with my gallium image patch series.<br>
<br>
 tests/egl/CMakeLists.gl.txt  |   2 +<br>
 tests/egl/egl-khr-gl-image.c | 142 +++++++++++++++++++++++++++++++++++++++++++<br>
 2 files changed, 144 insertions(+)<br>
 create mode 100644 tests/egl/egl-khr-gl-image.c<br>
<br>
diff --git a/tests/egl/CMakeLists.gl.txt b/tests/egl/CMakeLists.gl.txt<br>
index 4a2a57c..0115e2c 100644<br>
--- a/tests/egl/CMakeLists.gl.txt<br>
+++ b/tests/egl/CMakeLists.gl.txt<br>
@@ -20,6 +20,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")<br>
        target_link_libraries(egl-create-surface pthread ${X11_X11_LIB})<br>
        piglit_add_executable (egl-query-surface egl-util.c egl-query-surface.c)<br>
        target_link_libraries(egl-query-surface pthread ${X11_X11_LIB})<br>
+       piglit_add_executable (egl-khr-gl-image egl-util.c egl-khr-gl-image.c)<br>
+       target_link_libraries(egl-khr-gl-image pthread ${X11_X11_LIB})<br>
<br>
        add_subdirectory(spec)<br>
 ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")<br>
diff --git a/tests/egl/egl-khr-gl-image.c b/tests/egl/egl-khr-gl-image.c<br>
new file mode 100644<br>
index 0000000..5b0d58e<br>
--- /dev/null<br>
+++ b/tests/egl/egl-khr-gl-image.c<br>
@@ -0,0 +1,142 @@<br>
+/*<br>
+ * Copyright © 2013 Canonical Inc.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ *<br>
+ * Author: Christopher James Halse Rogers <<a href="mailto:christopher.halse.rogers@canonical.com" target="_blank">christopher.halse.rogers@canonical.com</a>><br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+#include "egl-util.h"<br>
+<br>
+#ifdef EGL_KHR_gl_texture_2D_image<br>
+<br>
+const char *extensions[] = { "EGL_KHR_gl_texture_2D_image", NULL };<br>
+<br>
+static enum piglit_result<br>
+draw(struct egl_state *state)<br>
+{<br>
+       float aubergine[] = { 0.46, 0.13, 0.44, 1.0 };<br>
+       float orange[] = { 0.86, 0.28, 0.08, 1.0 };<br>
+       GLuint fb = 0;<br>
+       GLuint exportTex, importTex;<br>
+       EGLImageKHR texImg;<br>
+       PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;<br>
+       PFNGLEGLIMAGETARGETTEXTURE2DOESPROC EGLImageTargetTexture2DOES;<br>
+<br>
+       piglit_require_extension("GL_OES_EGL_image");<br>
+       piglit_require_extension("GL_EXT_framebuffer_object");<br>
+<br>
+       eglCreateImageKHR =<br>
+               (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");<br>
+       EGLImageTargetTexture2DOES =<br>
+               (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress("glEGLImageTargetTexture2DOES");<br>
+<br>
+       /* Allocate render texture */<br>
+       glGenTextures(1, &exportTex);<br>
+<br>
+       glBindTexture(GL_TEXTURE_2D, exportTex);<br>
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br>
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br>
+       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 100, 100, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);<br>
+<br>
+       /* Bind to eglImageOES */<br>
+       texImg = eglCreateImageKHR(state->egl_dpy, state->ctx,<br>
+                                                          EGL_GL_TEXTURE_2D_KHR,<br>
+                                                          (EGLClientBuffer)exportTex,<br>
+                                                          NULL);<br>
+<br>
+       /* Bind EGL image to output texture */<br>
+       glGenTextures(1, &importTex);<br>
+<br>
+       glBindTexture(GL_TEXTURE_2D, importTex);<br>
+       EGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)texImg);<br>
+<br>
+       if (!eglMakeCurrent(state->egl_dpy,<br>
+                                               state->surf, state->surf, state->ctx)) {<br>
+               fprintf(stderr, "eglMakeCurrent() failed\n");<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       glGenFramebuffersEXT(1, &fb);<br>
+       glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);<br>
+<br>
+       glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, exportTex, 0);<br>
+<br>
+       if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) {<br>
+               fprintf(stderr, "FBO incomplete\n");<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       /* Clear render texture to orange */<br>
+       glClearColor(orange[0], orange[1], orange[2], orange[3]);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+       glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);<br>
+<br>
+       glViewport(0, 0, state->width, state->height);<br>
+       piglit_ortho_projection(state->width, state->height, GL_FALSE);<br>
+<br>
+       glClearColor(aubergine[0], aubergine[1], aubergine[2], aubergine[3]);<br>
+       glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+       glEnable(GL_TEXTURE_2D);<br>
+       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);<br>
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br>
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br>
+<br>
+       glBindTexture(GL_TEXTURE_2D, importTex);<br>
+       piglit_draw_rect_tex(20, 20, 100, 100,  0, 0, 1, 1);<br>
+       eglSwapBuffers(state->egl_dpy, state->surf);<br>
+<br>
+       if (!piglit_probe_pixel_rgba(10, 10, aubergine) ||<br>
+               !piglit_probe_pixel_rgba(50, 10, aubergine) ||<br>
+               !piglit_probe_pixel_rgba(10, 50, aubergine) ||<br>
+               !piglit_probe_pixel_rgba(50, 50, orange) ||<br>
+               !piglit_probe_pixel_rgba(110, 110, orange) ||<br>
+               !piglit_probe_pixel_rgba(130, 130, aubergine))<br>
+               return PIGLIT_FAIL;<br>
+<br>
+       return PIGLIT_PASS;<br>
+}<br>
+<br>
+int<br>
+main(int argc, char *argv[])<br>
+{<br>
+       struct egl_test test;<br>
+<br>
+       egl_init_test(&test);<br>
+       test.extensions = extensions;<br>
+       test.draw = draw;<br>
+<br>
+       return egl_util_run(&test, argc, argv);<br>
+}<br>
+<br>
+#else<br>
+<br>
+int<br>
+main(int argc, char *argv[])<br>
+{<br>
+       piglit_report_result(PIGLIT_SKIP);<br>
+<br>
+       return 0;<br>
+}<br>
+<br>
+#endif<br>
<span><font color="#888888">--<br>
1.8.4.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>