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/swrast/s_texfetch.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/swrast/s_texfetch.c')
-rw-r--r-- | src/mesa/swrast/s_texfetch.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index e508368c8dc..aef02321764 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -46,35 +46,7 @@ #include "s_texfetch.h" #include "../../gallium/auxiliary/util/u_format_rgb9e5.h" #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" - - -/** - * Convert an 8-bit sRGB value from non-linear space to a - * linear RGB value in [0, 1]. - * Implemented with a 256-entry lookup table. - */ -static inline GLfloat -nonlinear_to_linear(GLubyte cs8) -{ - static GLfloat table[256]; - static GLboolean tableReady = GL_FALSE; - if (!tableReady) { - /* compute lookup table now */ - GLuint i; - for (i = 0; i < 256; i++) { - const GLfloat cs = UBYTE_TO_FLOAT(i); - if (cs <= 0.04045) { - table[i] = cs / 12.92f; - } - else { - table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4); - } - } - tableReady = GL_TRUE; - } - return table[cs8]; -} - +#include "util/format_srgb.h" /* Texel fetch routines for all supported formats |