[Piglit] [PATCH 08/16] namespace-pollution: Add glGetTexImage as an operation to test

Ilia Mirkin imirkin at alum.mit.edu
Wed Jan 6 19:38:22 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 | 58 ++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+), 1 deletion(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 8cf5af6..fc6a0df 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", "glTexSubImage2D"):
> +        for operation in ("glBitmap", "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 6c70b33..c4ba774 100644
> --- a/tests/general/object-namespace-pollution.c
> +++ b/tests/general/object-namespace-pollution.c
> @@ -584,6 +584,63 @@ do_GenerateMipmap(bool silent_skip)
>  }
>
>  static bool
> +do_GetTexImage(bool silent_skip)
> +{
> +       const GLuint tex = FIRST_SPARE_OBJECT;
> +       const GLuint pbo = FIRST_SPARE_OBJECT;
> +       uint8_t data[TEXTURE_DATA_SIZE];
> +       bool pass = true;
> +
> +       if (!piglit_is_extension_supported("GL_EXT_pixel_buffer_object") &&
> +           piglit_get_gl_version() < 30) {
> +               if (silent_skip)
> +                       return true;
> +
> +               printf("%s requires pixel buffer objects.\n", __func__);
> +               piglit_report_result(PIGLIT_SKIP);
> +       }
> +
> +       if (glIsTexture(tex)) {
> +               printf("\t%s,%d: %u is already a texture\n",
> +                      __func__, __LINE__, tex);
> +               pass = false;
> +       }
> +
> +       if (glIsBuffer(pbo)) {
> +               printf("\t%s,%d: %u is already a buffer object\n",
> +                      __func__, __LINE__, pbo);
> +               pass = false;
> +       }
> +
> +       /* Generate the initial texture object.
> +        */
> +       generate_random_data(data, sizeof(data), GL_PIXEL_UNPACK_BUFFER, pbo);
> +       glBindTexture(GL_TEXTURE_2D, tex);
> +       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0, GL_RGBA,
> +                    GL_UNSIGNED_BYTE, data);
> +
> +
> +       /* Generate the buffer object that will be used for the PBO download
> +        * from the texture.
> +        */
> +       glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo);
> +       glBufferData(GL_PIXEL_PACK_BUFFER, sizeof(data), NULL, GL_STATIC_READ);
> +
> +       /* Do the "real" test. */
> +       glGetTexImage(GL_TEXTURE_2D, 0 /* level */,
> +                     GL_RGBA, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
> +
> +       /* Final clean up. */
> +       glBindTexture(GL_TEXTURE_2D, 0);
> +       glDeleteTextures(1, &tex);
> +
> +       glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
> +       glDeleteBuffers(1, &pbo);
> +
> +       return piglit_check_gl_error(GL_NO_ERROR) && pass;
> +}
> +
> +static bool
>  do_TexSubImage2D(bool silent_skip)
>  {
>         const GLuint tex = FIRST_SPARE_OBJECT;
> @@ -661,6 +718,7 @@ static const struct {
>         { "glCopyTexSubImage2D", do_CopyTexSubImage2D },
>         { "glDrawPixels", do_DrawPixels },
>         { "glGenerateMipmap", do_GenerateMipmap },
> +       { "glGetTexImage", do_GetTexImage },
>         { "glTexSubImage2D", do_TexSubImage2D },
>  };
>
> --
> 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