[Piglit] [PATCH 06/10] nv_conditional_render: port clear-test to gles3
Erik Faye-Lund
erik.faye-lund at collabora.com
Mon Nov 5 17:23:31 UTC 2018
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-lund at collabora.com>
---
.../CMakeLists.gles3.txt | 1 +
tests/spec/nv_conditional_render/clear.c | 34 ++++++++++++++++++-
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt
index 47884c340..f1b515eb2 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt
@@ -3,5 +3,6 @@ link_libraries(piglitutil_${piglit_target_api})
piglit_add_executable (nv_conditional_render-begin-while-active_gles3 begin-while-active.c)
piglit_add_executable (nv_conditional_render-begin-zero_gles3 begin-zero.c)
piglit_add_executable (nv_conditional_render-blitframebuffer_gles3 blitframebuffer.c)
+piglit_add_executable (nv_conditional_render-clear_gles3 clear.c)
# vim: ft=cmake:
diff --git a/tests/spec/nv_conditional_render/clear.c b/tests/spec/nv_conditional_render/clear.c
index 288239d06..5c9cf62a9 100644
--- a/tests/spec/nv_conditional_render/clear.c
+++ b/tests/spec/nv_conditional_render/clear.c
@@ -42,12 +42,36 @@
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 GLint prog_green;
+
+#endif
+
enum piglit_result
piglit_display(void)
{
@@ -61,8 +85,12 @@ piglit_display(void)
glGenQueries(1, &q);
/* Generate query pass: draw top 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, 0, 2, 1);
glEndQuery(GL_SAMPLES_PASSED);
@@ -96,4 +124,8 @@ 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);
+#endif
}
--
2.19.1
More information about the Piglit
mailing list