[Mesa-dev] [PATCH] st/mesa: don't invoke st_convert_sampler for TBOs

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jun 20 19:52:28 UTC 2017


This makes sense, it fixes the crash.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 06/20/2017 09:34 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
> 
> This precedes:
> https://cgit.freedesktop.org/~mareko/mesa/log/?h=mesa-cpu-optz
> 
> st_convert_sampler shouldn't be called for TBOs and will crash if you try it.
> 
> 
>   src/mesa/state_tracker/st_cb_texture.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index ff6feb0..a3a936f 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -2892,26 +2892,27 @@ st_TexParameter(struct gl_context *ctx,
>   
>   
>   static GLuint64
>   st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj,
>                       struct gl_sampler_object *sampObj)
>   {
>      struct st_context *st = st_context(ctx);
>      struct st_texture_object *stObj = st_texture_object(texObj);
>      struct pipe_context *pipe = st->pipe;
>      struct pipe_sampler_view *view;
> -   struct pipe_sampler_state sampler;
> +   struct pipe_sampler_state sampler = {0};
>   
>      if (!st_finalize_texture(ctx, pipe, texObj, 0))
>         return 0;
>   
> -   st_convert_sampler(st, texObj, sampObj, &sampler);
> +   if (texObj->Target != GL_TEXTURE_BUFFER)
> +      st_convert_sampler(st, texObj, sampObj, &sampler);
>   
>      view = st_get_texture_sampler_view_from_stobj(st, stObj, sampObj, 0);
>   
>      return pipe->create_texture_handle(pipe, view, &sampler);
>   }
>   
>   
>   static void
>   st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle)
>   {
> 


More information about the mesa-dev mailing list