From b6d3a435a0e0e53a9e8cc4c4249dc7c2f897a83d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 24 Jan 2011 02:11:59 +0100 Subject: draw: Only run prepare when state, prim and opt changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In bad applications like ipers which does a lot of draw calls with no state changes this helps to greatly reduce time spent in prepare. In ipers around 7% of CPU was spent in various prepare functions, after this commit no prepare function show on the profile. This commit also has the added benefit of now grouping all pipelined drawing into a single draw call if the driver uses vbuf_render. Reviewed-by: Stéphane Marchesin Tested-by: Stéphane Marchesin --- src/gallium/auxiliary/draw/draw_context.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gallium/auxiliary/draw/draw_context.c') diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 4ce44455084..3c0b1aa39c9 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -355,6 +355,10 @@ draw_set_vertex_elements(struct draw_context *draw, { assert(count <= PIPE_MAX_ATTRIBS); + /* We could improve this by only flushing the frontend and the fetch part + * of the middle. This would avoid recalculating the emit keys.*/ + draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + memcpy(draw->pt.vertex_element, elements, count * sizeof(elements[0])); draw->pt.nr_vertex_elements = count; } @@ -654,6 +658,8 @@ void draw_do_flush( struct draw_context *draw, unsigned flags ) draw_pipeline_flush( draw, flags ); + draw_pt_flush( draw, flags ); + draw->flushing = FALSE; } } -- cgit v1.2.3