diff options
author | Pauli Nieminen <[email protected]> | 2012-06-12 21:38:56 +0300 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-08-01 15:55:51 -0700 |
commit | cbdc1d53542b3ecca0085399c4bb3b3371f94809 (patch) | |
tree | c835fd6c56f22692f8db127a882ae94e7a70d498 /src/mesa/swrast/s_texfetch.c | |
parent | 8129dabb5f5ff717bb1ca32710ca6204d5345461 (diff) |
swrast: Support sampler object for texture fetching state
swrast needs to pass sampler object into all texture fetching functions
to use correct sampling state when sampler object is bound to the unit.
The changes were made using half manual regular expression replace.
v2: Fix NULL deref in _swrast_choose_triangle(), because the _Current
values aren't set yet, so we need to look at our texObj2D. (anholt)
Signed-off-by: Pauli Nieminen <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_texfetch.c')
-rw-r--r-- | src/mesa/swrast/s_texfetch.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index 12ee47963d7..db7c887b673 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -41,6 +41,7 @@ #include "main/texcompress_rgtc.h" #include "main/texcompress_etc.h" #include "main/teximage.h" +#include "main/samplerobj.h" #include "s_context.h" #include "s_texfetch.h" #include "../../gallium/auxiliary/util/u_format_rgb9e5.h" @@ -1147,13 +1148,14 @@ _mesa_get_texel_fetch_func(gl_format format, GLuint dims) * Initialize the texture image's FetchTexel methods. */ static void -set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims) +set_fetch_functions(struct gl_sampler_object *samp, + struct swrast_texture_image *texImage, GLuint dims) { gl_format format = texImage->Base.TexFormat; ASSERT(dims == 1 || dims == 2 || dims == 3); - if (texImage->Base.TexObject->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT && + if (samp->sRGBDecode == GL_SKIP_DECODE_EXT && _mesa_get_format_color_encoding(format) == GL_SRGB) { format = _mesa_get_srgb_format_linear(format); } @@ -1163,17 +1165,25 @@ set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims) } void -_mesa_update_fetch_functions(struct gl_texture_object *texObj) +_mesa_update_fetch_functions(struct gl_context *ctx, GLuint unit) { + struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; + struct gl_sampler_object *samp; GLuint face, i; GLuint dims; + if (!texObj) + return; + + samp = _mesa_get_samplerobj(ctx, unit); + 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]) { - set_fetch_functions(swrast_texture_image(texObj->Image[face][i]), + set_fetch_functions(samp, + swrast_texture_image(texObj->Image[face][i]), dims); } } |