[Piglit] [PATCH] ext_framebuffer_multisample: Add an option to run formats test for all sample counts

Anuj Phogat anuj.phogat at gmail.com
Thu Sep 11 11:22:41 PDT 2014


This new option verifies that a correct msaa resolve shader is compiled
and used following the change in source buffer sample count.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 tests/all.py                                       |  2 +-
 tests/spec/ext_framebuffer_multisample/formats.cpp | 34 ++++++++++++++++++----
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index a4b6a43..23d64ec 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2575,7 +2575,7 @@ for num_samples in MSAA_SAMPLE_COUNTS:
             test_name)
     ext_framebuffer_multisample[test_name] = concurrent_test(executable)
 
-for num_samples in MSAA_SAMPLE_COUNTS:
+for num_samples in ('all_samples', ) + MSAA_SAMPLE_COUNTS:
     test_name = ' '.join(['formats', str(num_samples)])
     executable = 'ext_framebuffer_multisample-{0}'.format(
             test_name)
diff --git a/tests/spec/ext_framebuffer_multisample/formats.cpp b/tests/spec/ext_framebuffer_multisample/formats.cpp
index 7a54851..8ee671d 100644
--- a/tests/spec/ext_framebuffer_multisample/formats.cpp
+++ b/tests/spec/ext_framebuffer_multisample/formats.cpp
@@ -62,7 +62,9 @@ namespace {
 
 const int pattern_width = 256; const int pattern_height = 256;
 
+bool all_samples = false;
 int num_samples;
+GLint max_samples;
 
 ColorGradientSunburst *test_pattern_vec4;
 ColorGradientSunburst *test_pattern_ivec4;
@@ -584,9 +586,13 @@ piglit_init(int argc, char **argv)
 
 	/* First argument (required): num_samples */
 	char *endptr = NULL;
-	num_samples = strtol(argv[1], &endptr, 0);
-	if (endptr != argv[1] + strlen(argv[1]))
-		print_usage_and_exit(argv[0]);
+	if (streq(argv[1], "all_samples"))
+		all_samples = true;
+	else {
+		num_samples = strtol(argv[1], &endptr, 0);
+		if (endptr != argv[1] + strlen(argv[1]))
+			print_usage_and_exit(argv[0]);
+	}
 
 	/* Second argument (optional): test_set */
 	int test_set = 0; /* Default to core */
@@ -598,7 +604,6 @@ piglit_init(int argc, char **argv)
 	piglit_require_extension("GL_ARB_vertex_array_object");
 
 	/* Skip the test if num_samples > GL_MAX_SAMPLES */
-	GLint max_samples;
 	glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
 	if (num_samples > max_samples)
 		piglit_report_result(PIGLIT_SKIP);
@@ -618,7 +623,26 @@ piglit_init(int argc, char **argv)
 extern "C" enum piglit_result
 piglit_display()
 {
-	return fbo_formats_display(test_format);
+	piglit_result result = PIGLIT_PASS;
+	bool pass = true;
+
+	if (!all_samples) {
+		return fbo_formats_display(test_format);
+	}
+
+	for (num_samples = 0; num_samples <= max_samples; ) {
+		result = fbo_formats_display(test_format);
+		printf("Samples = %d, Result = %s\n", num_samples,
+		       piglit_result_to_string(result));
+
+		num_samples = num_samples ? num_samples << 1 : num_samples + 2;
+
+		if (result == PIGLIT_SKIP)
+			return result;
+
+		pass = (result == PIGLIT_PASS) && pass;
+	}
+	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 };
-- 
1.9.3



More information about the Piglit mailing list