diff options
author | Dave Airlie <[email protected]> | 2011-01-13 12:12:21 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-01-16 12:54:06 +1000 |
commit | edc2dd8e4788e556d445c9f59974ed95b33c2bbc (patch) | |
tree | 414f98866a8197661563ec673806ead56de3afc7 /src/mesa/main/texfetch.c | |
parent | ac6334145ec8eef42505cdd727aed7fae0831e12 (diff) |
mesa/swrast: implement EXT_texture_sRGB_decode
This implements the extension by choosing a different set of texture
fetch functions when the texture parameter changes.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/texfetch.c')
-rw-r--r-- | src/mesa/main/texfetch.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 113512090b2..bbb0f8e8d27 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -39,6 +39,7 @@ #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" #include "texfetch.h" +#include "teximage.h" /** @@ -858,12 +859,34 @@ void _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) { ASSERT(dims == 1 || dims == 2 || dims == 3); + GLuint format = texImage->TexFormat; + if (texImage->TexObject->sRGBDecode == GL_SKIP_DECODE_EXT && + _mesa_get_format_color_encoding(format) == GL_SRGB) { + format = _mesa_get_srgb_format_linear(format); + } texImage->FetchTexelf = - _mesa_get_texel_fetch_func(texImage->TexFormat, dims); + _mesa_get_texel_fetch_func(format, dims); texImage->FetchTexelc = fetch_texel_float_to_chan; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); } + +void +_mesa_update_fetch_functions(struct gl_texture_object *texObj) +{ + GLuint face, i; + GLuint dims; + + dims = _mesa_get_texture_dimensions(texObj->Target); + + for (face = 0; face < 6; face++) { + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + if (texObj->Image[face][i]) { + _mesa_set_fetch_functions(texObj->Image[face][i], dims); + } + } + } +} |