[Piglit] [PATCH] msaa: Avoid undefined behavior in visualize_image function
Anuj Phogat
anuj.phogat at gmail.com
Wed Aug 22 11:29:25 PDT 2012
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 <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
More information about the Piglit
mailing list