[Piglit] [PATCH 2/2] Use utility function piglit_srgb_to_linear()

Anuj Phogat anuj.phogat at gmail.com
Tue Aug 20 16:04:05 PDT 2013


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 tests/spec/ext_framebuffer_multisample/common.cpp | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp
index c96a935..89d07dd 100644
--- a/tests/spec/ext_framebuffer_multisample/common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/common.cpp
@@ -477,20 +477,6 @@ Test::draw_reference_image()
 }
 
 /**
- * Convert from sRGB color space to linear color space, using the
- * formula from the GL 3.0 spec, section 4.1.8 (sRGB Texture Color
- * Conversion).
- */
-float
-decode_srgb(float x)
-{
-	if (x <= 0.0405)
-		return x / 12.92;
-	else
-		return pow((x + 0.055) / 1.055, 2.4);
-}
-
-/**
  * Measure the accuracy of MSAA downsampling.  Pixels that are fully
  * on or off in the reference image are required to be fully on or off
  * in the test image.  Pixels that are not fully on or off in the
@@ -528,8 +514,8 @@ Test::measure_accuracy()
 				 * is comparable to the non-sRGB case.
 				 */
 				if (srgb && c < 3) {
-					ref = decode_srgb(ref);
-					test = decode_srgb(test);
+					ref = piglit_srgb_to_linear(ref);
+					test = piglit_srgb_to_linear(test);
 				}
 				if (ref <= 0.0)
 					unlit_stats.record(test - ref);
-- 
1.8.1.4



More information about the Piglit mailing list