[Mesa-dev] [PATCH] st/mesa: fix crash when a shader uses a TBO and it's not bound

Brian Paul brianp at vmware.com
Thu Feb 6 06:26:29 PST 2014


On 02/05/2014 06:19 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This binds a NULL sampler view in that case.
>
> Cc: "10.1" "10.0" <mesa-stable at lists.freedesktop.org>
> ---
>   src/mesa/state_tracker/st_cb_texture.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index 81a5d9b..824a13e 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1483,6 +1483,12 @@ st_finalize_texture(struct gl_context *ctx,
>      if (tObj->Target == GL_TEXTURE_BUFFER) {
>         struct st_buffer_object *st_obj = st_buffer_object(tObj->BufferObject);
>
> +      if (!st_obj) {
> +         pipe_resource_reference(&stObj->pt, NULL);
> +         pipe_sampler_view_reference(&stObj->sampler_view, NULL);
> +         return GL_TRUE;
> +      }
> +
>         if (st_obj->buffer != stObj->pt) {
>            pipe_resource_reference(&stObj->pt, st_obj->buffer);
>            pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
>

LGTM.  Reviewed-by: Brian Paul <brianp at vmware.com>

Wasn't there a bug report for this?  If so please ref it in the commit msg.

-Brian



More information about the mesa-dev mailing list