[Piglit] [PATCH] ext_render_snorm-render: change verify_contents to use base_format size

Ilia Mirkin imirkin at alum.mit.edu
Wed Aug 29 11:44:58 UTC 2018


On Wed, Aug 29, 2018 at 3:33 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> OpenGL ES 3.1 specification lists valid combinations for format, type
> and internalformat for transfer of pixel rectangles. This change follows
> the table 8.4 in spec so that we use exact same number of components
> for format as is expected from corresponding internalformat.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  tests/spec/ext_render_snorm/render.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tests/spec/ext_render_snorm/render.c b/tests/spec/ext_render_snorm/render.c
> index 3df16991e..ec1856806 100644
> --- a/tests/spec/ext_render_snorm/render.c
> +++ b/tests/spec/ext_render_snorm/render.c
> @@ -203,15 +203,15 @@ verify_contents(const struct fmt_test *test)
>  {
>         bool result = true;
>         unsigned amount = piglit_width * piglit_height;
> -       void *pix = malloc(amount * 4);
> -       glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA, GL_BYTE, pix);
> +       void *pix = malloc(amount * test->bpp);
> +       glReadPixels(0, 0, piglit_width, piglit_height, test->base_format, GL_BYTE, pix);
>
> -       char value[4] = { 0, 0, 0, SCHAR_MAX };
> +       char *value = malloc(test->bpp);

You never free this. Might be easier to just have it be a
stack-allocated array though as it was before.

>         value_for_format(test, value);
>
>         char *p = pix;
> -       for (unsigned i = 0; i < amount; i++, p += 4) {
> -               if (memcmp(p, value, sizeof(value)) == 0)
> +       for (unsigned i = 0; i < amount; i++, p += test->bpp) {
> +               if (memcmp(p, value, test->bpp * sizeof(char)) == 0)
>                         continue;
>
>                  fprintf(stderr, "value:\n%d % d %d %d\nexpect:\n%d %d %d %d",
> --
> 2.13.6
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list