On 05/28/2013 11:54 AM, Eric Anholt wrote:
Topi Pohjolainen <[email protected]> writes:
diff --git a/tests/spec/ext_image_dma_buf_import/image_common.c 
b/tests/spec/ext_image_dma_buf_import/image_common.c
new file mode 100644
index 0000000..d075de4
--- /dev/null
+++ b/tests/spec/ext_image_dma_buf_import/image_common.c

+static void
+resolve_eglCreateImageKHR()
+{
+        if (piglit_is_extension_supported("GL_OES_EGL_image"))
+                image_common_dispatch_eglCreateImageKHR =
+                       (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress(
+                               "eglCreateImageKHR");
+        else
+                image_common_unsupported("CreateImageKHR");
+}
+
+static EGLImageKHR EGLAPIENTRY
+stub_eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
+               EGLClientBuffer buffer, const EGLint *attrib_list)
+{
+        resolve_eglCreateImageKHR();
+       return image_common_dispatch_eglCreateImageKHR(dpy, ctx, target, buffer,
+                        attrib_list);
+}
+
+PFNEGLCREATEIMAGEKHRPROC image_common_dispatch_eglCreateImageKHR =
+                               stub_eglCreateImageKHR;
+
+static void
+resolve_eglDestroyImageKHR()
+{
+        if (piglit_is_extension_supported("GL_OES_EGL_image"))
+                image_common_dispatch_eglDestroyImageKHR =
+                       (PFNEGLDESTROYIMAGEKHRPROC ) eglGetProcAddress(
+                               "eglDestroyImageKHR");
+        else
+                image_common_unsupported("DestroyImageKHR");
+}

These should be checking for

piglit_is_egl_extension_supported("EGL_KHR_image_base"), which is where
these functions come from.

I was going to say that this code should be moved into
piglit-dispatch.[ch], except of course these tests aren't using it
because my dispatch code isn't merged.  I'll get that out for review
today, and take moving this to piglit-dispatch as a task in order to get
my EGLImage tests landed.

diff --git a/tests/spec/ext_image_dma_buf_import/invalid_hints.c 
b/tests/spec/ext_image_dma_buf_import/invalid_hints.c
new file mode 100644
index 0000000..5e5a93e
--- /dev/null
+++ b/tests/spec/ext_image_dma_buf_import/invalid_hints.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-egl.h"
+#define EGL_EGLEXT_PROTOTYPES 1
+#include <EGL/eglext.h>

I don't think you need this now that you have dispatch for the two
extension entrypoints (and it would hide warnings for cases that you
need to add dispatch).

#define EGL_EXT_PROTOTYPES is also present in image_common.h, and should be 
removed
there too.

With that and Eric's other nit fixed,
Reviewed-by: Chad Versace <[email protected]>

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to