[v2,15/15] nv_conditional_render: port vertex_array-test to gles2

Submitted by Erik Faye-Lund on Nov. 7, 2018, 9:14 p.m.

Details

Message ID 20181107211420.7355-16-erik.faye-lund@collabora.com
State New
Headers show
Series "port NV_conditional_render tests to GLES3" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Erik Faye-Lund Nov. 7, 2018, 9:14 p.m.
This test can relatively easily be ported to gles2, so let's do that for
better test-coverage.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
---
 tests/opengl.py                               |  1 +
 .../CMakeLists.gles2.txt                      |  1 +
 .../spec/nv_conditional_render/vertex_array.c | 24 +++++++++++++++++++
 3 files changed, 26 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/opengl.py b/tests/opengl.py
index 514df0244..9d56c0121 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3819,6 +3819,7 @@  with profile.test_list.group_manager(
     g(['nv_conditional_render-generatemipmap'], 'generatemipmap')
     g(['nv_conditional_render-generatemipmap_gles2'], 'generatemipmap_gles2')
     g(['nv_conditional_render-vertex_array'], 'vertex_array')
+    g(['nv_conditional_render-vertex_array_gles2'], 'vertex_array_gles2')
 
 with profile.test_list.group_manager(
         PiglitGLTest,
diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
index f2e5d7eda..ca7c81d2f 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
@@ -7,5 +7,6 @@  piglit_add_executable (nv_conditional_render-clear_gles2 clear.c common.c)
 piglit_add_executable (nv_conditional_render-copyteximage_gles2 copyteximage.c common.c)
 piglit_add_executable (nv_conditional_render-copytexsubimage_gles2 copytexsubimage.c common.c)
 piglit_add_executable (nv_conditional_render-generatemipmap_gles2 generatemipmap.c common.c)
+piglit_add_executable (nv_conditional_render-vertex_array_gles2 vertex_array.c common.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 84375bd25..2ec20ac35 100644
--- a/tests/spec/nv_conditional_render/vertex_array.c
+++ b/tests/spec/nv_conditional_render/vertex_array.c
@@ -44,12 +44,23 @@ 
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
+#ifdef PIGLIT_USE_OPENGL
 	config.supports_gl_compat_version = 10;
+#else // PIGLIT_USE_OPENGL_ES2
+	config.supports_gl_es_version = 20;
+#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 GLint prog_green, prog_red;
+
+#endif
+
 enum piglit_result
 piglit_display(void)
 {
@@ -63,7 +74,11 @@  piglit_display(void)
 	gen_queries(1, &q);
 
 	/* Generate query pass: draw bottom half of screen. */
+#ifdef PIGLIT_USE_OPENGL
 	glColor4f(0.0, 1.0, 0.0, 0.0);
+#else
+	glUseProgram(prog_green);
+#endif
 	query_rect_bottom(q);
 
 	/* Conditional render that should draw top half of screen. */
@@ -75,7 +90,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();
 
@@ -93,4 +112,9 @@  void
 piglit_init(int argc, char **argv)
 {
 	piglit_require_extension("GL_NV_conditional_render");
+
+#ifndef PIGLIT_USE_OPENGL
+	prog_green = build_green_program();
+	prog_red = build_texture_program();
+#endif
 }