This specification is also supported on gles2, so let's add support
for gles2 to the test also.

Signed-off-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
---
 tests/texturing/CMakeLists.gles2.txt |  5 +++
 tests/texturing/s3tc-teximage.c      | 48 ++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 tests/texturing/CMakeLists.gles2.txt

diff --git a/tests/texturing/CMakeLists.gles2.txt 
b/tests/texturing/CMakeLists.gles2.txt
new file mode 100644
index 000000000..de4c1a53c
--- /dev/null
+++ b/tests/texturing/CMakeLists.gles2.txt
@@ -0,0 +1,5 @@
+link_libraries(piglitutil_${piglit_target_api})
+
+piglit_add_executable (s3tc-teximage_gles2 s3tc-teximage.c)
+
+# vim: ft=cmake:
diff --git a/tests/texturing/s3tc-teximage.c b/tests/texturing/s3tc-teximage.c
index a7225f6f0..1b65f6ce1 100644
--- a/tests/texturing/s3tc-teximage.c
+++ b/tests/texturing/s3tc-teximage.c
@@ -36,7 +36,11 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
+#ifdef PIGLIT_USE_OPENGL
        config.supports_gl_compat_version = 11;
+#else // PIGLIT_USE_OPENGL_ES2
+       config.supports_gl_es_version = 20;
+#endif
 
        config.window_width = 500;
        config.window_height = 600;
@@ -52,12 +56,45 @@ const float green[4] = {0.0, 1.0, 0.0, 1.0};
 const float blue[4] =  {0.0, 0.0, 1.0, 1.0};
 const float white[4] = {1.0, 1.0, 1.0, 1.0};
 
+#ifdef  PIGLIT_USE_OPENGL_ES2
+
+const char *vs_source =
+       "#version 100\n"
+       "attribute vec4 piglit_vertex;\n"
+       "attribute vec2 piglit_texcoord;\n"
+       "varying mediump vec2 tex_coord;\n"
+       "uniform mat4 proj;\n"
+       "\n"
+       "void main()\n"
+       "{\n"
+       "        gl_Position = proj * piglit_vertex;\n"
+       "        tex_coord = piglit_texcoord;\n"
+       "}\n";
+
+const char *fs_source =
+       "#version 100\n"
+       "varying mediump vec2 tex_coord;\n"
+       "uniform sampler2D tex;\n"
+       "\n"
+       "void main()\n"
+       "{\n"
+       "        gl_FragColor = texture2D(tex, tex_coord);\n"
+       "}\n";
+
+#include "piglit-matrix.h"
+
+GLint tex_program;
+
+#endif
+
 static void
 display_mipmaps(int start_x, int start_y)
 {
        int i;
 
+#ifdef PIGLIT_USE_OPENGL
        glEnable(GL_TEXTURE_2D);
+#endif
 
        /* Disply all the mipmap levels */
        for (i = SIZE; i > 0; i /= 2) {
@@ -144,5 +181,16 @@ piglit_init(int argc, char **argv)
 {
        piglit_require_extension("GL_EXT_texture_compression_s3tc");
 
+#ifdef PIGLIT_USE_OPENGL
+
        piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+#else // PIGLIT_USE_OPENGL_ES2
+
+       tex_program = piglit_build_simple_program(vs_source, fs_source);
+       glUseProgram(tex_program);
+       GLint proj_loc = glGetUniformLocation(tex_program, "proj");
+       piglit_ortho_uniform(proj_loc, piglit_width, piglit_height);
+
+#endif
 }
-- 
2.17.2

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to