---
 tests/spec/arb_sampler_objects/srgb-decode.c | 2 +-
 tests/texturing/tex-srgb.c                   | 2 +-
 tests/texturing/texwrap.c                    | 8 +-------
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/tests/spec/arb_sampler_objects/srgb-decode.c 
b/tests/spec/arb_sampler_objects/srgb-decode.c
index 5458252..aebd3a3 100644
--- a/tests/spec/arb_sampler_objects/srgb-decode.c
+++ b/tests/spec/arb_sampler_objects/srgb-decode.c
@@ -94,7 +94,7 @@ piglit_display(void)
        int i;
 
        for (i = 0; i < 3; i++) {
-               decoded_tex_data[i] = pow((tex_data[i] + 0.055) / 1.055, 2.4);
+               decoded_tex_data[i] = piglit_srgb_to_linear(tex_data[i]);
        }
        decoded_tex_data[3] = tex_data[3];
 
diff --git a/tests/texturing/tex-srgb.c b/tests/texturing/tex-srgb.c
index 37970e0..e746d60 100644
--- a/tests/texturing/tex-srgb.c
+++ b/tests/texturing/tex-srgb.c
@@ -61,7 +61,7 @@ nonlinear_to_linear(GLubyte cs8)
                                table[i] = cs / 12.92;
                        }
                        else {
-                               table[i] = pow((cs + 0.055) / 1.055, 2.4);
+                               table[i] = piglit_srgb_to_linear(cs);
                        }
                }
                tableReady = GL_TRUE;
diff --git a/tests/texturing/texwrap.c b/tests/texturing/texwrap.c
index 2e0463d..483922d 100644
--- a/tests/texturing/texwrap.c
+++ b/tests/texturing/texwrap.c
@@ -572,12 +572,6 @@ PIGLIT_GL_TEST_CONFIG_END
 
 extern int piglit_automatic;
 
-static float srgb_to_linear(float x)
-{
-       return x <= 0.04045 ? x / 12.92 :
-                             pow((x + 0.055)/1.055, 2.4);
-}
-
 static int get_int_format_bits(const struct format_desc *format)
 {
        int maxbits = MAX2(format->red,
@@ -707,7 +701,7 @@ static void sample_nearest(int x, int y, int z,
 
        if (format->srgb) {
                for (i = 0; i < 3; i++) {
-                       result[i] = srgb_to_linear(result[i]);
+                       result[i] = piglit_srgb_to_linear(result[i]);
                }
        }
 
-- 
1.8.1.4

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

Reply via email to