[Piglit] [PATCH 11/17] ext_framebuffer_multisample: sample-alpha- also against RGBA16F/32F

Topi Pohjolainen topi.pohjolainen at gmail.com
Tue Jul 18 19:16:36 UTC 2017


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 .../sample-alpha-to-coverage.cpp                   | 41 +++++++++++++++-------
 1 file changed, 28 insertions(+), 13 deletions(-)

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 7b756ba83..2b4b3f735 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp
@@ -53,7 +53,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
+const unsigned num_attachments = 1;
+static int samples;
 static GLenum buffer_to_test;
+static unsigned pattern_width, pattern_height;
 
 void
 print_usage_and_exit(char *prog_name)
@@ -69,9 +72,6 @@ print_usage_and_exit(char *prog_name)
 void
 piglit_init(int argc, char **argv)
 {
-	const int num_attachments = 1;
-	int samples;
-
 	piglit_require_gl_version(21);
 	piglit_require_extension("GL_ARB_framebuffer_object");
 	piglit_require_extension("GL_ARB_vertex_array_object");
@@ -93,8 +93,8 @@ piglit_init(int argc, char **argv)
 	} else
 		print_usage_and_exit(argv[0]);
 
-	int pattern_width = piglit_width / 2;
-	int pattern_height = piglit_height / num_attachments;
+	pattern_width = piglit_width / 2;
+	pattern_height = piglit_height / num_attachments;
 
 	piglit_ortho_projection(pattern_width,
 				pattern_height,
@@ -107,21 +107,23 @@ piglit_init(int argc, char **argv)
 	if (samples > max_samples)
 		piglit_report_result(PIGLIT_SKIP);
 
-	ms_fbo_and_draw_buffers_setup(samples,
-				      pattern_width,
-				      pattern_height,
-				      num_attachments,
-				      buffer_to_test,
-				      GL_RGBA);
 	shader_compile(true /* sample_alpha_to_coverage */,
 		       false /* dual_src_blend */,
 		       true /* frag_out_zero_write */);
 }
 
-enum piglit_result
-piglit_display()
+static bool
+test_format(GLenum color_internal_format)
 {
 	bool pass = true;
+
+	ms_fbo_and_draw_buffers_setup(samples,
+				      pattern_width,
+				      pattern_height,
+				      num_attachments,
+				      buffer_to_test,
+				      color_internal_format);
+
 	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
 	glClearColor(0.0, 0.0, 0.0, 1.0);
 	glClear(GL_COLOR_BUFFER_BIT);
@@ -155,6 +157,19 @@ piglit_display()
 	/* Free the memory allocated for data arrays */
 	free_data_arrays();
 
+	return pass;
+}
+
+enum piglit_result
+piglit_display()
+{
+	bool pass = test_format(GL_RGBA);
+
+	if (buffer_to_test == GL_COLOR_BUFFER_BIT) {
+	       pass &= test_format(GL_RGBA16F);
+	       pass &= test_format(GL_RGBA32F);
+	}
+
 	if (!piglit_automatic && buffer_to_test == GL_COLOR_BUFFER_BIT)
 		piglit_present_results();
 
-- 
2.11.0



More information about the Piglit mailing list