From 4b73cdb864aef6d64c35a7ab9a59e4ee4e3f9d0f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 7 Dec 2012 13:58:34 -0700 Subject: draw: fix/improve dirty state validation This patch does two things: 1. Constant buffer state changes were broken (but happened to work by dumb luck). The problem is we weren't calling draw_do_flush() in draw_set_mapped_constant_buffer() when we changed that state. All the other draw_set_foo() functions were calling draw_do_flush() already. 2. Use a simpler state validation step when we're changing light-weight parameter state such as constant buffers, viewport dims or clip planes. There's no need to revalidate the whole pipeline when changing state like that. The new validation method is called bind_parameters() and is called instead of the prepare() method. A new DRAW_FLUSH_PARAMETER_CHANGE flag is used to signal these light-weight state changes. This results in a modest but measurable increase in FPS for many Mesa demos. Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/draw/draw_private.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/draw/draw_private.h') diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index e52b3fda0ec..2223fcb3f40 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -144,6 +144,8 @@ struct draw_context unsigned opt; /**< bitmask of PT_x flags */ unsigned eltSize; /* saved eltSize for flushing */ + boolean rebind_parameters; + struct { struct draw_pt_middle_end *fetch_emit; struct draw_pt_middle_end *fetch_shade_emit; @@ -434,8 +436,9 @@ void draw_pipeline_flush( struct draw_context *draw, * Flushing */ -#define DRAW_FLUSH_STATE_CHANGE 0x8 -#define DRAW_FLUSH_BACKEND 0x10 +#define DRAW_FLUSH_PARAMETER_CHANGE 0x1 /**< Constants, viewport, etc */ +#define DRAW_FLUSH_STATE_CHANGE 0x2 /**< Other/heavy state changes */ +#define DRAW_FLUSH_BACKEND 0x4 /**< Flush the output buffer */ void draw_do_flush( struct draw_context *draw, unsigned flags ); -- cgit v1.2.3