[Piglit] [PATCH 2/7] Replace piglit-dispatch with libepoxy.

Eric Anholt eric at anholt.net
Mon Feb 24 11:41:09 PST 2014


libepoxy is based on a similar code-generation idea as
piglit-dispatch, but is distributed as a separate library, uses the
new XML files, and handles EGL and GLX function pointers as well.
---

Trimmed the big deletes in here to avoid mailing list moderation.

 CMakeLists.txt                                     |    4 +-
 cmake/piglit_dispatch.cmake                        |   44 -
 src/piglit/gl_wrap.h                               |   67 -
 tests/egl/egl-util.c                               |   10 +-
 .../default-major-version-gl.c                     |    2 -
 .../default-major-version-gles.c                   |    3 -
 .../default-minor-version-gl.c                     |    2 -
 .../default-minor-version-gles.c                   |    7 -
 .../valid-attribute-empty-gl.c                     |    2 -
 .../valid-attribute-empty-gles.c                   |    3 -
 .../valid-attribute-null-gl.c                      |    2 -
 .../valid-attribute-null-gles.c                    |    3 -
 .../spec/egl_khr_create_context/valid-flag-debug.c |   24 -
 .../valid-flag-forward-compatible-gl.c             |    2 -
 .../spec/egl_khr_create_context/verify-gl-flavor.c |   10 -
 tests/general/windowoverlap.c                      |    1 -
 tests/glean/glwrap.h                               |    2 +-
 tests/glean/tbase.h                                |    6 +-
 tests/glx/glx-copy-sub-buffer.c                    |    1 -
 tests/glx/glx-destroycontext-1.c                   |    1 -
 tests/glx/glx-destroycontext-2.c                   |    1 -
 tests/glx/glx-fbo-binding.c                        |    1 -
 tests/glx/glx-make-current.c                       |    1 -
 tests/glx/glx-make-glxdrawable-current.c           |    1 -
 tests/glx/glx-multi-context-ib-1.c                 |    1 -
 tests/glx/glx-multithread-makecurrent-1.c          |    1 -
 tests/glx/glx-multithread-makecurrent-2.c          |    1 -
 tests/glx/glx-multithread-makecurrent-3.c          |    1 -
 tests/glx/glx-multithread-makecurrent-4.c          |    1 -
 tests/glx/glx-multithread-shader-compile.c         |    7 -
 tests/glx/glx-multithread-texture.c                |    1 -
 tests/glx/glx-multithread.c                        |    1 -
 tests/glx/glx-shader-sharing.c                     |    2 -
 tests/glx/glx-swap-event.c                         |    1 -
 tests/glx/glx-swap-pixmap-bad.c                    |    1 -
 tests/glx/glx-swap-pixmap.c                        |    1 -
 tests/glx/glx-swap-singlebuffer.c                  |    1 -
 tests/glx/glx-tfp.c                                |    2 -
 tests/glx/glx-visuals-depth.c                      |    1 -
 tests/glx/glx-visuals-stencil.c                    |    1 -
 .../depth-stencil-texture.c                        |    7 +-
 .../glx_arb_create_context/default-major-version.c |    1 -
 .../glx_arb_create_context/default-minor-version.c |    1 -
 tests/spec/glx_mesa_query_renderer/coverage.c      |    1 -
 tests/spec/glx_oml_sync_control/common.c           |    2 -
 tests/texturing/getteximage-luminance.c            |    1 -
 tests/util/CMakeLists.gl.txt                       |    4 -
 tests/util/CMakeLists.gles2.txt                    |    2 -
 tests/util/CMakeLists.gles3.txt                    |    2 -
 tests/util/CMakeLists.txt                          |    1 +
 tests/util/gen_dispatch.py                         |  682 ---------
 tests/util/glxew.h                                 | 1586 --------------------
 tests/util/piglit-dispatch-init.c                  |  202 ---
 tests/util/piglit-dispatch.c                       |  304 ----
 tests/util/piglit-dispatch.h                       |  175 ---
 .../piglit-framework-gl/piglit_fbo_framework.c     |    2 -
 .../piglit-framework-gl/piglit_glut_framework.c    |    4 -
 .../piglit-framework-gl/piglit_wfl_framework.c     |    6 -
 .../piglit-framework-gl/piglit_x11_framework.c     |   13 +-
 tests/util/piglit-shader.h                         |   45 -
 tests/util/piglit-util-gl-common.h                 |    4 +-
 tests/util/piglit-util-gl.c                        |    2 -
 tests/util/piglit_ktx.h                            |    2 +-
 63 files changed, 13 insertions(+), 3260 deletions(-)
 delete mode 100644 cmake/piglit_dispatch.cmake
 delete mode 100644 src/piglit/gl_wrap.h
 delete mode 100644 tests/util/gen_dispatch.py
 delete mode 100644 tests/util/glxew.h
 delete mode 100644 tests/util/piglit-dispatch-init.c
 delete mode 100644 tests/util/piglit-dispatch.c
 delete mode 100644 tests/util/piglit-dispatch.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bef9c35..45d2cc1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,9 @@ option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
 
 if(PIGLIT_BUILD_GL_TESTS)
 	find_package(OpenGL REQUIRED)
+	pkg_check_modules(EPOXY REQUIRED epoxy)
+	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EPOXY_CFLAGS}")
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EPOXY_CFLAGS}")
 endif()
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -377,7 +380,6 @@ configure_file(
 
 include(cmake/piglit_util.cmake)
 include(cmake/piglit_glapi.cmake)
-include(cmake/piglit_dispatch.cmake)
 
 include_directories(src)
 add_subdirectory(cmake/target_api)
diff --git a/cmake/piglit_dispatch.cmake b/cmake/piglit_dispatch.cmake
deleted file mode 100644
index 0b0a2eb..0000000
--- a/cmake/piglit_dispatch.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2012 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.
-
-set(piglit_dispatch_gen_output_dir ${CMAKE_BINARY_DIR}/tests/util)
-
-file(MAKE_DIRECTORY ${piglit_dispatch_gen_output_dir})
-
-set(piglit_dispatch_gen_outputs
-	${piglit_dispatch_gen_output_dir}/generated_dispatch.c
-	${piglit_dispatch_gen_output_dir}/generated_dispatch.h
-	)
-
-set(piglit_dispatch_gen_inputs
-	${CMAKE_SOURCE_DIR}/tests/util/gen_dispatch.py
-	${CMAKE_BINARY_DIR}/glapi/glapi.json
-	)
-
-add_custom_command(
-	OUTPUT ${piglit_dispatch_gen_outputs}
-	DEPENDS ${piglit_dispatch_gen_inputs}
-	COMMAND ${python} ${piglit_dispatch_gen_inputs} ${piglit_dispatch_gen_outputs}
-	)
-
-add_custom_target(piglit_dispatch_gen
-	DEPENDS ${piglit_dispatch_gen_outputs}
-	)
diff --git a/src/piglit/gl_wrap.h b/src/piglit/gl_wrap.h
deleted file mode 100644
index e8bbbcd..0000000
--- a/src/piglit/gl_wrap.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2010 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.
- *
- * Authors:
- *     Chad Versace <chad.versace at intel.com>
- */
-
-/**
- * \file gl_wrap.h
- * \brief Convenience header that includes the actual OpenGL headers.
- *
- * The actual OpenGL headers are chosen according to the macro definitions
- * PIGLIT_USE_OPENGL, PIGLIT_USE_OPENGL_ES1, and PIGLIT_USE_OPENGL_ES2.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#if (defined(PIGLIT_USE_OPENGL) || \
-     defined(PIGLIT_USE_OPENGL_ES2) || \
-     defined(PIGLIT_USE_OPENGL_ES3))
-#	include "piglit-dispatch.h"
-
-#elif defined(PIGLIT_USE_OPENGL_ES1)
-#	define GL_GLEXT_PROTOTYPES
-#	include <GLES/gl.h>
-#	include <GLES/glext.h>
-
-	/* for source level compatibility */
-#       define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES
-#       define GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES
-#       define GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES
-#       define GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES
-#       define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
-#       define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES
-
-#endif
-
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index 226ba0e..f371666 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -189,7 +189,7 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 	struct egl_state state;
 	EGLint count;
 	enum piglit_result result;
-	int i, dispatch_api, api_bit = EGL_OPENGL_BIT;
+	int i, api_bit = EGL_OPENGL_BIT;
 
 	EGLint ctxAttribsES[] = {
 		EGL_CONTEXT_CLIENT_VERSION, 0,
@@ -225,18 +225,14 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 		ctxAttribs = ctxAttribsES;
 	}
 
-	/* choose dispatch_api and set ctx version to ctxAttribs if using ES */
+	/* Set ctx version to ctxAttribs if using ES */
 	switch (api_bit) {
 	case EGL_OPENGL_ES_BIT:
-		dispatch_api = PIGLIT_DISPATCH_ES1;
 		ctxAttribsES[1] = 1;
 		break;
 	case EGL_OPENGL_ES2_BIT:
-		dispatch_api = PIGLIT_DISPATCH_ES2;
 		ctxAttribsES[1] = 2;
 		break;
-	default:
-		dispatch_api = PIGLIT_DISPATCH_GL;
 	}
 
 
@@ -283,8 +279,6 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	piglit_dispatch_default_init(dispatch_api);
-
 	result = event_loop(&state, test);
 
 	eglTerminate(state.egl_dpy);
diff --git a/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c b/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c
index 1162d7b..22cb802 100644
--- a/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c
@@ -63,8 +63,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c b/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
index 00c28d1..da72fbb 100644
--- a/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
@@ -60,9 +60,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	/* FINISHME: Use PIGLIT_DISPATCH_ES1 when implemented. */
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c b/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c
index 37369d5..2ff3d85 100644
--- a/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c
@@ -65,8 +65,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c b/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c
index 6101ad7..8c4270f 100644
--- a/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/default-minor-version-gles.c
@@ -64,13 +64,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	if (attribs[1] == 1) {
-		/* FINISHME: Use PIGLIT_DISPATCH_ES1 when implemented. */
-		piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-	} else if (attribs[1] == 2) {
-		piglit_dispatch_default_init(PIGLIT_DISPATCH_ES2);
-	}
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c
index 5e1ebb3..7ae042d 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c
@@ -55,8 +55,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c
index 1a878a8..b962424 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c
@@ -54,9 +54,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	/* FINISHME: Use PIGLIT_DISPATCH_ES1 when implemented. */
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c
index d3ff851..04a24c2 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c
@@ -52,8 +52,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c
index 2042283..706d338 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c
@@ -51,9 +51,6 @@ int main(int argc, char **argv)
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-	/* FINISHME: Use PIGLIT_DISPATCH_ES1 when implemented. */
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	version_string = (char *) glGetString(GL_VERSION);
 
 	if (!parse_version_string(version_string, &major, &minor)) {
diff --git a/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c b/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c
index 1473b44..a8bc1d7 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c
@@ -65,7 +65,6 @@ static void
 try_debug_flag(EGLenum context_api, EGLenum context_bit)
 {
 	GLint actual_flags = 0;
-	piglit_dispatch_api dispatch_api;
 
 	EGLint attribs[64];
 	int i = 0;
@@ -117,29 +116,6 @@ try_debug_flag(EGLenum context_api, EGLenum context_bit)
 
 	switch (context_bit) {
 	case EGL_OPENGL_BIT:
-		dispatch_api = PIGLIT_DISPATCH_GL;
-		break;
-	case EGL_OPENGL_ES_BIT:
-		/* Piglit doesn't yet have ES1 dispatch, so just initialize
-		 * with ES2 dispatch. This should be safe because the only
-		 * GL functions called by this test are glGetString() and
-		 * glGetIntegerv().
-		 */
-		dispatch_api = PIGLIT_DISPATCH_ES2;
-	case EGL_OPENGL_ES2_BIT:
-	case EGL_OPENGL_ES3_BIT_KHR:
-		dispatch_api = PIGLIT_DISPATCH_ES2;
-		break;
-	default:
-		dispatch_api = 0;
-		assert(0);
-		break;
-	}
-
-	piglit_dispatch_default_init(dispatch_api);
-
-	switch (context_bit) {
-	case EGL_OPENGL_BIT:
 		if (piglit_get_gl_version() < 31 &&
 		    !piglit_is_extension_supported("GL_KHR_debug")) {
 			fprintf(stderr, "In OpenGL, either OpenGL 3.1 or "
diff --git a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
index 7f0f148..eef19f2 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
@@ -43,8 +43,6 @@ static bool try_flag(int flag)
 				piglit_report_result(PIGLIT_FAIL);
 			}
 
-			piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 			gl_version = piglit_get_gl_version();
 		}
 		eglDestroyContext(egl_dpy, ctx);
diff --git a/tests/egl/spec/egl_khr_create_context/verify-gl-flavor.c b/tests/egl/spec/egl_khr_create_context/verify-gl-flavor.c
index 27ea0b1..ff40eda 100644
--- a/tests/egl/spec/egl_khr_create_context/verify-gl-flavor.c
+++ b/tests/egl/spec/egl_khr_create_context/verify-gl-flavor.c
@@ -139,8 +139,6 @@ get_gl_version(void)
 static enum piglit_result
 check_flavor(int requested_version, enum gl_api requested_api)
 {
-	static bool is_dispatch_init = false;
-
 	enum piglit_result result = PIGLIT_PASS;
 	int i;
 
@@ -231,14 +229,6 @@ check_flavor(int requested_version, enum gl_api requested_api)
 		goto fail;
 	}
 
-	if (!is_dispatch_init) {
-		/* We must postpone initialization of piglit-dispatch until
-		 * a context is current.
-		 */
-		piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-		is_dispatch_init = true;
-	}
-
 	if (!eglQueryContext(egl_dpy, ctx,
 			     EGL_CONTEXT_CLIENT_TYPE, &actual_client_type)) {
 		printf("%s", "error: eglQueryContext(EGL_CONTEXT_CLIENT_TYPE) "
diff --git a/tests/general/windowoverlap.c b/tests/general/windowoverlap.c
index 6b08a75..71e70f6 100644
--- a/tests/general/windowoverlap.c
+++ b/tests/general/windowoverlap.c
@@ -181,7 +181,6 @@ int main(int argc, char *argv[])
 	glutInitWindowSize(MainWidth, MainHeight);
 	glutInitDisplayMode(PIGLIT_GL_VISUAL_RGB);
 	glutCreateWindow(argv[0]);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	glutReshapeFunc(Reshape);
 	glutDisplayFunc(RedisplayMain);
 	if (!Automatic)
diff --git a/tests/glean/glwrap.h b/tests/glean/glwrap.h
index d3404b4..cfc2ee5 100644
--- a/tests/glean/glwrap.h
+++ b/tests/glean/glwrap.h
@@ -48,7 +48,7 @@
 #ifndef __glwrap_h__
 #define __glwrap_h__
 
-#include "../util/piglit-dispatch.h"
+#include <epoxy/gl.h>
 
 #if defined(__WIN__)
 #  include <windows.h>
diff --git a/tests/glean/tbase.h b/tests/glean/tbase.h
index b5fe2c5..37a65c2 100644
--- a/tests/glean/tbase.h
+++ b/tests/glean/tbase.h
@@ -104,7 +104,7 @@ and tbasic.cpp.
 #ifndef __tbase_h__
 #define __tbase_h__
 
-#include "piglit-dispatch.h"
+#include <epoxy/gl.h>
 
 #ifdef __UNIX__
 #include <unistd.h>
@@ -311,10 +311,6 @@ public:
 					// XXX need to throw exception here
 				}
 
-				// Make sure glew is initialized so we can call
-				// GL functions safely.
-				piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 				// Check if test is applicable to this context
 				if (!isApplicable())
 					continue;
diff --git a/tests/glx/glx-copy-sub-buffer.c b/tests/glx/glx-copy-sub-buffer.c
index a991df5..ef8bd93 100644
--- a/tests/glx/glx-copy-sub-buffer.c
+++ b/tests/glx/glx-copy-sub-buffer.c
@@ -52,7 +52,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win_one, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	glClearColor(1.0, 0.0, 0.0, 0.0);
 	glClear(GL_COLOR_BUFFER_BIT);
diff --git a/tests/glx/glx-destroycontext-1.c b/tests/glx/glx-destroycontext-1.c
index fc27b6e..3088d5b 100644
--- a/tests/glx/glx-destroycontext-1.c
+++ b/tests/glx/glx-destroycontext-1.c
@@ -48,7 +48,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	glClearColor(1.0, 0.0, 0.0, 1.0);
 	glClear(GL_COLOR_BUFFER_BIT);
 	glXMakeCurrent(dpy, None, NULL);
diff --git a/tests/glx/glx-destroycontext-2.c b/tests/glx/glx-destroycontext-2.c
index e4c6d37..0edfbb9 100644
--- a/tests/glx/glx-destroycontext-2.c
+++ b/tests/glx/glx-destroycontext-2.c
@@ -48,7 +48,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	glClearColor(1.0, 0.0, 0.0, 1.0);
 	glClear(GL_COLOR_BUFFER_BIT);
 	glXDestroyContext(dpy, ctx);
diff --git a/tests/glx/glx-fbo-binding.c b/tests/glx/glx-fbo-binding.c
index bfdc4dd..6fb051e 100644
--- a/tests/glx/glx-fbo-binding.c
+++ b/tests/glx/glx-fbo-binding.c
@@ -111,7 +111,6 @@ main(int argc, char **argv)
    ctx = piglit_get_glx_context(dpy, visinfo);
 
    glXMakeCurrent(dpy, Windows[0], ctx);
-   piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
    piglit_glx_event_loop(dpy, draw);
 
diff --git a/tests/glx/glx-make-current.c b/tests/glx/glx-make-current.c
index dde99b4..0f09060 100644
--- a/tests/glx/glx-make-current.c
+++ b/tests/glx/glx-make-current.c
@@ -49,7 +49,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win_one, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	glClearColor(0.0, 1.0, 0.0, 1.0);
 	glClear(GL_COLOR_BUFFER_BIT);
diff --git a/tests/glx/glx-make-glxdrawable-current.c b/tests/glx/glx-make-glxdrawable-current.c
index fc339be..2a6d778 100644
--- a/tests/glx/glx-make-glxdrawable-current.c
+++ b/tests/glx/glx-make-glxdrawable-current.c
@@ -76,7 +76,6 @@ draw(Display *dpy)
 	ctx = piglit_get_glx_context(dpy, visinfo);
 
 	glXMakeCurrent(dpy, glxwin_one, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	glClearColor(0.0, 1.0, 0.0, 1.0);
 	glClear(GL_COLOR_BUFFER_BIT);
diff --git a/tests/glx/glx-multi-context-ib-1.c b/tests/glx/glx-multi-context-ib-1.c
index 2b3c00e..6a4ce3f 100644
--- a/tests/glx/glx-multi-context-ib-1.c
+++ b/tests/glx/glx-multi-context-ib-1.c
@@ -189,7 +189,6 @@ main(int argc, char **argv)
 	ctx1 = piglit_get_glx_context(dpy, visinfo);
 
 	glXMakeCurrent(dpy, win, ctx0);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	piglit_require_extension("GL_ARB_vertex_buffer_object");
 	context0_init();
 	glXMakeCurrent(dpy, win, ctx1);
diff --git a/tests/glx/glx-multithread-makecurrent-1.c b/tests/glx/glx-multithread-makecurrent-1.c
index 97dc1cd..d9d689b 100644
--- a/tests/glx/glx-multithread-makecurrent-1.c
+++ b/tests/glx/glx-multithread-makecurrent-1.c
@@ -107,7 +107,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
 
diff --git a/tests/glx/glx-multithread-makecurrent-2.c b/tests/glx/glx-multithread-makecurrent-2.c
index d9714ec..adb1e98 100644
--- a/tests/glx/glx-multithread-makecurrent-2.c
+++ b/tests/glx/glx-multithread-makecurrent-2.c
@@ -108,7 +108,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
 
diff --git a/tests/glx/glx-multithread-makecurrent-3.c b/tests/glx/glx-multithread-makecurrent-3.c
index dc93d33..3a5524d 100644
--- a/tests/glx/glx-multithread-makecurrent-3.c
+++ b/tests/glx/glx-multithread-makecurrent-3.c
@@ -100,7 +100,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
 
diff --git a/tests/glx/glx-multithread-makecurrent-4.c b/tests/glx/glx-multithread-makecurrent-4.c
index 53cb297..f2d0cc2 100644
--- a/tests/glx/glx-multithread-makecurrent-4.c
+++ b/tests/glx/glx-multithread-makecurrent-4.c
@@ -100,7 +100,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	piglit_require_glx_extension(dpy, "MESA_multithread_makecurrent");
 
diff --git a/tests/glx/glx-multithread-shader-compile.c b/tests/glx/glx-multithread-shader-compile.c
index 82042d5..61a6250 100644
--- a/tests/glx/glx-multithread-shader-compile.c
+++ b/tests/glx/glx-multithread-shader-compile.c
@@ -68,13 +68,6 @@ thread_func(void *arg)
 		ctx = piglit_get_glx_context(dpy, visinfo);
 		glXMakeCurrent(dpy, win, ctx);
 
-		/* Ok, not nice but should be safe due to all threads working
-		 * on the same type of context.
-                 */
-		pthread_mutex_lock(&mutex);
-		piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-		pthread_mutex_unlock(&mutex);
-
 		vert_shader = piglit_compile_shader_text(GL_VERTEX_SHADER, vert_shader_text);
 		piglit_check_gl_error(GL_NO_ERROR);
 
diff --git a/tests/glx/glx-multithread-texture.c b/tests/glx/glx-multithread-texture.c
index 59dc730..af17ce1 100644
--- a/tests/glx/glx-multithread-texture.c
+++ b/tests/glx/glx-multithread-texture.c
@@ -195,7 +195,6 @@ draw(Display *dpy)
 
 	ret = glXMakeCurrent(dpy, draw_win, my_ctx);
 	assert(ret);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	glEnable(GL_TEXTURE_2D);
 
diff --git a/tests/glx/glx-multithread.c b/tests/glx/glx-multithread.c
index f88f8da..133544d 100644
--- a/tests/glx/glx-multithread.c
+++ b/tests/glx/glx-multithread.c
@@ -79,7 +79,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	/* Clear background to gray */
 	glClearColor(0.5, 0.5, 0.5, 1.0);
diff --git a/tests/glx/glx-shader-sharing.c b/tests/glx/glx-shader-sharing.c
index 1b180ae..4a78ac0 100644
--- a/tests/glx/glx-shader-sharing.c
+++ b/tests/glx/glx-shader-sharing.c
@@ -88,8 +88,6 @@ draw(Display *dpy)
     */
    glXMakeCurrent(dpy, win, ctx1);
 
-   piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
    if (piglit_get_gl_version() < 20) {
       printf("%s: Requires OpenGL 2.0\n", TestName);
       return PIGLIT_SKIP;
diff --git a/tests/glx/glx-swap-event.c b/tests/glx/glx-swap-event.c
index 310e634..8b2eb0c 100644
--- a/tests/glx/glx-swap-event.c
+++ b/tests/glx/glx-swap-event.c
@@ -533,7 +533,6 @@ main(int argc, char *argv[])
             piglit_report_result(PIGLIT_FAIL);
         }
     }
-    piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
     event_loop(dpy, glxWin);
     
     glXDestroyContext(dpy, ctx);
diff --git a/tests/glx/glx-swap-pixmap-bad.c b/tests/glx/glx-swap-pixmap-bad.c
index 52a0749..2b4133e 100644
--- a/tests/glx/glx-swap-pixmap-bad.c
+++ b/tests/glx/glx-swap-pixmap-bad.c
@@ -73,7 +73,6 @@ main(int argc, char **argv)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, g, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	/* Clear to green */
 	glClearColor(0.0, 1.0, 0.0, 0.0);
diff --git a/tests/glx/glx-swap-pixmap.c b/tests/glx/glx-swap-pixmap.c
index 7635e0d..51aebfe 100644
--- a/tests/glx/glx-swap-pixmap.c
+++ b/tests/glx/glx-swap-pixmap.c
@@ -67,7 +67,6 @@ main(int argc, char **argv)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, g, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	/* Clear to green */
 	glClearColor(0.0, 1.0, 0.0, 0.0);
diff --git a/tests/glx/glx-swap-singlebuffer.c b/tests/glx/glx-swap-singlebuffer.c
index a747149..b7c2e75 100644
--- a/tests/glx/glx-swap-singlebuffer.c
+++ b/tests/glx/glx-swap-singlebuffer.c
@@ -48,7 +48,6 @@ draw(Display *dpy)
 
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	/* Clear to green */
 	glClearColor(0.0, 1.0, 0.0, 0.0);
diff --git a/tests/glx/glx-tfp.c b/tests/glx/glx-tfp.c
index 413d920..3336c51 100644
--- a/tests/glx/glx-tfp.c
+++ b/tests/glx/glx-tfp.c
@@ -320,8 +320,6 @@ int main(int argc, char**argv)
 
 	glXMakeCurrent(dpy, win, ctx);
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	if (piglit_automatic)
 		piglit_glx_set_no_input();
 
diff --git a/tests/glx/glx-visuals-depth.c b/tests/glx/glx-visuals-depth.c
index 8db98bb..38c3a27 100644
--- a/tests/glx/glx-visuals-depth.c
+++ b/tests/glx/glx-visuals-depth.c
@@ -50,7 +50,6 @@ draw(Display *dpy, GLXFBConfig config)
 	float *left, *right;
 	bool pass = true;
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	glXGetFBConfigAttrib(dpy, config, GLX_DEPTH_SIZE, &dbits);
 
 	piglit_ortho_projection(piglit_width, piglit_height, false);
diff --git a/tests/glx/glx-visuals-stencil.c b/tests/glx/glx-visuals-stencil.c
index 12fcfd3..9da3b33 100644
--- a/tests/glx/glx-visuals-stencil.c
+++ b/tests/glx/glx-visuals-stencil.c
@@ -50,7 +50,6 @@ draw(Display *dpy, GLXFBConfig config)
 	float *left, *right;
 	bool pass = true;
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	glXGetFBConfigAttrib(dpy, config, GLX_STENCIL_SIZE, &sbits);
 
 	piglit_ortho_projection(piglit_width, piglit_height, false);
diff --git a/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c b/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
index d40d6a6..369f80e 100644
--- a/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
+++ b/tests/spec/ext_packed_depth_stencil/depth-stencil-texture.c
@@ -57,11 +57,8 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 PIGLIT_GL_TEST_CONFIG_END
 
 #if defined PIGLIT_USE_OPENGL_ES1
-#define GL_TEXTURE_CUBE_MAP  GL_TEXTURE_CUBE_MAP_OES
-#define GL_DEPTH_STENCIL     GL_DEPTH_STENCIL_OES
-#define GL_DEPTH24_STENCIL8  GL_DEPTH24_STENCIL8_OES
-#define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
-#define GL_TEXTURE_3D        0x806F
+/* XXX: This should get propagated to gl.xml */
+#undef glTexStorage2D
 #define glTexStorage2D       glTexStorage2DEXT
 #endif
 
diff --git a/tests/spec/glx_arb_create_context/default-major-version.c b/tests/spec/glx_arb_create_context/default-major-version.c
index 07bff27..6f0bc4d 100644
--- a/tests/spec/glx_arb_create_context/default-major-version.c
+++ b/tests/spec/glx_arb_create_context/default-major-version.c
@@ -52,7 +52,6 @@ int main(int argc, char **argv)
 	 */
 	ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
 	glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	version_string = (char *) glGetString(GL_VERSION);
 
diff --git a/tests/spec/glx_arb_create_context/default-minor-version.c b/tests/spec/glx_arb_create_context/default-minor-version.c
index f32e991..e442fe0 100644
--- a/tests/spec/glx_arb_create_context/default-minor-version.c
+++ b/tests/spec/glx_arb_create_context/default-minor-version.c
@@ -57,7 +57,6 @@ int main(int argc, char **argv)
 	}
 
 	glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	version_string = (char *) glGetString(GL_VERSION);
 
diff --git a/tests/spec/glx_mesa_query_renderer/coverage.c b/tests/spec/glx_mesa_query_renderer/coverage.c
index b3464d4..387da93 100644
--- a/tests/spec/glx_mesa_query_renderer/coverage.c
+++ b/tests/spec/glx_mesa_query_renderer/coverage.c
@@ -264,7 +264,6 @@ int main(int argc, char **argv)
 	}
 
         glXMakeContextCurrent(dpy, glxWin, glxWin, ctx);
-        piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 
 	pass = subtest_QueryRendererInteger(dpy) && pass;
 	pass = subtest_QueryRendererString(dpy) && pass;
diff --git a/tests/spec/glx_oml_sync_control/common.c b/tests/spec/glx_oml_sync_control/common.c
index d5011a8..922f080 100644
--- a/tests/spec/glx_oml_sync_control/common.c
+++ b/tests/spec/glx_oml_sync_control/common.c
@@ -80,8 +80,6 @@ piglit_oml_sync_control_test_run(enum piglit_result (*draw)(Display *dpy))
 	ctx = piglit_get_glx_context(dpy, visinfo);
 	glXMakeCurrent(dpy, win, ctx);
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	XMapWindow(dpy, win);
 
 	piglit_glx_event_loop(dpy, draw);
diff --git a/tests/texturing/getteximage-luminance.c b/tests/texturing/getteximage-luminance.c
index 389c3a2..e8631a8 100644
--- a/tests/texturing/getteximage-luminance.c
+++ b/tests/texturing/getteximage-luminance.c
@@ -251,5 +251,4 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 }
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index d8fb32c..ba83d84 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -1,7 +1,5 @@
 set(UTIL_GL_SOURCES
 	${UTIL_GL_SOURCES}
-	piglit-dispatch.c
-	piglit-dispatch-init.c
 	piglit-shader.c
 	piglit-shader-gl.c
 	piglit-util-gl-enum.c
@@ -37,8 +35,6 @@ IF(PIGLIT_BUILD_GLX_TESTS)
 		    piglit-util-gl.c
 		    piglit-glx-framework.c
 		    piglit-glx-util.c
-		    piglit-dispatch.c
-		    piglit-dispatch-init.c
 	)
 	target_link_libraries(piglitglxutil
 		piglitutil_${piglit_target_api}
diff --git a/tests/util/CMakeLists.gles2.txt b/tests/util/CMakeLists.gles2.txt
index d2501e3..0470104 100644
--- a/tests/util/CMakeLists.gles2.txt
+++ b/tests/util/CMakeLists.gles2.txt
@@ -1,8 +1,6 @@
 set(UTIL_GL_SOURCES
 	${UTIL_GL_SOURCES}
 	piglit-vbo.cpp
-	piglit-dispatch.c
-	piglit-dispatch-init.c
 	piglit-shader.c
 	piglit-shader-gles2.c
 	piglit-util-gl-enum.c
diff --git a/tests/util/CMakeLists.gles3.txt b/tests/util/CMakeLists.gles3.txt
index 1cb591f..98f3302 100644
--- a/tests/util/CMakeLists.gles3.txt
+++ b/tests/util/CMakeLists.gles3.txt
@@ -1,7 +1,5 @@
 list(APPEND UTIL_GL_SOURCES
 	minmax-test.c
-	piglit-dispatch.c
-	piglit-dispatch-init.c
 	piglit-shader.c
 	piglit-shader-gles2.c # Compatible with gles3.
 	piglit-util-gles.c
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index 27c8888..691adc4 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -52,6 +52,7 @@ endif()
 set(UTIL_GL_LIBS
 	piglitutil
 	${WAFFLE_LDFLAGS}
+	${EPOXY_LDFLAGS}
 	)
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
deleted file mode 100644
index c97af94..0000000
--- a/tests/util/gen_dispatch.py
+++ /dev/null
@@ -1,682 +0,0 @@
-# Copyright 2012 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.
-
-# This script generates a C file (and corresponding header) allowing
-# Piglit to dispatch calls to OpenGL based on a JSON description of
-# the GL API (and extensions).
-#
-# Invoke this script with 3 command line arguments: the JSON input
-# filename, the C output filename, and the header outpit filename.
-#
-#
-# The input looks like this:
-#
-# {
-#   "categories": {
-#     <category name>: {
-#       "kind": <"GL" or "GLES" for a GL spec API, "extension" for an extension>,
-#       "gl_10x_version": <For a GL version, version number times 10>,
-#       "extension_name" <For an extension, name of the extension>
-#     }, ...
-#   },
-#   "enums": {
-#     <enum name, without "GL_" prefix>: {
-#       "value_int": <value integer>
-#       "value_str": <value string>
-#     }, ...
-#   },
-#   "functions": {
-#     <function name, without "gl" prefix>: {
-#       "categories": <list of categories in which this function appears>,
-#       "param_names": <list of param names>,
-#       "param_types": <list of param types>,
-#       "return_type": <type, or "void" if no return>
-#     }, ...
-#   },
-#   "function_alias_sets": {
-#     <list of synonymous function names>, ...
-#   },
-# }
-#
-#
-# The generated header consists of the following:
-#
-# - A typedef for each function, of the form that would normally
-#   appear in gl.h or glext.h, e.g.:
-#
-#   typedef GLvoid * (APIENTRY *PFNGLMAPBUFFERPROC)(GLenum, GLenum);
-#   typedef GLvoid * (APIENTRY *PFNGLMAPBUFFERARBPROC)(GLenum, GLenum);
-#
-# - A set of extern declarations for "dispatch function pointers".
-#   There is one dispatch function pointer for each set of synonymous
-#   functions in the GL API, e.g.:
-#
-#   extern PFNGLMAPBUFFERPROC piglit_dispatch_glMapBuffer;
-#
-# - A set of #defines mapping each function name to the corresponding
-#   dispatch function pointer, e.g.:
-#
-#   #define glMapBuffer piglit_dispatch_glMapBuffer
-#   #define glMapBufferARB piglit_dispatch_glMapBuffer
-#
-# - A #define for each enum in the GL API, e.g.:
-#
-#   #define GL_FRONT 0x0404
-#
-# - A #define for each extension, e.g.:
-#
-#   #define GL_ARB_vertex_buffer_object 1
-#
-# - A #define for each known GL version, e.g.:
-#
-#   #define GL_VERSION_1_5 1
-#
-#
-# The generated C file consists of the following:
-#
-# - A resolve function corresponding to each set of synonymous
-#   functions in the GL API.  The resolve function determines which of
-#   the synonymous names the implementation supports (by consulting
-#   the current GL version and/or the extension string), and calls
-#   either get_core_proc() or get_ext_proc() to get the function
-#   pointer.  It stores the result in the dispatch function pointer,
-#   and then returns it as a generic void(void) function pointer.  If
-#   the implementation does not support any of the synonymous names,
-#   it calls unsupported().  E.g.:
-#
-#   /* glMapBuffer (GL 1.5) */
-#   /* glMapbufferARB (GL_ARB_vertex_buffer_object) */
-#   static piglit_dispatch_function_ptr resolve_glMapBuffer()
-#   {
-#     if (check_version(15))
-#       piglit_dispatch_glMapBuffer = (PFNGLMAPBUFFERPROC) get_core_proc("glMapBuffer", 15);
-#     else if (check_extension("GL_ARB_vertex_buffer_object"))
-#       piglit_dispatch_glMapBuffer = (PFNGLMAPBUFFERARBPROC) get_ext_proc("glMapBufferARB");
-#     else
-#       unsupported("MapBuffer");
-#     return (piglit_dispatch_function_ptr) piglit_dispatch_glMapBuffer;
-#   }
-#
-# - A stub function corresponding to each set of synonymous functions
-#   in the GL API.  The stub function first calls
-#   check_initialized().  Then it calls the resolve function to
-#   ensure that the dispatch function pointer is set.  Finally, it
-#   dispatches to the GL function through the dispatch function
-#   pointer.  E.g.:
-#
-#   static GLvoid * APIENTRY stub_glMapBuffer(GLenum target, GLenum access)
-#   {
-#     check_initialized();
-#     resolve_glMapBuffer();
-#     return piglit_dispatch_glMapBuffer(target, access);
-#   }
-#
-# - A declaration for each dispatch function pointer, e.g.:
-#
-#   PFNGLMAPBUFFERPROC piglit_dispatch_glMapBuffer = stub_glMapBuffer;
-#
-# - An function, reset_dispatch_pointers(), which resets each dispatch
-#   pointer to the corresponding stub function.
-#
-# - A table function_names, containing the name of each function in
-#   alphabetical order (including the "gl" prefix).
-#
-# - A table function_resolvers, containing a pointer to the resolve
-#   function corresponding to each entry in function_names.
-
-import collections
-import os.path
-import sys
-try:
-    import simplejson as json
-except:
-    import json
-
-
-# Generate a top-of-file comment cautioning that the file is
-# auto-generated and should not be manually edited.
-def generated_boilerplate():
-    return """\
-/**
- * This file was automatically generated by the script {0!r}.
- *
- * DO NOT EDIT!
- *
- * To regenerate, run "make piglit_dispatch_gen" from the toplevel directory.
- *
- * Copyright 2012 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.
- */
-""".format(os.path.basename(sys.argv[0]))
-
-
-# Certain param names used in OpenGL are reserved by some compilers.
-# Rename them.
-PARAM_NAME_FIXUPS = {'near': 'hither', 'far': 'yon'}
-
-
-def fixup_param_name(name):
-    if name in PARAM_NAME_FIXUPS:
-        return PARAM_NAME_FIXUPS[name]
-    else:
-        return name
-
-
-# Internal representation of a category.
-#
-# - For a category representing a GL version, Category.kind is 'GL'
-#   and Category.gl_10x_version is 10 times the GL version (e.g. 21
-#   for OpenGL version 2.1).
-#
-# - For a category representing an extension, Category.kind is
-#   'extension' and Category.extension_name is the extension name
-#   (including the 'GL_' prefix).
-class Category(object):
-    def __init__(self, json_data):
-        self.kind = json_data['kind']
-        if 'gl_10x_version' in json_data:
-            self.gl_10x_version = json_data['gl_10x_version']
-        if 'extension_name' in json_data:
-            self.extension_name = json_data['extension_name']
-
-    # Generate a human-readable representation of the category (for
-    # use in generated comments).
-    def __str__(self):
-        if self.kind == 'GL':
-            return 'GL {0}.{1}'.format(
-                self.gl_10x_version // 10, self.gl_10x_version % 10)
-        if self.kind == 'GLES':
-            return 'GLES {0}.{1}'.format(
-                self.gl_10x_version // 10, self.gl_10x_version % 10)
-        elif self.kind == 'extension':
-            return self.extension_name
-        else:
-            raise Exception(
-                'Unexpected category kind {0!r}'.format(self.kind))
-
-
-# Internal representation of a GL function.
-#
-# - Function.name is the name of the function, without the 'gl'
-#   prefix.
-#
-# - Function.param_names is a list containing the name of each
-#   function parameter.
-#
-# - Function.param_types is a list containing the type of each
-#   function parameter.
-#
-# - Function.return_type is the return type of the function, or 'void'
-#   if the function has no return.
-#
-# - Function.category is a Category object describing the extension or
-#   GL version the function is defined in.
-class Function(object):
-    def __init__(self, name, json_data):
-        self.name = name
-        self.param_names = [
-            fixup_param_name(x) for x in json_data['param_names']]
-        self.param_types = json_data['param_types']
-        self.return_type = json_data['return_type']
-        self.categories = json_data['categories']
-
-    # Name of the function, with the 'gl' prefix.
-    @property
-    def gl_name(self):
-        return 'gl' + self.name
-
-    # Name of the function signature typedef corresponding to this
-    # function.  E.g. for the glGetString function, this is
-    # 'PFNGLGETSTRINGPROC'.
-    @property
-    def typedef_name(self):
-        return 'pfn{0}proc'.format(self.gl_name).upper()
-
-    # Generate a string representing the function signature in C.
-    #
-    # - name is inserted before the opening paren--use '' to generate
-    #   an anonymous function type signature.
-    #
-    # - If anonymous_args is True, then the signature contains only
-    #   the types of the arguments, not the names.
-    def c_form(self, name, anonymous_args):
-        if self.param_types:
-            if anonymous_args:
-                param_decls = ', '.join(self.param_types)
-            else:
-                param_decls = ', '.join(
-                    '{0} {1}'.format(*p)
-                    for p in zip(self.param_types, self.param_names))
-        else:
-            param_decls = 'void'
-        return '{rettype} {name}({param_decls})'.format(
-            rettype=self.return_type, name=name,
-            param_decls=param_decls)
-
-
-# Internal representation of an enum.
-#
-# - Enum.value_int is the value of the enum, as a Python integer.
-#
-# - Enum.value_str is the value of the enum, as a string suitable for
-#   emitting as C code.
-class Enum(object):
-    def __init__(self, json_data):
-        self.value_int = json_data['value_int']
-        self.value_str = json_data['value_str']
-
-
-# Data structure keeping track of a set of synonymous functions.  Such
-# a set is called a "dispatch set" because it corresponds to a single
-# dispatch pointer.
-#
-# - DispatchSet.cat_fn_pairs is a list of pairs (category, function)
-#   for each category this function is defined in.  The list is sorted
-#   by category, with categories of kind 'GL' and then 'GLES' appearing first.
-class DispatchSet(object):
-    # Initialize a dispatch set given a list of synonymous function
-    # names.
-    #
-    # - all_functions is a dict mapping all possible function names to
-    #   the Function object describing them.
-    #
-    # - all_categories is a dict mapping all possible category names
-    #   to the Category object describing them.
-    def __init__(self, synonym_set, all_functions, all_categories):
-        self.cat_fn_pairs = []
-        for function_name in synonym_set:
-            function = all_functions[function_name]
-            for category_name in function.categories:
-                category = all_categories[category_name]
-                self.cat_fn_pairs.append((category, function))
-        # Sort by category, with GL categories preceding extensions.
-        self.cat_fn_pairs.sort(key=self.__sort_key)
-
-    # The first Function object in DispatchSet.functions.  This
-    # "primary" function is used to name the dispatch pointer, the
-    # stub function, and the resolve function.
-    @property
-    def primary_function(self):
-        return self.cat_fn_pairs[0][1]
-
-    # The name of the dispatch pointer that should be generated for
-    # this dispatch set.
-    @property
-    def dispatch_name(self):
-        return 'piglit_dispatch_' + self.primary_function.gl_name
-
-    # The name of the stub function that should be generated for this
-    # dispatch set.
-    @property
-    def stub_name(self):
-        return 'stub_' + self.primary_function.gl_name
-
-    # The name of the resolve function that should be generated for
-    # this dispatch set.
-    @property
-    def resolve_name(self):
-        return 'resolve_' + self.primary_function.gl_name
-
-    @staticmethod
-    def __sort_key(cat_fn_pair):
-        if cat_fn_pair[0].kind == 'GL':
-            return 0, cat_fn_pair[0].gl_10x_version
-        elif cat_fn_pair[0].kind == 'GLES':
-            return 1, cat_fn_pair[0].gl_10x_version
-        elif cat_fn_pair[0].kind == 'extension':
-            return 2, cat_fn_pair[0].extension_name
-        else:
-            raise Exception(
-                'Unexpected category kind {0!r}'.format(cat_fn_pair[0].kind))
-
-
-# Data structure keeping track of all of the known functions and
-# enums, and synonym relationships that exist between the functions.
-#
-# - Api.enums is a dict mapping enum name to an Enum object.
-#
-# - Api.functions is a dict mapping function name to a Function object.
-#
-# - Api.function_alias_sets is a list of lists, where each constituent
-#   list is a list of function names that are aliases of each other.
-#
-# - Api.categories is a dict mapping category name to a Category
-#   object.
-class Api(object):
-    def __init__(self, json_data):
-        self.enums = dict(
-            (key, Enum(value))
-            for key, value in json_data['enums'].items())
-        self.functions = dict(
-            (key, Function(key, value))
-            for key, value in json_data['functions'].items())
-        self.function_alias_sets = json_data['function_alias_sets']
-        self.categories = dict(
-            (key, Category(value))
-            for key, value in json_data['categories'].items())
-
-    # Generate a list of (name, value) pairs representing all enums in
-    # the API.  The resulting list is sorted by enum value.
-    def compute_unique_enums(self):
-        enums_by_value = [(enum.value_int, (name, enum.value_str))
-                          for name, enum in self.enums.items()]
-        enums_by_value.sort()
-        return [item[1] for item in enums_by_value]
-
-    # A list of all of the extension names declared in the API, as
-    # Python strings, sorted alphabetically.
-    @property
-    def extensions(self):
-        return sorted(
-            [category_name
-             for category_name, category in self.categories.items()
-             if category.kind == 'extension'])
-
-    # A list of all of the GL versions declared in the API, as
-    # integers (e.g. 13 represents GL version 1.3).
-    @property
-    def gl_versions(self):
-        return sorted(
-            [category.gl_10x_version
-             for category in self.categories.values()
-             if category.kind == 'GL'])
-
-    # Generate a list of DispatchSet objects representing all sets of
-    # synonymous functions in the API.  The resulting list is sorted
-    # by DispatchSet.stub_name.
-    def compute_dispatch_sets(self):
-        sets = [DispatchSet(synonym_set, self.functions, self.categories)
-                for synonym_set in self.function_alias_sets]
-        sets.sort(key=lambda ds: ds.stub_name)
-
-        return sets
-
-    # Generate a list of Function objects representing all functions
-    # in the API.  The resulting list is sorted by function name.
-    def compute_unique_functions(self):
-        return [self.functions[key] for key in sorted(self.functions.keys())]
-
-
-# Read the given input file and return an Api object containing the
-# data in it.
-def read_api(filename):
-    with open(filename, 'r') as f:
-        return Api(json.load(f))
-
-
-# Generate the resolve function for a given DispatchSet.
-def generate_resolve_function(ds):
-    f0 = ds.primary_function
-
-    # First figure out all the conditions we want to check in order to
-    # figure out which function to dispatch to, and the code we will
-    # execute in each case.
-    condition_code_pairs = []
-    for category, f in ds.cat_fn_pairs:
-        if category.kind in ('GL', 'GLES'):
-            getter = 'get_core_proc("{0}", {1})'.format(
-                f.gl_name, category.gl_10x_version)
-
-            condition = ''
-            api_base_version = 0
-            if category.kind == 'GL':
-                condition = 'dispatch_api == PIGLIT_DISPATCH_GL'
-                api_base_version = 10
-            elif category.gl_10x_version >= 20:
-                condition = 'dispatch_api == PIGLIT_DISPATCH_ES2'
-                api_base_version = 20
-            else:
-                condition = 'dispatch_api == PIGLIT_DISPATCH_ES1'
-                api_base_version = 11
-
-            # Only check the version for functions that aren't part of the
-            # core for the PIGLIT_DISPATCH api.
-            if category.gl_10x_version != api_base_version:
-                condition = condition + ' && check_version({0})'.format(
-                    category.gl_10x_version)
-        elif category.kind == 'extension':
-            getter = 'get_ext_proc("{0}")'.format(f.gl_name)
-            condition = 'check_extension("{0}")'.format(category.extension_name)
-        else:
-            raise Exception(
-                'Unexpected category type {0!r}'.format(category.kind))
-
-        if f.name == 'TexImage3DEXT':
-            # Special case: glTexImage3DEXT has a slightly different
-            # type than glTexImage3D (argument 3 is a GLenum rather
-            # than a GLint).  This is not a problem, since GLenum and
-            # GLint are treated identically by function calling
-            # conventions.  So when calling get_proc_address() on
-            # glTexImage3DEXT, cast the result to PFNGLTEXIMAGE3DPROC
-            # to avoid a warning.
-            typedef_name = 'PFNGLTEXIMAGE3DPROC'
-        else:
-            typedef_name = f.typedef_name
-
-        code = '{0} = ({1}) {2};'.format(
-            ds.dispatch_name, typedef_name, getter)
-
-        condition_code_pairs.append((condition, code))
-
-    # XXX: glDraw{Arrays,Elements}InstancedARB are exposed by
-    # ARB_instanced_arrays in addition to ARB_draw_instanced, but neither
-    # gl.spec nor gl.json can accomodate an extension with two categories, so
-    # insert these cases here.
-        if f.gl_name in ('glDrawArraysInstancedARB',
-                         'glDrawElementsInstancedARB'):
-            condition = 'check_extension("GL_ARB_instanced_arrays")'
-            condition_code_pairs.append((condition, code))
-
-    # Finally, if none of the previous conditions were satisfied, then
-    # the given dispatch set is not supported by the implementation,
-    # so we want to call the unsupported() function.
-    condition_code_pairs.append(
-        ('true', 'unsupported("{0}");'.format(f0.name)))
-
-    # Start the resolve function
-    resolve_fn = 'static piglit_dispatch_function_ptr {0}()\n'.format(
-        ds.resolve_name)
-    resolve_fn += '{\n'
-
-    # Output code that checks each condition in turn and executes the
-    # appropriate case.  To make the generated code more palatable
-    # (and to avoid compiler warnings), we convert "if (true) FOO;" to
-    # "FOO;" and "else if (true) FOO;" to "else FOO;".
-    if condition_code_pairs[0][0] == 'true':
-        resolve_fn += '\t{0}\n'.format(condition_code_pairs[0][1])
-    else:
-        resolve_fn += '\tif ({0})\n\t\t{1}\n'.format(*condition_code_pairs[0])
-        for i in xrange(1, len(condition_code_pairs)):
-            if condition_code_pairs[i][0] == 'true':
-                resolve_fn += '\telse\n\t\t{0}\n'.format(
-                    condition_code_pairs[i][1])
-                break
-            else:
-                resolve_fn += '\telse if ({0})\n\t\t{1}\n'.format(
-                    *condition_code_pairs[i])
-
-    # Output code to return the dispatch function.
-    resolve_fn += '\treturn (piglit_dispatch_function_ptr) {0};\n'.format(
-        ds.dispatch_name)
-    resolve_fn += '}\n'
-    return resolve_fn
-
-
-# Generate the stub function for a given DispatchSet.
-def generate_stub_function(ds):
-    f0 = ds.primary_function
-
-    # Start the stub function
-    stub_fn = 'static {0}\n'.format(
-        f0.c_form('APIENTRY ' + ds.stub_name, anonymous_args=False))
-    stub_fn += '{\n'
-    stub_fn += '\tcheck_initialized();\n'
-    stub_fn += '\t{0}();\n'.format(ds.resolve_name)
-
-    # Output the call to the dispatch function.
-    stub_fn += '\t{0}{1}({2});\n'.format(
-        'return ' if f0.return_type != 'void' else '',
-        ds.dispatch_name, ', '.join(f0.param_names))
-    stub_fn += '}\n'
-    return stub_fn
-
-
-# Generate the reset_dispatch_pointers() function, which sets each
-# dispatch pointer to point to the corresponding stub function.
-def generate_dispatch_pointer_resetter(dispatch_sets):
-    result = []
-    result.append('static void\n')
-    result.append('reset_dispatch_pointers()\n')
-    result.append('{\n')
-    for ds in dispatch_sets:
-        result.append(
-            '\t{0} = {1};\n'.format(ds.dispatch_name, ds.stub_name))
-    result.append('}\n')
-    return ''.join(result)
-
-
-# Generate the function_names and function_resolvers tables.
-def generate_function_names_and_resolvers(dispatch_sets):
-    name_resolver_pairs = []
-    for ds in dispatch_sets:
-        for _, f in ds.cat_fn_pairs:
-            name_resolver_pairs.append((f.gl_name, ds.resolve_name))
-    name_resolver_pairs.sort()
-    result = []
-    result.append('static const char * const function_names[] = {\n')
-    for name, _ in name_resolver_pairs:
-        result.append('\t"{0}",\n'.format(name))
-    result.append('};\n')
-    result.append('\n')
-    result.append('static const piglit_dispatch_resolver_ptr '
-                  'function_resolvers[] = {\n')
-    for _, resolver in name_resolver_pairs:
-        result.append('\t{0},\n'.format(resolver))
-    result.append('};\n')
-    return ''.join(result)
-
-
-# Generate the C source and header files for the API.
-def generate_code(api):
-    c_contents = [generated_boilerplate()]
-    h_contents = [generated_boilerplate()]
-
-    unique_functions = api.compute_unique_functions()
-
-    # Emit typedefs for each name
-    for f in unique_functions:
-        h_contents.append(
-            'typedef {0};\n'.format(
-                f.c_form('(APIENTRY *{0})'.format(f.typedef_name),
-                         anonymous_args=True)))
-
-    dispatch_sets = api.compute_dispatch_sets()
-
-    for ds in dispatch_sets:
-        f0 = ds.primary_function
-
-        # Emit comment block
-        comments = '\n'
-        for cat, f in ds.cat_fn_pairs:
-            comments += '/* {0} ({1}) */\n'.format(f.gl_name, cat)
-        c_contents.append(comments)
-        h_contents.append(comments)
-
-        # Emit extern declaration of dispatch pointer
-        h_contents.append(
-            'extern {0} {1};\n'.format(f0.typedef_name, ds.dispatch_name))
-
-        # Emit defines aliasing each GL function to the dispatch
-        # pointer
-        for _, f in ds.cat_fn_pairs:
-            h_contents.append(
-                '#define {0} {1}\n'.format(f.gl_name, ds.dispatch_name))
-
-        # Emit resolve function
-        c_contents.append(generate_resolve_function(ds))
-
-        # Emit stub function
-        c_contents.append(generate_stub_function(ds))
-
-        # Emit initializer for dispatch pointer
-        c_contents.append(
-            '{0} {1} = {2};\n'.format(
-                f0.typedef_name, ds.dispatch_name, ds.stub_name))
-
-    # Emit dispatch pointer initialization function
-    c_contents.append(generate_dispatch_pointer_resetter(dispatch_sets))
-
-    c_contents.append('\n')
-
-    # Emit function_names and function_resolvers tables.
-    c_contents.append(generate_function_names_and_resolvers(dispatch_sets))
-
-    # Emit enum #defines
-    for name, value in api.compute_unique_enums():
-        h_contents.append('#define GL_{0} {1}\n'.format(name, value))
-
-    # Emit extension #defines
-    #
-    # While enum.ext lists some old extension names (defined to 1), it
-    # doesn't contain the full set that appears in glext.h.
-    h_contents.append('\n')
-    for ext in api.extensions:
-        h_contents.append('#define {0} 1\n'.format(ext))
-
-    # Emit GL version #defines
-    #
-    # While enum.ext lists GL versions up to 3.2, it didn't continue
-    # adding them for later GL versions.
-    h_contents.append('\n')
-    for ver in api.gl_versions:
-        h_contents.append('#define GL_VERSION_{0}_{1} 1\n'.format(
-            ver // 10, ver % 10))
-
-    return ''.join(c_contents), ''.join(h_contents)
-
-
-if __name__ == '__main__':
-    file_to_parse = sys.argv[1]
-    api = read_api(file_to_parse)
-
-    c_contents, h_contents = generate_code(api)
-    with open(sys.argv[2], 'w') as f:
-        f.write(c_contents)
-    with open(sys.argv[3], 'w') as f:
-        f.write(h_contents)
diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
index 8e82657..51927aa 100644
--- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
@@ -66,8 +66,6 @@ init_gl(struct piglit_wfl_framework *wfl_fw)
 	GLenum status;
 
 #ifdef PIGLIT_USE_OPENGL
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
 	if (piglit_get_gl_version() < 20)
 		return false;
 
diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c
index 716f314..ee9d27d 100644
--- a/tests/util/piglit-framework-gl/piglit_glut_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c
@@ -124,10 +124,6 @@ init_glut(void)
 	glutDisplayFunc(display);
 	glutReshapeFunc(default_reshape_func);
 	glutKeyboardFunc(piglit_escape_exit_key);
-
-#ifdef PIGLIT_USE_OPENGL
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-#endif
 }
 
 static void
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index 0d09032..8f63f0a 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -446,12 +446,6 @@ make_context_current_singlepass(struct piglit_wfl_framework *wfl_fw,
 	                         wfl_fw->window,
 	                         wfl_fw->context);
 
-#ifdef PIGLIT_USE_OPENGL
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-#elif defined(PIGLIT_USE_OPENGL_ES2) || defined(PIGLIT_USE_OPENGL_ES3)
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_ES2);
-#endif
-
 	ok = check_gl_version(test_config, flavor, ctx_desc);
 	if (!ok)
 	   goto fail;
diff --git a/tests/util/piglit-framework-gl/piglit_x11_framework.c b/tests/util/piglit-framework-gl/piglit_x11_framework.c
index 8b3d3d7..b31a971 100644
--- a/tests/util/piglit-framework-gl/piglit_x11_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_x11_framework.c
@@ -25,18 +25,7 @@
 #error "Cannot build piglit_x11_framework.c without PIGLIT_HAS_X11"
 #endif
 
-#include <piglit/gl_wrap.h>
-
-/* If building for a GLES API, <piglit/gl_wrap.h> may include the GLES
- * headers, such as <GLES2/gl2.h>. Below, <waffle_glx.h> transitively includes
- * <GL/gl.h>, which defines some of the same symbols found in <GLES2/gl2.h>.
- * We define the include guards below in order to prevent <GL/gl.h> and
- * related headers from being included and causing compilation failure due to
- * symbol redefinitions.
- */
-#define __gl_h_
-#define __gltypes_h_
-#define __glext_h_
+#include <epoxy/gl.h>
 
 #include <assert.h>
 #include <unistd.h>
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index e0503e6..e2eef03 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -52,51 +52,6 @@ GLint piglit_build_simple_program_multiple_shaders(GLenum target1,
 extern GLboolean piglit_program_pipeline_check_status(GLuint pipeline);
 extern GLboolean piglit_program_pipeline_check_status_quiet(GLuint pipeline);
 
-#if defined(PIGLIT_USE_OPENGL_ES1)
-#define glAttachShader assert(!"glAttachShader does not exist in ES1")
-#define glBindAttribLocation assert(!"glBindAttribLocation does not exist in ES1")
-#define glCompileShader assert(!"glCompileShader does not exist in ES1")
-#define glCreateProgram assert(!"glCreateProgram does not exist in ES1")
-#define glCreateShader assert(!"glCreateShader does not exist in ES1")
-#define glDeleteProgram assert(!"glDeleteProgram does not exist in ES1")
-#define glDeleteShader assert(!"glDeleteShader does not exist in ES1")
-#define glGetActiveUniform assert(!"glGetActiveUniform does not exist in ES1")
-#define glGetAttribLocation assert(!"glGetAttribLocation does not exist in ES1")
-#define glGetProgramInfoLog assert(!"glGetProgramInfoLog does not exist in ES1")
-#define glGetProgramiv assert(!"glGetProgramiv does not exist in ES1")
-#define glGetShaderInfoLog assert(!"glGetShaderInfoLog does not exist in ES1")
-#define glGetShaderiv assert(!"glGetShaderiv does not exist in ES1")
-#define glGetUniformLocation assert(!"glGetUniformLocation does not exist in ES1")
-#define glLinkProgram assert(!"glLinkProgram does not exist in ES1")
-#define glShaderSource assert(!"glShaderSource does not exist in ES1")
-#define glUseProgram assert(!"glUseProgram does not exist in ES1")
-#define glUniform1f assert(!"glUniform1f does not exist in ES1")
-#define glUniform2f assert(!"glUniform2f does not exist in ES1")
-#define glUniform3f assert(!"glUniform3f does not exist in ES1")
-#define glUniform4f assert(!"glUniform4f does not exist in ES1")
-#define glUniform1fv assert(!"glUniform1fv does not exist in ES1")
-#define glUniform2fv assert(!"glUniform2fv does not exist in ES1")
-#define glUniform3fv assert(!"glUniform3fv does not exist in ES1")
-#define glUniform4fv assert(!"glUniform4fv does not exist in ES1")
-#define glUniform1i assert(!"glUniform1i does not exist in ES1")
-#define glUniform2iv assert(!"glUniform2iv does not exist in ES1")
-#define glUniform3iv assert(!"glUniform3iv does not exist in ES1")
-#define glUniform4iv assert(!"glUniform4iv does not exist in ES1")
-#define glUniformMatrix2fv assert(!"glUniformMatrix2fv does not exist in ES1")
-#define glUniformMatrix3fv assert(!"glUniformMatrix3fv does not exist in ES1")
-#define glUniformMatrix4fv assert(!"glUniformMatrix4fv does not exist in ES1")
-#define glGetUniformfv assert(!"glGetUniformfv does not exist in ES1")
-#define glVertexAttribPointer assert(!"glVertexAttribPointer does not exist in ES1")
-#define glEnableVertexAttribArray assert(!"glEnableVertexAttribArray does not exist in ES1")
-#define glDisableVertexAttribArray assert(!"glDisableVertexAttribArray does not exist in ES1")
-#define glUniformMatrix2x3fv assert(!"glUniformMatrix2x3fv does not exist in ES1")
-#define glUniformMatrix2x4fv assert(!"glUniformMatrix2x4fv does not exist in ES1")
-#define glUniformMatrix3x2fv assert(!"glUniformMatrix3x2fv does not exist in ES1")
-#define glUniformMatrix3x4fv assert(!"glUniformMatrix3x4fv does not exist in ES1")
-#define glUniformMatrix4x2fv assert(!"glUniformMatrix4x2fv does not exist in ES1")
-#define glUniformMatrix4x3fv assert(!"glUniformMatrix4x3fv does not exist in ES1")
-#endif
-
 /**
  * Require a specific version of GLSL.
  *
diff --git a/tests/util/piglit-util-gl-common.h b/tests/util/piglit-util-gl-common.h
index 73f2f83..40c6b7d 100644
--- a/tests/util/piglit-util-gl-common.h
+++ b/tests/util/piglit-util-gl-common.h
@@ -31,11 +31,9 @@ extern "C" {
 
 #include "piglit-util.h"
 
-#include <piglit/gl_wrap.h>
+#include <epoxy/gl.h>
 #include <piglit/glut_wrap.h>
 
-#define piglit_get_proc_address(x) piglit_dispatch_resolve_function(x)
-
 #include "piglit-framework-gl.h"
 #include "piglit-shader.h"
 
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 3bb4adf..9fff9a6 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -738,7 +738,6 @@ int piglit_use_fragment_program(void)
 		"END\n"
 		;
 
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	if (!piglit_is_extension_supported("GL_ARB_fragment_program"))
 		return 0;
 
@@ -758,7 +757,6 @@ void piglit_require_fragment_program(void)
 
 int piglit_use_vertex_program(void)
 {
-	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
 	return piglit_is_extension_supported("GL_ARB_vertex_program");
 }
 
diff --git a/tests/util/piglit_ktx.h b/tests/util/piglit_ktx.h
index d150423..9b063c2 100644
--- a/tests/util/piglit_ktx.h
+++ b/tests/util/piglit_ktx.h
@@ -37,7 +37,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <piglit/gl_wrap.h>
+#include <epoxy/gl.h>
 
 #ifdef __cplusplus
 extern "C" {
-- 
1.9.rc1



More information about the Piglit mailing list