[Piglit] [PATCH] ext_framebuffer_multisample: add --alpha-to-one option to coverage test

Brian Paul brianp at vmware.com
Fri Aug 4 17:03:33 UTC 2017


Alpha-to-one only makes sense when used with alpha-to-coverage.  This
patch adds a flag to the alpha-to-coverage test to exercise alpha-to-one.
This will fail with drivers which emulate alpha-to-one in the FS.
---
 tests/all.py                                                  |  4 ++++
 .../ext_framebuffer_multisample/sample-alpha-to-coverage.cpp  | 11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index ae55425..abe6185 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -3044,6 +3044,10 @@ with profile.test_list.group_manager(
                sample_count, buffer_type],
               'sample-alpha-to-coverage {} {}'.format(
                   sample_count, buffer_type))
+            g(['ext_framebuffer_multisample-sample-alpha-to-coverage',
+               sample_count, buffer_type, '--alpha-to-one'],
+              'sample-alpha-to-coverage-alpha-to-one {} {}'.format(
+                  sample_count, buffer_type))
 
         for test in ['line-smooth', 'point-smooth', 'polygon-smooth',
                      'sample-alpha-to-one',
diff --git a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
index 7b756ba..32b4161 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
@@ -54,11 +54,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 PIGLIT_GL_TEST_CONFIG_END
 
 static GLenum buffer_to_test;
+static bool alpha_to_one = false;
 
 void
 print_usage_and_exit(char *prog_name)
 {
-	printf("Usage: %s <num_samples> <test_type>\n"
+	printf("Usage: %s <num_samples> <test_type> [--alpha-to-one]\n"
 	       "  where <test_type> is one of:\n"
 	       "    color\n"
 	       "    depth\n",
@@ -93,6 +94,10 @@ piglit_init(int argc, char **argv)
 	} else
 		print_usage_and_exit(argv[0]);
 
+	if (argc == 4 && strcmp(argv[3], "--alpha-to-one") == 0) {
+		alpha_to_one = true;
+	}
+
 	int pattern_width = piglit_width / 2;
 	int pattern_height = piglit_height / num_attachments;
 
@@ -133,10 +138,10 @@ piglit_display()
 	 */
 	if(buffer_to_test == GL_COLOR_BUFFER_BIT)
 		draw_reference_image(true /* sample_alpha_to_coverage */,
-				     false /* sample_alpha_to_one */);
+				     alpha_to_one);
 
 	draw_test_image(true /* sample_alpha_to_coverage */,
-			false /* sample_alpha_to_one */);
+			alpha_to_one);
 
 	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
 
-- 
1.9.1



More information about the Piglit mailing list