This test can relatively easily be ported to gles3, so let's do that for
better test-coverage.

Signed-off-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
---
 .../CMakeLists.gles3.txt                      |  1 +
 .../spec/nv_conditional_render/vertex_array.c | 45 ++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt 
b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt
index 26097edc0..4f0fcc17c 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt
@@ -7,5 +7,6 @@ piglit_add_executable (nv_conditional_render-clear_gles3 
clear.c)
 piglit_add_executable (nv_conditional_render-copyteximage_gles3 copyteximage.c)
 piglit_add_executable (nv_conditional_render-copytexsubimage_gles3 
copytexsubimage.c)
 piglit_add_executable (nv_conditional_render-generatemipmap_gles3 
generatemipmap.c)
+piglit_add_executable (nv_conditional_render-vertex_array_gles3 vertex_array.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/nv_conditional_render/vertex_array.c 
b/tests/spec/nv_conditional_render/vertex_array.c
index 4c5ed25f9..c0af6efc8 100644
--- a/tests/spec/nv_conditional_render/vertex_array.c
+++ b/tests/spec/nv_conditional_render/vertex_array.c
@@ -43,12 +43,42 @@
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
+#ifdef PIGLIT_USE_OPENGL
        config.supports_gl_compat_version = 10;
+#else // PIGLIT_USE_OPENGL_ES3
+       config.supports_gl_es_version = 30;
+#endif
+
        config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
        config.khr_no_error_support = PIGLIT_NO_ERRORS;
 
 PIGLIT_GL_TEST_CONFIG_END
 
+#ifndef PIGLIT_USE_OPENGL
+
+static const char *vs_source =
+       "attribute vec4 piglit_vertex;\n"
+       "void main()\n"
+       "{\n"
+       "  gl_Position = piglit_vertex;\n"
+       "}\n";
+
+static const char *fs_source_green =
+       "void main()\n"
+       "{\n"
+       "  gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);\n"
+       "}\n";
+
+static const char *fs_source_red =
+       "void main()\n"
+       "{\n"
+       "  gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);\n"
+       "}\n";
+
+static GLint prog_green, prog_red;
+
+#endif
+
 enum piglit_result
 piglit_display(void)
 {
@@ -62,8 +92,12 @@ piglit_display(void)
        glGenQueries(1, &q);
 
        /* Generate query pass: draw bottom half of screen. */
-       glColor4f(0.0, 1.0, 0.0, 0.0);
        glBeginQuery(GL_SAMPLES_PASSED, q);
+#ifdef PIGLIT_USE_OPENGL
+       glColor4f(0.0, 1.0, 0.0, 0.0);
+#else
+       glUseProgram(prog_green);
+#endif
        piglit_draw_rect(-1, -1, 2, 1);
        glEndQuery(GL_SAMPLES_PASSED);
 
@@ -78,7 +112,11 @@ piglit_display(void)
 
        /* Conditional render that should not draw full screen. */
        glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
+#ifdef PIGLIT_USE_OPENGL
        glColor4f(1.0, 0.0, 0.0, 0.0);
+#else
+       glUseProgram(prog_red);
+#endif
        piglit_draw_rect(-1, -1, 2, 2);
        glEndConditionalRenderNV();
 
@@ -96,4 +134,9 @@ void
 piglit_init(int argc, char **argv)
 {
        piglit_require_extension("GL_NV_conditional_render");
+
+#ifndef PIGLIT_USE_OPENGL
+       prog_green = piglit_build_simple_program(vs_source, fs_source_green);
+       prog_red = piglit_build_simple_program(vs_source, fs_source_red);
+#endif
 }
-- 
2.19.1

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

Reply via email to