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 + .../nv_conditional_render/blitframebuffer.c | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt index 5cd5970ff..47884c340 100644 --- a/tests/spec/nv_conditional_render/CMakeLists.gles3.txt +++ b/tests/spec/nv_conditional_render/CMakeLists.gles3.txt @@ -2,5 +2,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) # vim: ft=cmake: diff --git a/tests/spec/nv_conditional_render/blitframebuffer.c b/tests/spec/nv_conditional_render/blitframebuffer.c index 3dd0d2efe..bae350790 100644 --- a/tests/spec/nv_conditional_render/blitframebuffer.c +++ b/tests/spec/nv_conditional_render/blitframebuffer.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) { GLubyte *data; @@ -64,14 +99,22 @@ static void blit_window_to_tex(GLuint tex, int w, int h) GLuint fb; glGenFramebuffersEXT(1, &fb); +#ifdef PIGLIT_USE_OPENGL glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); +#else + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb); +#endif glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0); assert(glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT); glBlitFramebufferEXT(0, h, w, 2 * h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_LINEAR); +#ifdef PIGLIT_USE_OPENGL glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo); +#else + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo); +#endif glDeleteFramebuffersEXT(1, &fb); } @@ -87,9 +130,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 green texture. */ glGenTextures(1, &texture); @@ -115,10 +164,16 @@ piglit_display(void) glEndConditionalRenderNV(); /* Draw the texture to top half of the window. */ +#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, piglit_width / 2, piglit_width, piglit_height / 2, @@ -135,6 +190,12 @@ void piglit_init(int argc, char **argv) { piglit_require_extension("GL_NV_conditional_render"); + +#ifdef PIGLIT_USE_OPENGL piglit_require_extension("GL_EXT_framebuffer_object"); piglit_require_extension("GL_EXT_framebuffer_blit"); +#else + 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