[Piglit] [PATCH] msaa: Avoid undefined behavior in visualize_image function

Paul Berry stereotype441 at gmail.com
Wed Aug 22 14:24:27 PDT 2012


On 22 August 2012 11:29, Anuj Phogat <anuj.phogat at gmail.com> wrote:

> Test uses glDrawPixels with dual source blending and fixed function
> pipeline in visualize_image(). According to ARB_blend_func_extended
> specs:
>
> "Rendering using any of the blend functions that consume the second
> input color (SRC1_COLOR, ONE_MINUS_SRC1_COLOR, SRC1_ALPHA or
> ONE_MINUS_SRC1_ALPHA) using fixed function will produce undefined
> results."
>
> Fix this by disabling the blending temporarily in visualize_image
> function.
>

Looks good to me.

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


>
> Reported-by: Vadim Girlin <vadimgirlin at gmail.com>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  .../draw-buffers-common.cpp                        |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git
> a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> index 1a898b2..6f54dfe 100644
> --- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> +++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
> @@ -699,9 +699,19 @@ draw_image_to_window_system_fb(int draw_buffer_count,
> bool rhs)
>                              GL_RGBA,
>                              GL_FLOAT, image);
>         }
> +
> +       /* Rendering using gldrawPixels() with dual source blending enabled
> +        * produces undefined results. So, disable blending in
> visualize_image
> +        * function to avoid undefined behavior.
> +        */
> +       GLboolean isBlending;
> +        glGetBooleanv(GL_BLEND, &isBlending);
> +       glDisable(GL_BLEND);
>         visualize_image(image, GL_RGBA,
>                         pattern_width, pattern_height,
>                         draw_buffer_count + 1, rhs);
> +       if(isBlending)
> +               glEnable(GL_BLEND);
>         free(image);
>  }
>
> --
> 1.7.7.6
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120822/6e8eb700/attachment.html>


More information about the Piglit mailing list