[Piglit] [PATCH] ext_framebuffer_multisample: fix sRGB MSAA resolve tests

Marek Olšák maraeo at gmail.com
Sat Dec 7 07:37:50 PST 2013


From: Marek Olšák <marek.olsak at amd.com>

When measuring accuracy, converting the values to the linear colorspace
increased the RMS error.

Tested on Radeon with both shader-based and hardware-based resolve operations.
---
 tests/spec/ext_framebuffer_multisample/common.cpp | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index 8bd4e4c..f0b4e9f 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -322,10 +322,23 @@ Test::resolve(Fbo *fbo, GLbitfield which_buffers)
 	glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->handle);
 	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo.handle);
 	resolve_fbo.set_viewport();
+
+	/* From the GL 4.4 compatibility specification:
+	 *   When values are written to the draw buffers, blit
+	 *   operations bypass most of the fragment pipeline.
+	 *   The only fragment operations which affect a blit are
+	 *   the pixel ownership test, the scissor test, and sRGB
+	 *   conversion (see section 17.3.9).
+	 *
+	 * Older specifications are lax this.
+	 */
+	if (srgb)
+           glEnable(GL_FRAMEBUFFER_SRGB);
 	glBlitFramebuffer(0, 0, fbo->config.width, fbo->config.height,
 			  0, 0, resolve_fbo.config.width,
 			  resolve_fbo.config.height,
 			  which_buffers, filter_mode);
+	glDisable(GL_FRAMEBUFFER_SRGB);
 }
 
 /**
@@ -508,14 +521,6 @@ Test::measure_accuracy()
 				int pixel_pos = 4*(y*pattern_width + x) + c;
 				float ref = reference_data[pixel_pos];
 				float test = test_data[pixel_pos];
-				/* When testing sRGB, compare pixels
-				 * linearly so that the measured error
-				 * is comparable to the non-sRGB case.
-				 */
-				if (srgb && c < 3) {
-					ref = piglit_srgb_to_linear(ref);
-					test = piglit_srgb_to_linear(test);
-				}
 				if (ref <= 0.0)
 					unlit_stats.record(test - ref);
 				else if (ref >= 1.0)
-- 
1.8.3.2



More information about the Piglit mailing list