[Piglit] [PATCH 14/14] glapi: Build and use piglit-dispatch for GLES2.
Eric Anholt
eric at anholt.net
Wed Jun 5 16:14:31 PDT 2013
We still build separate binaries because we aren't dynamically loading
the GL for multi-API test sources, but we can almost completely use
the same source file for the two builds, relying on piglit-dispatch to
make up most of the difference.
---
src/piglit/gl_wrap.h | 10 +--
tests/shaders/shader_runner.c | 10 ++-
tests/shaders/shader_runner_gles_workarounds.h | 83 +---------------------
tests/spec/gles-2.0/fbo-discard.c | 8 ---
tests/util/CMakeLists.gles2.txt | 2 +
tests/util/CMakeLists.gles3.txt | 2 +
.../piglit-framework-gl/piglit_fbo_framework.c | 5 --
.../piglit-framework-gl/piglit_wfl_framework.c | 2 +
tests/util/piglit-shader.h | 7 --
9 files changed, 20 insertions(+), 109 deletions(-)
diff --git a/src/piglit/gl_wrap.h b/src/piglit/gl_wrap.h
index 14d24c3..240af3b 100644
--- a/src/piglit/gl_wrap.h
+++ b/src/piglit/gl_wrap.h
@@ -42,7 +42,9 @@ extern "C" {
#include <windows.h>
#endif
-#if defined(PIGLIT_USE_OPENGL)
+#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)
@@ -57,12 +59,6 @@ extern "C" {
# 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
-#elif defined(PIGLIT_USE_OPENGL_ES2)
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>
-#elif defined(PIGLIT_USE_OPENGL_ES3)
-# include <GLES3/gl3.h>
-# include <GLES3/gl3ext.h>
#endif
#ifdef __cplusplus
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7fc74aa..b925852 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1956,11 +1956,19 @@ piglit_init(int argc, char **argv)
version_init(&glsl_version, VERSION_GLSL, es,
(major * 100) + minor);
+#ifdef PIGLIT_USE_OPENGL
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS,
&gl_max_fragment_uniform_components);
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS,
&gl_max_vertex_uniform_components);
-
+#else
+ glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS,
+ &gl_max_fragment_uniform_components);
+ glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS,
+ &gl_max_vertex_uniform_components);
+ gl_max_fragment_uniform_components *= 4;
+ gl_max_vertex_uniform_components *= 4;
+#endif
if (argc > 2) {
path = argv[2];
} else if (argc > 1) {
diff --git a/tests/shaders/shader_runner_gles_workarounds.h b/tests/shaders/shader_runner_gles_workarounds.h
index 2b91f63..d3ab775 100644
--- a/tests/shaders/shader_runner_gles_workarounds.h
+++ b/tests/shaders/shader_runner_gles_workarounds.h
@@ -35,55 +35,6 @@
#include <stdio.h>
#include "piglit-util.h"
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-#define GL_COMPARE_R_TO_TEXTURE 0x884E
-#define GL_DEPTH_TEXTURE_MODE 0x884B
-#define GL_FLAT 0x1D00
-#define GL_FRAGMENT_PROGRAM_ARB 0x8804
-#define GL_GEOMETRY_SHADER 0x8DD9
-#define GL_INTENSITY 0x8049
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_POLYGON 0x0009
-#define GL_POLYGON_OFFSET_EXT 0x8037
-#define GL_QUADS 0x0007
-#define GL_QUAD_STRIP 0x0008
-#define GL_SMOOTH 0x1D01
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_1D_ARRAY 0x8C18
-#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
-#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_VERTEX_PROGRAM_ARB 0x8620
-#define GL_VERTEX_PROGRAM_ARB 0x8620
-#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
-#define GL_WRITE_ONLY 0x88B9
-
-#if defined(PIGLIT_USE_OPENGL_ES2)
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_3D 0x806F
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_RED 0x1903
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS GL_MAX_FRAGMENT_UNIFORM_VECTORS
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS GL_MAX_VERTEX_UNIFORM_VECTORS
-#endif /*PIGLIT_USE_OPENGL_ES2 */
-
static void
#if defined(__GNUC__)
__attribute__((unused))
@@ -117,39 +68,9 @@ unsupported_function(const char *name, ...)
#define piglit_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_ortho_projection, 0, __VA_ARGS__)
#define piglit_compile_program(...) UNSUPPORTED_FUNCTION(piglit_compile_program, 0, __VA_ARGS__)
-#define glClipPlane(...) UNSUPPORTED_FUNCTION(glClipPlane, 0, __VA_ARGS__)
-#define glDisableClientState(...) UNSUPPORTED_FUNCTION(glDisableClientState, 0, __VA_ARGS__)
-#define glEnableClientState(...) UNSUPPORTED_FUNCTION(glEnableClientState, 0, __VA_ARGS__)
-#define glProgramEnvParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramEnvParameter4fvARB, 0, __VA_ARGS__)
-#define glProgramLocalParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0, __VA_ARGS__)
-#define glShadeModel(...) UNSUPPORTED_FUNCTION(glShadeModel, 0, __VA_ARGS__)
-
-#if defined(PIGLIT_USE_OPENGL_ES2)
-#define glMapBuffer(...) UNSUPPORTED_FUNCTION(glMapBuffer, NULL, __VA_ARGS__)
-#define glUnmapBuffer(...) UNSUPPORTED_FUNCTION(glUnmapBuffer, 0, __VA_ARGS__)
-#define glUniform1ui(...) UNSUPPORTED_FUNCTION(glUniform1ui, 0, __VA_ARGS__)
-#define glUniform2uiv(...) UNSUPPORTED_FUNCTION(glUniform2uiv, 0, __VA_ARGS__)
-#define glUniform3uiv(...) UNSUPPORTED_FUNCTION(glUniform3uiv, 0, __VA_ARGS__)
-#define glUniform4uiv(...) UNSUPPORTED_FUNCTION(glUniform4uiv, 0, __VA_ARGS__)
-#define glUniformMatrix2x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x3fv, 0, __VA_ARGS__)
-#define glUniformMatrix2x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x4fv, 0, __VA_ARGS__)
-#define glUniformMatrix3x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x2fv, 0, __VA_ARGS__)
-#define glUniformMatrix3x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x4fv, 0, __VA_ARGS__)
-#define glUniformMatrix4x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x2fv, 0, __VA_ARGS__)
-#define glUniformMatrix4x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x3fv, 0, __VA_ARGS__)
-#define glDrawArraysInstanced(...) UNSUPPORTED_FUNCTION(glDrawArrayInstanced, 0, __VA_ARGS__)
-#define glGetActiveUniformBlockiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformBlockiv, 0, __VA_ARGS__)
-#define glBindBufferBase(...) UNSUPPORTED_FUNCTION(glBindBufferiBase, 0, __VA_ARGS__)
-#define glGetUniformIndices(...) UNSUPPORTED_FUNCTION(glGetUniformIndices, 0, __VA_ARGS__)
-#define glGetActiveUniformsiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformsiv, 0, __VA_ARGS__)
-#define glGenVertexArrays(...) UNSUPPORTED_FUNCTION(glGenVertexArrays, 0, __VA_ARGS__)
-#define glBindVertexArray(...) UNSUPPORTED_FUNCTION(glBindVertexArray, 0, __VA_ARGS__)
-#endif /* PIGLIT_USE_OPENGL_ES2 */
-
-#define glBindProgramARB(...) UNSUPPORTED_FUNCTION(glBindProgramARB, 0, __VA_ARGS__)
-#define glVertexPointer(...) UNSUPPORTED_FUNCTION(glVertexPointer, 0, __VA_ARGS__)
-
#if defined(PIGLIT_USE_OPENGL_ES3)
+#undef glMapBuffer
+
static GLvoid*
glMapBuffer(GLenum target, GLbitfield access)
{
diff --git a/tests/spec/gles-2.0/fbo-discard.c b/tests/spec/gles-2.0/fbo-discard.c
index 5874b7b..4384de3 100644
--- a/tests/spec/gles-2.0/fbo-discard.c
+++ b/tests/spec/gles-2.0/fbo-discard.c
@@ -58,8 +58,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
-static PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT;
-
static GLboolean
run_test(void)
{
@@ -146,10 +144,4 @@ void
piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_EXT_discard_framebuffer");
-
- glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)
- eglGetProcAddress("glDiscardFramebufferEXT");
-
- if (!glDiscardFramebufferEXT)
- piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/util/CMakeLists.gles2.txt b/tests/util/CMakeLists.gles2.txt
index 0470104..d2501e3 100644
--- a/tests/util/CMakeLists.gles2.txt
+++ b/tests/util/CMakeLists.gles2.txt
@@ -1,6 +1,8 @@
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 98f3302..1cb591f 100644
--- a/tests/util/CMakeLists.gles3.txt
+++ b/tests/util/CMakeLists.gles3.txt
@@ -1,5 +1,7 @@
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/piglit-framework-gl/piglit_fbo_framework.c b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
index f71db47..b2403a3 100644
--- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
@@ -21,11 +21,6 @@
* IN THE SOFTWARE.
*/
-#ifdef PIGLIT_USE_OPENGL_ES2
-# define GL_DEPTH_STENCIL GL_DEPTH_STENCIL_OES
-# define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
-#endif
-
#include "piglit-util-gl-common.h"
#include "piglit-util-waffle.h"
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index 2cce282..419eb75 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -362,6 +362,8 @@ make_context_current_singlepass(struct piglit_wfl_framework *wfl_fw,
#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);
diff --git a/tests/util/piglit-shader.h b/tests/util/piglit-shader.h
index 425eab3..3e6b8fd 100644
--- a/tests/util/piglit-shader.h
+++ b/tests/util/piglit-shader.h
@@ -80,13 +80,6 @@ GLint piglit_build_simple_program(const char *vs_source, const char *fs_source);
#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")
-#elif defined(PIGLIT_USE_OPENGL_ES22)
-#define glUniformMatrix2x3fv assert(!"glUniformMatrix2x3fv does not exist in ES2")
-#define glUniformMatrix2x4fv assert(!"glUniformMatrix2x4fv does not exist in ES2")
-#define glUniformMatrix3x2fv assert(!"glUniformMatrix3x2fv does not exist in ES2")
-#define glUniformMatrix3x4fv assert(!"glUniformMatrix3x4fv does not exist in ES2")
-#define glUniformMatrix4x2fv assert(!"glUniformMatrix4x2fv does not exist in ES2")
-#define glUniformMatrix4x3fv assert(!"glUniformMatrix4x3fv does not exist in ES2")
#endif
/**
--
1.8.3.rc0
More information about the Piglit
mailing list