[Piglit] [PATCH v2 12/15] nv_conditional_render: port copyteximage-test to gles2

Erik Faye-Lund erik.faye-lund at collabora.com
Wed Nov 7 21:14:17 UTC 2018


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 at collabora.com>
---
 tests/opengl.py                               |  1 +
 .../CMakeLists.gles2.txt                      |  1 +
 .../spec/nv_conditional_render/copyteximage.c | 28 +++++++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/tests/opengl.py b/tests/opengl.py
index 5595521c2..5f13483b5 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3811,6 +3811,7 @@ with profile.test_list.group_manager(
     g(['nv_conditional_render-clear_gles2'], 'clear_gles2')
     g(['nv_conditional_render-copypixels'], 'copypixels')
     g(['nv_conditional_render-copyteximage'], 'copyteximage')
+    g(['nv_conditional_render-copyteximage_gles3'], 'copyteximage_gles3')
     g(['nv_conditional_render-copytexsubimage'], 'copytexsubimage')
     g(['nv_conditional_render-dlist'], 'dlist')
     g(['nv_conditional_render-drawpixels'], 'drawpixels')
diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
index 926ff7f30..f503e1f28 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
@@ -4,5 +4,6 @@ piglit_add_executable (nv_conditional_render-begin-while-active_gles2 begin-whil
 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)
 
 # vim: ft=cmake:
diff --git a/tests/spec/nv_conditional_render/copyteximage.c b/tests/spec/nv_conditional_render/copyteximage.c
index aa1f05551..e4e759327 100644
--- a/tests/spec/nv_conditional_render/copyteximage.c
+++ b/tests/spec/nv_conditional_render/copyteximage.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 texture. */
+#ifdef PIGLIT_USE_OPENGL
 	glEnable(GL_TEXTURE_2D);
+#else
+	glUseProgram(prog_tex);
+#endif
 	piglit_draw_rect_tex(-1, 0, 2, 1,
 			     0, 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
 }
-- 
2.19.1



More information about the Piglit mailing list