diff options
author | Jason Ekstrand <[email protected]> | 2014-07-24 12:32:49 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2014-08-04 11:07:20 -0700 |
commit | e97498ef811b49b8fb894bd167503109151a1fc8 (patch) | |
tree | 61acffa231367ef3da8fb69524658240024c4a86 /src/mesa/main/texcompress_s3tc.c | |
parent | 992e1ea8e4290cf14d59f89415bfd13e0920aad7 (diff) |
mesa/main: Use the RGB <-> sRGB conversion functions in libmesautil
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/texcompress_s3tc.c')
-rw-r--r-- | src/mesa/main/texcompress_s3tc.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 894c46de10d..5b275efe063 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -44,6 +44,7 @@ #include "texcompress_s3tc.h" #include "texstore.h" #include "format_unpack.h" +#include "util/format_srgb.h" #if defined(_WIN32) || defined(WIN32) @@ -419,9 +420,9 @@ fetch_srgb_dxt1(const GLubyte *map, if (fetch_ext_rgb_dxt1) { GLubyte tex[4]; fetch_ext_rgb_dxt1(rowStride, map, i, j, tex); - texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); + texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(tex[RCOMP]); + texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(tex[GCOMP]); + texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(tex[BCOMP]); texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]); } else { @@ -436,9 +437,9 @@ fetch_srgba_dxt1(const GLubyte *map, if (fetch_ext_rgba_dxt1) { GLubyte tex[4]; fetch_ext_rgba_dxt1(rowStride, map, i, j, tex); - texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); + texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(tex[RCOMP]); + texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(tex[GCOMP]); + texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(tex[BCOMP]); texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]); } else { @@ -453,9 +454,9 @@ fetch_srgba_dxt3(const GLubyte *map, if (fetch_ext_rgba_dxt3) { GLubyte tex[4]; fetch_ext_rgba_dxt3(rowStride, map, i, j, tex); - texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); + texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(tex[RCOMP]); + texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(tex[GCOMP]); + texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(tex[BCOMP]); texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]); } else { @@ -470,9 +471,9 @@ fetch_srgba_dxt5(const GLubyte *map, if (fetch_ext_rgba_dxt5) { GLubyte tex[4]; fetch_ext_rgba_dxt5(rowStride, map, i, j, tex); - texel[RCOMP] = _mesa_nonlinear_to_linear(tex[RCOMP]); - texel[GCOMP] = _mesa_nonlinear_to_linear(tex[GCOMP]); - texel[BCOMP] = _mesa_nonlinear_to_linear(tex[BCOMP]); + texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(tex[RCOMP]); + texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(tex[GCOMP]); + texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(tex[BCOMP]); texel[ACOMP] = UBYTE_TO_FLOAT(tex[ACOMP]); } else { |