aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gall <tom.gall@linaro.org>2013-01-08 14:40:14 -0600
committerChad Versace <chad.versace@linux.intel.com>2013-01-09 12:31:00 -0800
commit06d3d19ec7e15cb1353e33de2e2910fdf0bd01b7 (patch)
tree0842b02f54079180b58f228f1033c1fd3bbecd7d
parent2fc922fb5e2a8fbad78c91d27b96dda87bf5ee55 (diff)
shader_runner: add gles2 support
Add a number of GLES2 specific workarounds to shader_runner_gles_workarounds.h. Add CMakeLists.gles2 into shaders directory so that shader_runner is build when gles2 is selected. Add piglit-vbo.cpp to util/CMakeLists.gles2.txt. In tests/util/piglit-vbo.cpp add one small ifdef PIGLIT_USE_OPENGL_ES2, vertex_attrib_description::setup so the data_type GL_INTEGER for attributes is prevented from use and emits an error message. Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Signed-off-by: Tom Gall <tom.gall@linaro.org>
-rw-r--r--tests/shaders/CMakeLists.gles2.txt7
-rw-r--r--tests/shaders/shader_runner_gles_workarounds.h52
-rw-r--r--tests/util/CMakeLists.gles2.txt1
-rw-r--r--tests/util/piglit-vbo.cpp4
4 files changed, 60 insertions, 4 deletions
diff --git a/tests/shaders/CMakeLists.gles2.txt b/tests/shaders/CMakeLists.gles2.txt
new file mode 100644
index 00000000..2fde3e3a
--- /dev/null
+++ b/tests/shaders/CMakeLists.gles2.txt
@@ -0,0 +1,7 @@
+link_libraries(
+ piglitutil_${piglit_target_api}
+)
+
+piglit_add_executable(shader_runner_gles2 shader_runner.c)
+
+# vim: ft=cmake:
diff --git a/tests/shaders/shader_runner_gles_workarounds.h b/tests/shaders/shader_runner_gles_workarounds.h
index 5afd5408..161f9851 100644
--- a/tests/shaders/shader_runner_gles_workarounds.h
+++ b/tests/shaders/shader_runner_gles_workarounds.h
@@ -23,9 +23,9 @@
/**
* \file
- * \brief Workarounds for building with GLES.
+ * \brief Workarounds for building with GLES2 and GLES3.
*
- * When building shader_runner against GLES3 and libpiglitutil_gles3, there
+ * When building shader_runner against GLESX and libpiglitutil_glesX, there
* are many macros and symbols that are not defined. This header defines such
* macros to have the same value found in <GL/gl*.h>, and defines such
* functions to print an error message and then report PIGLIT_SKIP, just as
@@ -64,6 +64,26 @@
#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))
@@ -88,7 +108,7 @@ unsupported_function(const char *name)
return_value; \
})
-#if defined(PIGLIT_USE_OPENGL_ES3)
+#if defined(PIGLIT_USE_OPENGL_ES3) || defined(PIGLIT_USE_OPENGL_ES2)
#define piglit_frustum_projection(...) UNSUPPORTED_FUNCTION(piglit_frustum_projection, 0)
#define piglit_gen_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_gen_ortho_projection, 0)
@@ -104,6 +124,28 @@ unsupported_function(const char *name)
#define glProgramLocalParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0)
#define glShadeModel(...) UNSUPPORTED_FUNCTION(glShadeModel, 0)
+#if defined(PIGLIT_USE_OPENGL_ES2)
+#define glMapBuffer(...) UNSUPPORTED_FUNCTION(glMapBuffer, 0)
+#define glUnmapBuffer(...) UNSUPPORTED_FUNCTION(glUnmapBuffer, 0)
+#define glUniform1ui(...) UNSUPPORTED_FUNCTION(glUniform1ui, 0)
+#define glUniform2uiv(...) UNSUPPORTED_FUNCTION(glUniform2uiv, 0)
+#define glUniform3uiv(...) UNSUPPORTED_FUNCTION(glUniform3uiv, 0)
+#define glUniform4uiv(...) UNSUPPORTED_FUNCTION(glUniform4uiv, 0)
+#define glUniformMatrix2x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x3fv, 0)
+#define glUniformMatrix2x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x4fv, 0)
+#define glUniformMatrix3x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x2fv, 0)
+#define glUniformMatrix3x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x4fv, 0)
+#define glUniformMatrix4x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x2fv, 0)
+#define glUniformMatrix4x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x3fv, 0)
+#define glDrawArraysInstanced(...) UNSUPPORTED_FUNCTION(glDrawArrayInstanced, 0)
+#define glGetActiveUniformBlockiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformBlockiv, 0)
+#define glBindBufferBase(...) UNSUPPORTED_FUNCTION(glBindBufferiBase, 0)
+#define glGetUniformIndices(...) UNSUPPORTED_FUNCTION(glGetUniformIndices, 0)
+#define glGetActiveUniformsiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformsiv, 0)
+#define glGenVertexArrays(...) UNSUPPORTED_FUNCTION(glGenVertexArrays, 0)
+#define glBindVertexArray(...) UNSUPPORTED_FUNCTION(glBindVertexArray, 0)
+#endif /* PIGLIT_USE_OPENGL_ES2 */
+
#define glBindProgramARB(a, b) \
/* Custom definition to suppress unused-variable warnings. */ \
({ \
@@ -122,6 +164,7 @@ unsupported_function(const char *name)
unsupported_function("glVertexPointer"); \
})
+#if defined(PIGLIT_USE_OPENGL_ES3)
static GLvoid*
glMapBuffer(GLenum target, GLbitfield access)
{
@@ -135,5 +178,6 @@ glMapBuffer(GLenum target, GLbitfield access)
return glMapBufferRange(target, 0, length, access);
}
+#endif /* PIGLIT_USE_OPENGL_ES3 */
-#endif /*PIGLIT_USE_OPENGL*/
+#endif /* PIGLIT_USE_OPENGL_ES3 || PIGLIT_USE_OPENGL_ES2 */
diff --git a/tests/util/CMakeLists.gles2.txt b/tests/util/CMakeLists.gles2.txt
index b0d5924a..04701041 100644
--- a/tests/util/CMakeLists.gles2.txt
+++ b/tests/util/CMakeLists.gles2.txt
@@ -1,5 +1,6 @@
set(UTIL_GL_SOURCES
${UTIL_GL_SOURCES}
+ piglit-vbo.cpp
piglit-shader.c
piglit-shader-gles2.c
piglit-util-gl-enum.c
diff --git a/tests/util/piglit-vbo.cpp b/tests/util/piglit-vbo.cpp
index f4fd890b..4900931e 100644
--- a/tests/util/piglit-vbo.cpp
+++ b/tests/util/piglit-vbo.cpp
@@ -286,9 +286,13 @@ vertex_attrib_description::setup(size_t *offset, size_t stride) const
this->data_type, GL_FALSE, stride,
(void *) *offset);
} else {
+#if defined(PIGLIT_USE_OPENGL_ES2)
+ fprintf(stderr,"vertex_attrib_description fail. no int support\n");
+#else
glVertexAttribIPointer(this->index, this->count,
this->data_type, stride,
(void *) *offset);
+#endif
}
glEnableVertexAttribArray(index);
*offset += ATTRIBUTE_SIZE * this->count;