[Piglit] [PATCH v2 10/15] nv_conditional_render: port blitframebuffer-test to gles3
Erik Faye-Lund
erik.faye-lund at collabora.com
Wed Nov 7 21:14:15 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>
---
tests/opengl.py | 1 +
.../CMakeLists.gles2.txt | 1 +
.../nv_conditional_render/blitframebuffer.c | 37 +++++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/tests/opengl.py b/tests/opengl.py
index b3a624512..41aead3f7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3806,6 +3806,7 @@ with profile.test_list.group_manager(
g(['nv_conditional_render-begin-zero_gles2'], 'begin-zero_gles2')
g(['nv_conditional_render-bitmap'], 'bitmap')
g(['nv_conditional_render-blitframebuffer'], 'blitframebuffer')
+ g(['nv_conditional_render-blitframebuffer_gles3'], 'blitframebuffer_gles3')
g(['nv_conditional_render-clear'], 'clear')
g(['nv_conditional_render-copypixels'], 'copypixels')
g(['nv_conditional_render-copyteximage'], 'copyteximage')
diff --git a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
index 227134cd0..cb4a87098 100644
--- a/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
+++ b/tests/spec/nv_conditional_render/CMakeLists.gles2.txt
@@ -2,5 +2,6 @@ link_libraries(piglitutil_${piglit_target_api})
piglit_add_executable (nv_conditional_render-begin-while-active_gles2 begin-while-active.c common.c)
piglit_add_executable (nv_conditional_render-begin-zero_gles2 begin-zero.c)
+piglit_add_executable (nv_conditional_render-blitframebuffer_gles3 blitframebuffer.c common.c)
# vim: ft=cmake:
diff --git a/tests/spec/nv_conditional_render/blitframebuffer.c b/tests/spec/nv_conditional_render/blitframebuffer.c
index 37e639073..43a6bcf15 100644
--- a/tests/spec/nv_conditional_render/blitframebuffer.c
+++ b/tests/spec/nv_conditional_render/blitframebuffer.c
@@ -37,25 +37,44 @@
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 GLint prog_green, prog_tex;
+
+#endif
+
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);
}
@@ -71,9 +90,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);
@@ -96,10 +121,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,
@@ -116,6 +147,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 = build_green_program();
+ prog_tex = build_texture_program();
+#endif
}
--
2.19.1
More information about the Piglit
mailing list