/** * Create new draw module context with gallivm state for LLVM JIT. */ static struct draw_context * draw_create_context(struct pipe_context *pipe, boolean try_llvm) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); if (draw == NULL) goto err_out; #if HAVE_LLVM if (try_llvm && draw_get_option_use_llvm()) { draw->llvm = draw_llvm_create(draw); if (!draw->llvm) goto err_destroy; } #endif draw->pipe = pipe; if (!draw_init(draw)) goto err_destroy; return draw; err_destroy: draw_destroy( draw ); err_out: return NULL; }
/** * Create new draw module context with gallivm state for LLVM JIT. */ struct draw_context * draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); if (draw == NULL) goto fail; #if HAVE_LLVM if (draw_get_option_use_llvm()) { if (!gallivm) { gallivm = gallivm_create(); draw->own_gallivm = gallivm; } if (gallivm) draw->llvm = draw_llvm_create(draw, gallivm); } #endif if (!draw_init(draw)) goto fail; draw->pipe = pipe; return draw; fail: draw_destroy( draw ); return NULL; }
/** * Create new draw module context with gallivm state for LLVM JIT. */ static struct draw_context * draw_create_context(struct pipe_context *pipe, void *context, boolean try_llvm) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); if (!draw) goto err_out; /* we need correct cpu caps for disabling denorms in draw_vbo() */ util_cpu_detect(); #if HAVE_LLVM if (try_llvm && draw_get_option_use_llvm()) { draw->llvm = draw_llvm_create(draw, (LLVMContextRef)context); } #endif draw->pipe = pipe; if (!draw_init(draw)) goto err_destroy; draw->ia = draw_prim_assembler_create(draw); if (!draw->ia) goto err_destroy; return draw; err_destroy: draw_destroy( draw ); err_out: return NULL; }