[Piglit] [PATCH 09/16] namespace-pollution: Add glBlitFramebuffer as an operation to test
Ilia Mirkin
imirkin at alum.mit.edu
Wed Jan 6 19:39:53 PST 2016
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Wed, Jan 6, 2016 at 7:53 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
> ---
> tests/all.py | 2 +-
> tests/general/object-namespace-pollution.c | 72 ++++++++++++++++++++++++++++++
> 2 files changed, 73 insertions(+), 1 deletion(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index fc6a0df..c4350b0 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -4609,7 +4609,7 @@ with profile.group_manager(
> PiglitGLTest,
> grouptools.join('object namespace pollution')) as g:
> for object_type in ("buffer", "texture"):
> - for operation in ("glBitmap", "glClear", "glClearTexSubImage", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glTexSubImage2D"):
> + for operation in ("glBitmap", "glBlitFramebuffer", "glClear", "glClearTexSubImage", "glCopyPixels", "glCopyTexSubImage2D", "glDrawPixels", "glGenerateMipmap", "glGetTexImage", "glTexSubImage2D"):
> g(['object-namespace-pollution', operation, object_type],
> '{} with {}'.format(object_type, operation))
>
> diff --git a/tests/general/object-namespace-pollution.c b/tests/general/object-namespace-pollution.c
> index c4ba774..d4f7698 100644
> --- a/tests/general/object-namespace-pollution.c
> +++ b/tests/general/object-namespace-pollution.c
> @@ -431,6 +431,77 @@ do_Bitmap(bool silent_skip)
> }
>
> static bool
> +do_BlitFramebuffer(bool silent_skip)
> +{
> + const GLuint fbos[2] = { FIRST_SPARE_OBJECT, FIRST_SPARE_OBJECT + 1 };
> + const GLuint tex[2] = { FIRST_SPARE_OBJECT, FIRST_SPARE_OBJECT + 1 };
> + bool pass = true;
> +
> + /* GL_ARB_framebuffer_object and OpenGL 3.0 require that
> + * glGenFramebuffers be used. This test really does require
> + * GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit.
> + */
> + if (!(piglit_is_extension_supported("GL_EXT_framebuffer_object") &&
> + piglit_is_extension_supported("GL_EXT_framebuffer_blit"))) {
> + if (silent_skip)
> + return true;
> +
> + printf("%s requires EXT framebuffer objects.\n", __func__);
> + piglit_report_result(PIGLIT_SKIP);
> + }
> +
> + /* Generate the texture objects that will be attached to the
> + * framebuffer objects for the test.
> + */
> + glBindTexture(GL_TEXTURE_2D, tex[0]);
> + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0, GL_RGBA,
> + GL_UNSIGNED_BYTE, NULL);
> +
> + glBindTexture(GL_TEXTURE_2D, tex[1]);
> + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0, GL_RGBA,
> + GL_UNSIGNED_BYTE, NULL);
> +
> + glBindTexture(GL_TEXTURE_2D, 0);
> +
> + /* Generate the framebuffer objects. */
> + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, fbos[0]);
> + glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
> + GL_TEXTURE_2D, tex[0], 0 /* level */);
> + if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER) !=
> + GL_FRAMEBUFFER_COMPLETE) {
> + printf("\t%s,%d: Draw framebuffer is not complete.\n",
> + __func__, __LINE__);
> + pass = false;
> + }
> +
> + glBindFramebufferEXT(GL_READ_FRAMEBUFFER, fbos[1]);
> + glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
> + GL_TEXTURE_2D, tex[1], 0 /* level */);
> + if (glCheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER) !=
> + GL_FRAMEBUFFER_COMPLETE) {
> + printf("\t%s,%d: Read framebuffer is not complete.\n",
> + __func__, __LINE__);
> + pass = false;
> + }
> +
> + /* Do the "real" test. */
> + glBlitFramebufferEXT(0 /* srcX0 */, 0 /* srcY0 */,
> + 8 /* srcX1 */, 8 /* srcY1 */,
> + 0 /* dstX0 */, 0 /* dstY0 */,
> + 8 /* dstX1 */, 8 /* dstY1 */,
> + GL_COLOR_BUFFER_BIT, GL_NEAREST);
> +
> + /* Final clean up. */
> + glBindFramebufferEXT(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
> + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
> +
> + glDeleteTextures(ARRAY_SIZE(tex), tex);
> + glDeleteFramebuffersEXT(ARRAY_SIZE(fbos), fbos);
> +
> + return piglit_check_gl_error(GL_NO_ERROR) && pass;
> +}
> +
> +static bool
> do_Clear(bool silent_skip)
> {
> /* glClear is always supported, so there is no opportunity to skip. */
> @@ -712,6 +783,7 @@ static const struct {
> bool (*func)(bool silent_skip);
> } operations[] = {
> { "glBitmap", do_Bitmap },
> + { "glBlitFramebuffer", do_BlitFramebuffer },
> { "glClear", do_Clear },
> { "glClearTexSubImage", do_ClearTexSubImage },
> { "glCopyPixels", do_CopyPixels },
> --
> 2.5.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list