[Mesa-dev] [PATCH] draw: Ensure that prepare is always run after LLVM garbagge collection.

Brian Paul brian.e.paul at gmail.com
Fri Jan 27 07:18:48 PST 2012


On Fri, Jan 27, 2012 at 7:40 AM,  <jfonseca at vmware.com> wrote:
> From: José Fonseca <jfonseca at vmware.com>
>
> Should avoid dangling pointer derreference with
>
>  glean --run results --overwrite --quick --tests texSwizzle
> ---
>  src/gallium/auxiliary/draw/draw_llvm.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
> index e71c802..b81c725 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_llvm.c
> @@ -65,8 +65,13 @@ static void
>  draw_llvm_garbage_collect_callback(void *cb_data)
>  {
>    struct draw_llvm *llvm = (struct draw_llvm *) cb_data;
> +   struct draw_context *draw = llvm->draw;
>    struct draw_llvm_variant_list_item *li;
>
> +   /* Ensure prepare will be run and shaders recompiled */
> +   assert(!draw->suspend_flushing);
> +   draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
> +
>    /* free all shader variants */
>    li = first_elem(&llvm->vs_variants_list);
>    while (!at_end(&llvm->vs_variants_list, li)) {

Looks good to me.

-Brian


More information about the mesa-dev mailing list