---
 tests/general/framebuffer-srgb.c                   | 20 ++------------------
 tests/spec/arb_framebuffer_srgb/srgb_conformance.c | 18 ++----------------
 2 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/tests/general/framebuffer-srgb.c b/tests/general/framebuffer-srgb.c
index a1f5c9c..a140dda 100644
--- a/tests/general/framebuffer-srgb.c
+++ b/tests/general/framebuffer-srgb.c
@@ -125,22 +125,6 @@ framebuffer_srgb_api_ext(void)
        return pass;
 }
 
-static GLfloat
-linear_to_nonlinear(GLfloat cl)
-{
-   /* can't have values outside [0, 1] */
-   GLfloat cs;
-
-   if (cl < 0.0031308f) {
-      cs = 12.92f * cl;
-   }
-   else {
-      cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
-   }
-   
-   return cs;
-}
-
 /**
  * Common code for framebuffer and FBO tests.
  */
@@ -202,7 +186,7 @@ test_srgb(void)
         */
        memcpy(expected_green, green, sizeof(float) * 4);
        if (srgb_capable)
-               expected_green[1] = linear_to_nonlinear(green[1]);
+               expected_green[1] = piglit_linear_to_srgb(green[1]);
        if (!piglit_probe_rect_rgb(20, 0, 20, 20, expected_green))
                pass = GL_FALSE;
        /* check it doesn't affect the pixel path */
@@ -216,7 +200,7 @@ test_srgb(void)
         */
        memcpy(expected_blend, green, sizeof(float) * 4);
        if (srgb_capable)
-               expected_blend[1] = linear_to_nonlinear(green[1] * 2.0);
+               expected_blend[1] = piglit_linear_to_srgb(green[1] * 2.0);
        else
                expected_blend[1] = green[1] * 2.0;
        if (!piglit_probe_rect_rgb(40, 0, 20, 20, expected_blend))
diff --git a/tests/spec/arb_framebuffer_srgb/srgb_conformance.c 
b/tests/spec/arb_framebuffer_srgb/srgb_conformance.c
index 0736693..508239d 100644
--- a/tests/spec/arb_framebuffer_srgb/srgb_conformance.c
+++ b/tests/spec/arb_framebuffer_srgb/srgb_conformance.c
@@ -53,20 +53,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-
-static GLfloat
-linear_to_nonlinear(float x)
-{
-       if (x >= 1.0f)
-               return 255.0f;
-       else if (x >= 0.0031308f)
-               return 255.0f * (1.055f * powf(x, 0.41666666f) - 0.055f);
-       else if (x > 0.0f)
-               return 255.0f * (12.92f * x);
-       else
-               return 0.0f;
-}
-
 static enum piglit_result test_format(void)
 {
        GLboolean pass = GL_TRUE;
@@ -144,10 +130,10 @@ static enum piglit_result test_format(void)
        glReadPixels(0, 0, 16, 16, GL_RGBA, GL_FLOAT, &readf[0][0]);
 
        for (i = 0; i < 256; i++) {
-               float err = fabs(linear_to_nonlinear(readf[i][0]) - (float)i);
+               float err = fabs(piglit_linear_to_srgb(readf[i][0]) - (float)i);
                if (0)
                        printf("readback: %f observed: %f expected: %f\n", 
readf[i][0],
-                               linear_to_nonlinear(readf[i][0]), (float)i);
+                               piglit_linear_to_srgb(readf[i][0]), (float)i);
                if (err > maxErr) {
                        maxErr = err;
                }
-- 
1.8.1.4

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to