r600: consolidate clip state updates
authorDave Airlie <airlied@redhat.com>
Mon, 23 Nov 2015 20:48:20 +0000 (06:48 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 29 Nov 2015 23:14:16 +0000 (09:14 +1000)
Move some common code into one place, tess will also need
to use this function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/r600_state_common.c
src/gallium/drivers/r600/r600d.h

index d629194ca6e8285d4a8d4fb970e0433451da2d7e..4ea122a1136caa84a3202638dea56ce383d82ffa 100644 (file)
@@ -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;
                }
        }
index 53f5ad6db6a8107a4f651667d4fde3738ec17119..d4df0606e56ff39706c41823f45027d573224915 100644 (file)
 #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