From b502bae610a9f302bf69cd81a8631b8b675c231f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Nov 2015 06:48:20 +1000 Subject: [PATCH] r600: consolidate clip state updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Move some common code into one place, tess will also need to use this function. Reviewed-by: Marek Olšák Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_state_common.c | 31 ++++++++++---------- src/gallium/drivers/r600/r600d.h | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index d629194ca6e..4ea122a1136 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1276,6 +1276,19 @@ static void update_gs_block_state(struct r600_context *rctx, unsigned enable) } } +static void r600_update_clip_state(struct r600_context *rctx, + struct r600_pipe_shader *current) +{ + if (current->pa_cl_vs_out_cntl != rctx->clip_misc_state.pa_cl_vs_out_cntl || + current->shader.clip_dist_write != rctx->clip_misc_state.clip_dist_write || + current->shader.vs_position_window_space != rctx->clip_misc_state.clip_disable) { + rctx->clip_misc_state.pa_cl_vs_out_cntl = current->pa_cl_vs_out_cntl; + rctx->clip_misc_state.clip_dist_write = current->shader.clip_dist_write; + rctx->clip_misc_state.clip_disable = current->shader.vs_position_window_space; + r600_mark_atom_dirty(rctx, &rctx->clip_misc_state.atom); + } +} + static bool r600_update_derived_state(struct r600_context *rctx) { struct pipe_context * ctx = (struct pipe_context*)rctx; @@ -1318,14 +1331,7 @@ static bool r600_update_derived_state(struct r600_context *rctx) update_shader_atom(ctx, &rctx->geometry_shader, rctx->gs_shader->current); update_shader_atom(ctx, &rctx->vertex_shader, rctx->gs_shader->current->gs_copy_shader); /* Update clip misc state. */ - if (rctx->gs_shader->current->gs_copy_shader->pa_cl_vs_out_cntl != rctx->clip_misc_state.pa_cl_vs_out_cntl || - rctx->gs_shader->current->gs_copy_shader->shader.clip_dist_write != rctx->clip_misc_state.clip_dist_write || - rctx->clip_misc_state.clip_disable != rctx->gs_shader->current->shader.vs_position_window_space) { - rctx->clip_misc_state.pa_cl_vs_out_cntl = rctx->gs_shader->current->gs_copy_shader->pa_cl_vs_out_cntl; - rctx->clip_misc_state.clip_dist_write = rctx->gs_shader->current->gs_copy_shader->shader.clip_dist_write; - rctx->clip_misc_state.clip_disable = rctx->gs_shader->current->shader.vs_position_window_space; - r600_mark_atom_dirty(rctx, &rctx->clip_misc_state.atom); - } + r600_update_clip_state(rctx, rctx->gs_shader->current->gs_copy_shader); rctx->b.streamout.enabled_stream_buffers_mask = rctx->gs_shader->current->gs_copy_shader->enabled_stream_buffers_mask; } @@ -1353,14 +1359,7 @@ static bool r600_update_derived_state(struct r600_context *rctx) update_shader_atom(ctx, &rctx->vertex_shader, rctx->vs_shader->current); /* Update clip misc state. */ - if (rctx->vs_shader->current->pa_cl_vs_out_cntl != rctx->clip_misc_state.pa_cl_vs_out_cntl || - rctx->vs_shader->current->shader.clip_dist_write != rctx->clip_misc_state.clip_dist_write || - rctx->clip_misc_state.clip_disable != rctx->vs_shader->current->shader.vs_position_window_space) { - rctx->clip_misc_state.pa_cl_vs_out_cntl = rctx->vs_shader->current->pa_cl_vs_out_cntl; - rctx->clip_misc_state.clip_dist_write = rctx->vs_shader->current->shader.clip_dist_write; - rctx->clip_misc_state.clip_disable = rctx->vs_shader->current->shader.vs_position_window_space; - r600_mark_atom_dirty(rctx, &rctx->clip_misc_state.atom); - } + r600_update_clip_state(rctx, rctx->vs_shader->current); rctx->b.streamout.enabled_stream_buffers_mask = rctx->vs_shader->current->enabled_stream_buffers_mask; } } diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index 53f5ad6db6a..d4df0606e56 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -1367,7 +1367,7 @@ #define V_008958_DI_PT_TRISTRIP 0x00000006 #define V_008958_DI_PT_UNUSED_0 0x00000007 #define V_008958_DI_PT_UNUSED_1 0x00000008 -#define V_008958_DI_PT_UNUSED_2 0x00000009 +#define V_008958_DI_PT_PATCH 0x00000009 #define V_008958_DI_PT_LINELIST_ADJ 0x0000000A #define V_008958_DI_PT_LINESTRIP_ADJ 0x0000000B #define V_008958_DI_PT_TRILIST_ADJ 0x0000000C -- 2.30.2