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/copyteximage.c | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt index f1b515eb2..b3ed8a50e 100644 --- a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt +++ b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt @@ -4,5 +4,6 @@ piglit_add_executable (nv_conditional_render-begin-while-active_gles3 begin-whil 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) +piglit_add_executable (nv_conditional_render-copyteximage_gles3 copyteximage.c) # vim: ft=cmake: diff --git a/tests/spec/nv_conditional_render/copyteximage.c b/tests/spec/nv_conditional_render/copyteximage.c index f6667a409..2a85b03d8 100644 --- a/tests/spec/nv_conditional_render/copyteximage.c +++ b/tests/spec/nv_conditional_render/copyteximage.c @@ -36,12 +36,47 @@ 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" + "attribute vec4 piglit_texcoord;\n" + "varying vec2 uv;\n" + "void main()\n" + "{\n" + " gl_Position = piglit_vertex;\n" + " uv = piglit_texcoord.xy;\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_tex = + "uniform sampler2D tex;\n" + "varying mediump vec2 uv;\n" + "void main()\n" + "{\n" + " gl_FragColor = texture2D(tex, uv);\n" + "}\n"; + +static GLint prog_green, prog_tex; + +#endif + static void fill_tex(int level, int w, int h, const GLubyte *color) { @@ -72,9 +107,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); @@ -99,10 +140,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); @@ -118,4 +165,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_tex = piglit_build_simple_program(vs_source, fs_source_tex); +#endif } -- 2.19.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit