[Piglit] [PATCH 2/3] Test upsampling blits in GL_LINEAR filter mode.

Paul Berry stereotype441 at gmail.com
Sun Oct 27 15:50:46 CET 2013


Since upsampling blits require the source and destination rectangles
to be exactly the same size, GL_LINEAR and GL_NEAREST filtering should
be equivalent.  So just add an option to the "upsample" test that
causes it to do a GL_LINEAR upsampling blit.
---
 tests/all.tests                                     | 11 ++++++++---
 tests/spec/ext_framebuffer_multisample/upsample.cpp | 15 +++++++++++++--
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/tests/all.tests b/tests/all.tests
index 6b04c64..284440a 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1718,10 +1718,15 @@ for num_samples in MSAA_SAMPLE_COUNTS:
 
 for num_samples in MSAA_SAMPLE_COUNTS:
     for buffer_type in ('color', 'depth', 'stencil'):
-        test_name = ' '.join(['upsample', str(num_samples), buffer_type])
-        executable = 'ext_framebuffer_multisample-{0} -auto'.format(
+        sensible_options = []
+        if buffer_type == 'color':
+            sensible_options.append('linear')
+        for options in power_set(sensible_options):
+            test_name = ' '.join(['upsample', str(num_samples), buffer_type]
+                                 + options)
+            executable = 'ext_framebuffer_multisample-{0} -auto'.format(
                 test_name)
-        ext_framebuffer_multisample[test_name] = PlainExecTest(executable)
+            ext_framebuffer_multisample[test_name] = PlainExecTest(executable)
 
 for num_samples in MSAA_SAMPLE_COUNTS:
     for buffer_type in ('color', 'depth', 'stencil'):
diff --git a/tests/spec/ext_framebuffer_multisample/upsample.cpp b/tests/spec/ext_framebuffer_multisample/upsample.cpp
index 10e5ad7..67854bf 100644
--- a/tests/spec/ext_framebuffer_multisample/upsample.cpp
+++ b/tests/spec/ext_framebuffer_multisample/upsample.cpp
@@ -71,6 +71,7 @@ Fbo multisample_fbo;
 TestPattern *test_pattern = NULL;
 ManifestProgram *manifest_program = NULL;
 GLbitfield buffer_to_test;
+GLenum filter_mode = GL_NEAREST;
 
 void
 print_usage_and_exit(char *prog_name)
@@ -79,7 +80,9 @@ print_usage_and_exit(char *prog_name)
 	       "  where <buffer_type> is one of:\n"
 	       "    color\n"
 	       "    stencil\n"
-	       "    depth\n",
+	       "    depth\n"
+	       "Available options:\n"
+	       "    linear: use GL_LINEAR filter mode\n",
 	       prog_name);
 	piglit_report_result(PIGLIT_FAIL);
 }
@@ -121,6 +124,14 @@ piglit_init(int argc, char **argv)
 	} else {
 		print_usage_and_exit(argv[0]);
 	}
+
+	for (int i = 3; i < argc; i++) {
+		if (strcmp(argv[i], "linear") == 0)
+			filter_mode = GL_LINEAR;
+		else
+			print_usage_and_exit(argv[0]);
+	}
+
 	test_pattern->compile();
 	if (manifest_program)
 		manifest_program->compile();
@@ -158,7 +169,7 @@ piglit_display()
 	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisample_fbo.handle);
 	glBlitFramebuffer(pattern_width, 0, pattern_width*2, pattern_height,
 			  0, 0, pattern_width, pattern_height,
-			  buffer_to_test, GL_NEAREST);
+			  buffer_to_test, filter_mode);
 
 	if (manifest_program) {
 		/* Manifest the test pattern in the main framebuffer. */
-- 
1.8.4.1



More information about the Piglit mailing list