[Mesa-dev] [PATCH 5/7] st/mesa: fix handling the fallback texture

Brian Paul brianp at vmware.com
Thu Feb 25 01:40:59 UTC 2016


On 02/24/2016 04:35 PM, Miklós Máté wrote:
> This fixes post-processing in SW:KotOR.

Can you elaborate on exactly what's happening and why this change fixes 
things?


>
> v2: fix const-ness
>
> Signed-off-by: Miklós Máté <mtmkls at gmail.com>
> ---
>   src/mesa/state_tracker/st_atom_sampler.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
> index 82dcf5e..52187d0 100644
> --- a/src/mesa/state_tracker/st_atom_sampler.c
> +++ b/src/mesa/state_tracker/st_atom_sampler.c
> @@ -133,7 +133,7 @@ convert_sampler(struct st_context *st,
>   {
>      const struct gl_texture_object *texobj;
>      struct gl_context *ctx = st->ctx;
> -   struct gl_sampler_object *msamp;
> +   const struct gl_sampler_object *msamp;
>      GLenum texBaseFormat;
>
>      texobj = ctx->Texture.Unit[texUnit]._Current;
> @@ -144,6 +144,10 @@ convert_sampler(struct st_context *st,
>      texBaseFormat = _mesa_texture_base_format(texobj);
>
>      msamp = _mesa_get_samplerobj(ctx, texUnit);
> +   if (!msamp) {
> +      /* handle the fallback texture */
> +      msamp = &texobj->Sampler;
> +   }
>
>      memset(sampler, 0, sizeof(*sampler));
>      sampler->wrap_s = gl_wrap_xlate(msamp->WrapS);
>

I'm guessing that _mesa_get_samplerobj() returns NULL only if there's no 
currently active texture for the given unit.  If so, maybe the msamp 
assignment should get moved into the earlier "if (!texobj)" test.

-Brian



More information about the mesa-dev mailing list