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.

Reported-by: Vadim Girlin <[email protected]>
Signed-off-by: Anuj Phogat <[email protected]>
---
 .../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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to