From 6175653d0bceedba1f599d27111bab14f312f134 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 15 Jul 2009 23:44:53 +0100 Subject: gallium: proper constructor and destructor for tgsi_exec_machine Centralize the creation, initialization and destruction of this struct. Use align_malloc instead of home-brew alternatives. --- src/gallium/auxiliary/draw/draw_vs.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_vs.c') diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c index c057cd6..1b48a52 100644 --- a/src/gallium/auxiliary/draw/draw_vs.c +++ b/src/gallium/auxiliary/draw/draw_vs.c @@ -146,16 +146,8 @@ draw_delete_vertex_shader(struct draw_context *draw, boolean draw_vs_init( struct draw_context *draw ) { - tgsi_exec_machine_init(&draw->vs.machine); - - /* FIXME: give this machine thing a proper constructor: - */ - draw->vs.machine.Inputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16); - if (!draw->vs.machine.Inputs) - return FALSE; - - draw->vs.machine.Outputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16); - if (!draw->vs.machine.Outputs) + draw->vs.machine = tgsi_exec_machine_create(); + if (!draw->vs.machine) return FALSE; draw->vs.emit_cache = translate_cache_create(); @@ -178,12 +170,6 @@ draw_vs_init( struct draw_context *draw ) void draw_vs_destroy( struct draw_context *draw ) { - if (draw->vs.machine.Inputs) - align_free(draw->vs.machine.Inputs); - - if (draw->vs.machine.Outputs) - align_free(draw->vs.machine.Outputs); - if (draw->vs.fetch_cache) translate_cache_destroy(draw->vs.fetch_cache); @@ -196,8 +182,7 @@ draw_vs_destroy( struct draw_context *draw ) if (draw->vs.aligned_constant_storage) align_free((void*)draw->vs.aligned_constant_storage); - tgsi_exec_machine_free_data(&draw->vs.machine); - + tgsi_exec_machine_destroy(draw->vs.machine); } -- cgit v1.1