[Piglit] [PATCH 7/9] egl: Convert tests to using epoxy for EGL function pointer management.
Eric Anholt
eric at anholt.net
Tue Jan 28 18:52:59 PST 2014
---
tests/egl/egl-query-surface.c | 1 -
.../CMakeLists.no_api.txt | 1 +
.../ext_image_dma_buf_import/CMakeLists.gles1.txt | 12 ++--
.../ext_image_dma_buf_import/CMakeLists.gles2.txt | 4 +-
tests/spec/ext_image_dma_buf_import/image_common.c | 77 ----------------------
tests/spec/ext_image_dma_buf_import/image_common.h | 44 -------------
tests/spec/oes_draw_texture/oes_draw_texture.c | 18 ++---
tests/util/piglit-util-egl.h | 3 +-
8 files changed, 16 insertions(+), 144 deletions(-)
delete mode 100644 tests/spec/ext_image_dma_buf_import/image_common.c
diff --git a/tests/egl/egl-query-surface.c b/tests/egl/egl-query-surface.c
index d6424e4..bff0185 100644
--- a/tests/egl/egl-query-surface.c
+++ b/tests/egl/egl-query-surface.c
@@ -29,7 +29,6 @@
* For usage information, see usage_error().
*/
-#include <EGL/egl.h>
#include "piglit-util-egl.h"
#include "egl-util.h"
diff --git a/tests/egl/spec/egl_ext_client_extensions/CMakeLists.no_api.txt b/tests/egl/spec/egl_ext_client_extensions/CMakeLists.no_api.txt
index 3c3fe36..d43defc 100644
--- a/tests/egl/spec/egl_ext_client_extensions/CMakeLists.no_api.txt
+++ b/tests/egl/spec/egl_ext_client_extensions/CMakeLists.no_api.txt
@@ -1,5 +1,6 @@
link_libraries(
piglitutil
+ ${EPOXY_LDFLAGS}
)
piglit_add_executable(egl_ext_client_extensions egl_ext_client_extensions.c)
diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt
index fa96303..289c943 100644
--- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt
+++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles1.txt
@@ -18,12 +18,12 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS)
${LIBDRM_INCLUDE_DIRS}
)
- piglit_add_executable(ext_image_dma_buf_import-invalid_hints invalid_hints.c image_common.c)
- piglit_add_executable(ext_image_dma_buf_import-invalid_attributes invalid_attributes.c image_common.c)
- piglit_add_executable(ext_image_dma_buf_import-missing_attributes missing_attributes.c image_common.c)
- piglit_add_executable(ext_image_dma_buf_import-ownership_transfer ownership_transfer.c image_common.c)
- piglit_add_executable(ext_image_dma_buf_import-intel_unsupported_format intel_unsupported_format.c image_common.c)
- piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_only intel_external_sampler_only.c image_common.c)
+ piglit_add_executable(ext_image_dma_buf_import-invalid_hints invalid_hints.c)
+ piglit_add_executable(ext_image_dma_buf_import-invalid_attributes invalid_attributes.c)
+ piglit_add_executable(ext_image_dma_buf_import-missing_attributes missing_attributes.c)
+ piglit_add_executable(ext_image_dma_buf_import-ownership_transfer ownership_transfer.c)
+ piglit_add_executable(ext_image_dma_buf_import-intel_unsupported_format intel_unsupported_format.c)
+ piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_only intel_external_sampler_only.c)
endif()
# vim: ft=cmake:
diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
index 80f1c83..deb002a 100644
--- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
+++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
@@ -16,8 +16,8 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS)
${LIBDRM_INCLUDE_DIRS}
)
- piglit_add_executable(ext_image_dma_buf_import-sample_rgb sample_rgb.c sample_common.c image_common.c)
- piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_with_dma_only intel_external_sampler_with_dma_only.c image_common.c)
+ piglit_add_executable(ext_image_dma_buf_import-sample_rgb sample_rgb.c sample_common.c)
+ piglit_add_executable(ext_image_dma_buf_import-intel_external_sampler_with_dma_only intel_external_sampler_with_dma_only.c)
endif()
# vim: ft=cmake:
diff --git a/tests/spec/ext_image_dma_buf_import/image_common.c b/tests/spec/ext_image_dma_buf_import/image_common.c
deleted file mode 100644
index af01c3d..0000000
--- a/tests/spec/ext_image_dma_buf_import/image_common.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 "image_common.h"
-
-static void
-image_common_unsupported(const char *name)
-{
- printf("Function \"%s\" not supported on this implementation\n", name);
- piglit_report_result(PIGLIT_SKIP);
-}
-
-static void
-resolve_eglCreateImageKHR()
-{
- if (piglit_is_egl_extension_supported(eglGetCurrentDisplay(),
- "EGL_KHR_image_base"))
- 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_egl_extension_supported(eglGetCurrentDisplay(),
- "EGL_KHR_image_base"))
- image_common_dispatch_eglDestroyImageKHR =
- (PFNEGLDESTROYIMAGEKHRPROC ) eglGetProcAddress(
- "eglDestroyImageKHR");
- else
- image_common_unsupported("DestroyImageKHR");
-}
-
-static EGLBoolean EGLAPIENTRY
-stub_eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
-{
- resolve_eglDestroyImageKHR();
- return image_common_dispatch_eglDestroyImageKHR(dpy, image);
-}
-
-PFNEGLDESTROYIMAGEKHRPROC image_common_dispatch_eglDestroyImageKHR =
- stub_eglDestroyImageKHR;
diff --git a/tests/spec/ext_image_dma_buf_import/image_common.h b/tests/spec/ext_image_dma_buf_import/image_common.h
index 3ace6bc..f7545c7 100644
--- a/tests/spec/ext_image_dma_buf_import/image_common.h
+++ b/tests/spec/ext_image_dma_buf_import/image_common.h
@@ -23,54 +23,10 @@
#ifndef IMAGE_COMMON_H
#define IMAGE_COMMON_H
-/**
- * Temporary local dispatcer for EGL extensions. This can be replaced with the
- * proper support once it is in place for EGL in the piglit core.
- *
- * A call in the tests is re-directed by the precompiler to a dispatcher that
- * checks the availability of the real extension and takes care of the linking.
- */
-
#include <unistd.h>
#include <drm_fourcc.h>
#include "piglit-util-egl.h"
#include "piglit-util-gl-common.h"
-/* We define here the enums for EGL_EXT_image_dma_buf_import because, as of
- * today (2013-09-10), the eglext.h on many systems lack them. The first Mesa
- * version in which eglext.h defined the enums was Mesa 9.2 (2013-08-27).
- */
-#ifndef EGL_EXT_image_dma_buf_import
-#define EGL_EXT_image_dma_buf_import 1
-#define EGL_LINUX_DMA_BUF_EXT 0x3270
-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
-#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
-#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
-#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
-#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
-#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
-#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
-#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
-#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
-#define EGL_ITU_REC601_EXT 0x327F
-#define EGL_ITU_REC709_EXT 0x3280
-#define EGL_ITU_REC2020_EXT 0x3281
-#define EGL_YUV_FULL_RANGE_EXT 0x3282
-#define EGL_YUV_NARROW_RANGE_EXT 0x3283
-#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
-#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
-#endif
-
-extern PFNEGLCREATEIMAGEKHRPROC image_common_dispatch_eglCreateImageKHR;
-#define eglCreateImageKHR image_common_dispatch_eglCreateImageKHR
-
-extern PFNEGLDESTROYIMAGEKHRPROC image_common_dispatch_eglDestroyImageKHR;
-#define eglDestroyImageKHR image_common_dispatch_eglDestroyImageKHR
-
#endif /* IMAGE_COMMON_H */
diff --git a/tests/spec/oes_draw_texture/oes_draw_texture.c b/tests/spec/oes_draw_texture/oes_draw_texture.c
index 75cfd92..fa74614 100644
--- a/tests/spec/oes_draw_texture/oes_draw_texture.c
+++ b/tests/spec/oes_draw_texture/oes_draw_texture.c
@@ -50,8 +50,6 @@ static const float green[4] = { 0.0f, 1.0f, 0.0f, 0.25f };
static const float blue[4] = { 0.0f, 0.0f, 1.0f, 0.50f };
static const float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
-static PFNGLDRAWTEXIOESPROC piglit_glDrawTexiOES;
-
/**
* Test the basic use of glDrawTex
*/
@@ -68,7 +66,7 @@ test_basic(void)
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
/* draw the RGBW texture */
- piglit_glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
+ glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
pass = piglit_probe_pixel_rgb(x, y, red);
pass = piglit_probe_pixel_rgb(x + 5, y, green) && pass;
@@ -97,7 +95,7 @@ test_negative_crop(void)
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
/* draw the RGBW texture with negative crop */
- piglit_glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
+ glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
pass = piglit_probe_pixel_rgb(x, y, white);
pass = piglit_probe_pixel_rgb(x + 5, y, blue) && pass;
@@ -128,7 +126,7 @@ test_right_top_crop(void)
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
/* draw the right top quarter of RGBW texture */
- piglit_glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
+ glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
pass = piglit_probe_pixel_rgb(x, y, white);
pass = piglit_probe_pixel_rgb(x + 5, y, white) && pass;
@@ -159,7 +157,7 @@ test_right_top_win(void)
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);
/* draw the RGBW texture at the right top */
- piglit_glDrawTexiOES(half_width, half_height, 0, half_width, half_height);
+ glDrawTexiOES(half_width, half_height, 0, half_width, half_height);
pass = piglit_probe_pixel_rgb(x, y, red);
pass = piglit_probe_pixel_rgb(x + 5, y, green) && pass;
@@ -190,9 +188,9 @@ test_depth(void)
glEnable(GL_DEPTH_TEST);
/* draw at near plane */
- piglit_glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
+ glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
/* draw at far plane: should be no-op */
- piglit_glDrawTexiOES(0, 0, 1, piglit_width / 2, piglit_height / 2);
+ glDrawTexiOES(0, 0, 1, piglit_width / 2, piglit_height / 2);
glDisable(GL_DEPTH_TEST);
@@ -229,10 +227,6 @@ piglit_init(int argc, char **argv)
GLuint tex;
piglit_require_extension("GL_OES_draw_texture");
- piglit_glDrawTexiOES = (PFNGLDRAWTEXIOESPROC)
- eglGetProcAddress("glDrawTexiOES");
- if (!piglit_glDrawTexiOES)
- piglit_report_result(PIGLIT_FAIL);
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
diff --git a/tests/util/piglit-util-egl.h b/tests/util/piglit-util-egl.h
index 62ce749..46f4fa3 100644
--- a/tests/util/piglit-util-egl.h
+++ b/tests/util/piglit-util-egl.h
@@ -25,8 +25,7 @@
#define EGL_EGLEXT_PROTOTYPES
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
+#include <epoxy/egl.h>
#include "piglit-util.h"
--
1.8.5.3
More information about the Piglit
mailing list