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

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

Details

Message ID 20181107211420.7355-14-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 +
 .../nv_conditional_render/copytexsubimage.c   | 28 +++++++++++++++++++
 3 files changed, 30 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/opengl.py b/tests/opengl.py
index 5f13483b5..811f8e131 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3813,6 +3813,7 @@  with profile.test_list.group_manager(
     g(['nv_conditional_render-copyteximage'], 'copyteximage')
     g(['nv_conditional_render-copyteximage_gles3'], 'copyteximage_gles3')
     g(['nv_conditional_render-copytexsubimage'], 'copytexsubimage')
+    g(['nv_conditional_render-copytexsubimage_gles3'], 'copytexsubimage_gles3')
     g(['nv_conditional_render-dlist'], 'dlist')
     g(['nv_conditional_render-drawpixels'], 'drawpixels')
     g(['nv_conditional_render-generatemipmap'], 'generatemipmap')
diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
index f503e1f28..46a8f660b 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
@@ -5,5 +5,6 @@  piglit_add_executable (nv_conditional_render-begin-zero_gles2 begin-zero.c)
 piglit_add_executable (nv_conditional_render-blitframebuffer_gles3 blitframebuffer.c common.c)
 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)
 
 # vim: ft=cmake:
diff --git a/tests/spec/nv_conditional_render/copytexsubimage.c b/tests/spec/nv_conditional_render/copytexsubimage.c
index a45c41320..e16973fca 100644
--- a/tests/spec/nv_conditional_render/copytexsubimage.c
+++ b/tests/spec/nv_conditional_render/copytexsubimage.c
@@ -37,12 +37,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_tex;
+
+#endif
+
 enum piglit_result
 piglit_display(void)
 {
@@ -55,9 +66,15 @@  piglit_display(void)
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	/* Draw bottom half of window to green. */
+#ifdef PIGLIT_USE_OPENGL
 	glColor4fv(green);
+#else
+	glUseProgram(prog_green);
+#endif
 	piglit_draw_rect(-1, -1, 2, 1);
+#ifdef PIGLIT_USE_OPENGL
 	glColor4f(1, 1, 1, 1);
+#endif
 
 	/* Set up a red texture. */
 	glGenTextures(1, &texture);
@@ -79,10 +96,16 @@  piglit_display(void)
 	glEndConditionalRenderNV();
 
 	/* Draw the right half of the texture. */
+#ifdef PIGLIT_USE_OPENGL
 	glEnable(GL_TEXTURE_2D);
+#else
+	glUseProgram(prog_tex);
+#endif
 	piglit_draw_rect_tex(-1, 0, 2, 1,
 			     0.5, 0, 1, 1);
+#ifdef PIGLIT_USE_OPENGL
 	glDisable(GL_TEXTURE_2D);
+#endif
 
 	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
 				      green);
@@ -98,4 +121,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_tex = build_texture_program();
+#endif
 }