diff options
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); + } + } + } +} |