summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress_s3tc.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-07-24 12:32:49 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2014-08-04 11:07:20 -0700
commite97498ef811b49b8fb894bd167503109151a1fc8 (patch)
tree61acffa231367ef3da8fb69524658240024c4a86 /src/mesa/main/texcompress_s3tc.c
parent992e1ea8e4290cf14d59f89415bfd13e0920aad7 (diff)
downloadexternal_mesa3d-e97498ef811b49b8fb894bd167503109151a1fc8.zip
external_mesa3d-e97498ef811b49b8fb894bd167503109151a1fc8.tar.gz
external_mesa3d-e97498ef811b49b8fb894bd167503109151a1fc8.tar.bz2
mesa/main: Use the RGB <-> sRGB conversion functions in libmesautil
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/mesa/main/texcompress_s3tc.c')
-rw-r--r--src/mesa/main/texcompress_s3tc.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 894c46d..5b275ef 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 {