diff options
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 39d82f3..e045313 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -35,6 +35,7 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" +#include "util/u_inlines.h" #include "draw_context.h" #include "draw_vs.h" #include "draw_gs.h" @@ -63,19 +64,32 @@ draw_get_option_use_llvm(void) } #endif -struct draw_context *draw_create( struct pipe_context *pipe ) + + +/** + * Create new draw module context. + */ +struct draw_context * +draw_create(struct pipe_context *pipe) +{ + return draw_create_gallivm(pipe, 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()) - { - lp_build_init(); - assert(lp_build_engine); - draw->engine = lp_build_engine; - draw->llvm = draw_llvm_create(draw); + if (draw_get_option_use_llvm() && gallivm) { + draw->llvm = draw_llvm_create(draw, gallivm); } #endif @@ -91,6 +105,8 @@ fail: return NULL; } + + boolean draw_init(struct draw_context *draw) { /* @@ -149,6 +165,10 @@ void draw_destroy( struct draw_context *draw ) } } + for (i = 0; i < draw->pt.nr_vertex_buffers; i++) { + pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL); + } + /* Not so fast -- we're just borrowing this at the moment. * if (draw->render) @@ -292,8 +312,9 @@ draw_set_vertex_buffers(struct draw_context *draw, { assert(count <= PIPE_MAX_ATTRIBS); - memcpy(draw->pt.vertex_buffer, buffers, count * sizeof(buffers[0])); - draw->pt.nr_vertex_buffers = count; + util_copy_vertex_buffers(draw->pt.vertex_buffer, + &draw->pt.nr_vertex_buffers, + buffers, count); } |