[Piglit] [PATCH] ext_framebuffer_multisample: Add testing for fast clear color path

Anuj Phogat anuj.phogat at gmail.com
Thu May 8 15:13:55 PDT 2014


This test currently fails on i965 fast clear color path.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 tests/spec/ext_framebuffer_multisample/clear.cpp | 30 ++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/clear.cpp b/tests/spec/ext_framebuffer_multisample/clear.cpp
index c5cf31e..1dc41c7 100644
--- a/tests/spec/ext_framebuffer_multisample/clear.cpp
+++ b/tests/spec/ext_framebuffer_multisample/clear.cpp
@@ -140,8 +140,9 @@ piglit_init(int argc, char **argv)
 }
 
 
-extern "C" enum piglit_result
-piglit_display()
+bool
+test_clear(const float r, const float g, const float b,
+	   const float a, const bool fast_clear_compatible)
 {
 	bool pass = true;
 
@@ -159,7 +160,7 @@ piglit_display()
 	 * GL_SAMPLE_ALPHA_TO_COVERAGE and GL_SAMPLE_ALPHA_TO_ONE
 	 * don't take effect.
 	 */
-	glClearColor(1.0, 1.0, 1.0, 0.5);
+	glClearColor(r, g, b, a);
 	glClearDepth(0.5);
 	glClearStencil(1);
 
@@ -214,7 +215,7 @@ piglit_display()
          *   blue, since the ManifestStencil program converts a
          *   stencil value of 1 to blue.
 	 */
-	static const float expected_color[4] = { 1.0, 1.0, 1.0, 0.5 };
+	const float expected_color[4] = { r, g, b, a };
 	static const float expected_depth[4] = { 1.0, 0.0, 0.0, 1.0 };
 	static const float expected_stencil[4] = { 0.0, 0.0, 1.0, 1.0 };
 	const float *expected = NULL;
@@ -243,8 +244,29 @@ piglit_display()
 	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
 				      expected) && pass;
 
+	if (buffer_to_test == GL_COLOR_BUFFER_BIT)
+		printf("fast_clear_compatible = %s, result = %s\n",
+		       fast_clear_compatible ? "true" : "false",
+		       pass ? "pass" : "fail");
+
 	piglit_present_results();
 
+	return pass;
+}
+
+extern "C" enum piglit_result
+piglit_display()
+{
+	bool pass =true;
+
+	/* Non 'fast clear' path. */
+	pass = test_clear(1.0, 1.0, 1.0, 0.5, false) && pass;
+
+	/* Test with color values compatible with 'fast clear'. It varifies
+	 * the 'fast clear' path if supported by the implementation.
+	 */
+	pass = test_clear(1.0, 1.0, 1.0, 0.0, true) && pass;
+
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-- 
1.8.3.1



More information about the Piglit mailing list