draw: Fail if we fail to enable llvm when asked for it
authorJakob Bornecrantz <wallbraker@gmail.com>
Mon, 9 Jan 2012 17:17:07 +0000 (18:17 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Mon, 9 Jan 2012 20:39:03 +0000 (21:39 +0100)
The r300 driver requires LLVM when building and other drivers that
depend on it for all TNL, like i915g will be a lot slower without it.

Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/draw/draw_context.c

index f4b1f8c973c83bf4e5b60b9c1a1c328d3cffba10..f6db95d756e5f56f4451d9ccbd96233f46415742 100644 (file)
@@ -74,7 +74,7 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm,
 {
    struct draw_context *draw = CALLOC_STRUCT( draw_context );
    if (draw == NULL)
-      goto fail;
+      goto err_out;
 
 #if HAVE_LLVM
    if (try_llvm && draw_get_option_use_llvm()) {
@@ -83,20 +83,26 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm,
          draw->own_gallivm = gallivm;
       }
 
-      if (gallivm)
-         draw->llvm = draw_llvm_create(draw, gallivm);
+      if (!gallivm)
+         goto err_destroy;
+
+      draw->llvm = draw_llvm_create(draw, gallivm);
+
+      if (!draw->llvm)
+         goto err_destroy;
    }
 #endif
 
    if (!draw_init(draw))
-      goto fail;
+      goto err_destroy;
 
    draw->pipe = pipe;
 
    return draw;
 
-fail:
+err_destroy:
    draw_destroy( draw );
+err_out:
    return NULL;
 }