radeonsi: move clip state to new handling
authorChristian König <deathsimple@vodafone.de>
Tue, 17 Jul 2012 12:52:08 +0000 (14:52 +0200)
committerChristian König <deathsimple@vodafone.de>
Tue, 24 Jul 2012 10:29:29 +0000 (12:29 +0200)
Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/drivers/radeonsi/evergreen_hw_context.c
src/gallium/drivers/radeonsi/evergreen_state.c
src/gallium/drivers/radeonsi/radeonsi_pipe.h
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h

index 4971a60356a7e4f6ed6183862db65e607b112720..d68e4b8f61e0558bb50a97346ef9cfc1878da603 100644 (file)
@@ -115,30 +115,6 @@ static const struct r600_reg si_context_reg_list[] = {
        {R_028448_PA_CL_VPORT_YOFFSET_0, 0},
        {R_02844C_PA_CL_VPORT_ZSCALE_0, 0},
        {R_028450_PA_CL_VPORT_ZOFFSET_0, 0},
-       {R_0285BC_PA_CL_UCP_0_X, 0},
-       {R_0285C0_PA_CL_UCP_0_Y, 0},
-       {R_0285C4_PA_CL_UCP_0_Z, 0},
-       {R_0285C8_PA_CL_UCP_0_W, 0},
-       {R_0285CC_PA_CL_UCP_1_X, 0},
-       {R_0285D0_PA_CL_UCP_1_Y, 0},
-       {R_0285D4_PA_CL_UCP_1_Z, 0},
-       {R_0285D8_PA_CL_UCP_1_W, 0},
-       {R_0285DC_PA_CL_UCP_2_X, 0},
-       {R_0285E0_PA_CL_UCP_2_Y, 0},
-       {R_0285E4_PA_CL_UCP_2_Z, 0},
-       {R_0285E8_PA_CL_UCP_2_W, 0},
-       {R_0285EC_PA_CL_UCP_3_X, 0},
-       {R_0285F0_PA_CL_UCP_3_Y, 0},
-       {R_0285F4_PA_CL_UCP_3_Z, 0},
-       {R_0285F8_PA_CL_UCP_3_W, 0},
-       {R_0285FC_PA_CL_UCP_4_X, 0},
-       {R_028600_PA_CL_UCP_4_Y, 0},
-       {R_028604_PA_CL_UCP_4_Z, 0},
-       {R_028608_PA_CL_UCP_4_W, 0},
-       {R_02860C_PA_CL_UCP_5_X, 0},
-       {R_028610_PA_CL_UCP_5_Y, 0},
-       {R_028614_PA_CL_UCP_5_Z, 0},
-       {R_028618_PA_CL_UCP_5_W, 0},
        {R_028644_SPI_PS_INPUT_CNTL_0, 0},
        {R_028648_SPI_PS_INPUT_CNTL_1, 0},
        {R_02864C_SPI_PS_INPUT_CNTL_2, 0},
index 23d7297a1d75bb106fa0455efeeddbd8ab2360ca..025e317224aa329fd9611e5ae385553bc8150ac9 100644 (file)
@@ -1245,37 +1245,6 @@ static void evergreen_bind_vs_sampler(struct pipe_context *ctx, unsigned count,
 {
 }
 
-static void evergreen_set_clip_state(struct pipe_context *ctx,
-                               const struct pipe_clip_state *state)
-{
-       struct r600_context *rctx = (struct r600_context *)ctx;
-       struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-
-       if (rstate == NULL)
-               return;
-
-       rctx->clip = *state;
-       rstate->id = R600_PIPE_STATE_CLIP;
-       for (int i = 0; i < 6; i++) {
-               r600_pipe_state_add_reg(rstate,
-                                       R_0285BC_PA_CL_UCP_0_X + i * 16,
-                                       fui(state->ucp[i][0]), NULL, 0);
-               r600_pipe_state_add_reg(rstate,
-                                       R_0285C0_PA_CL_UCP_0_Y + i * 16,
-                                       fui(state->ucp[i][1]) , NULL, 0);
-               r600_pipe_state_add_reg(rstate,
-                                       R_0285C4_PA_CL_UCP_0_Z + i * 16,
-                                       fui(state->ucp[i][2]), NULL, 0);
-               r600_pipe_state_add_reg(rstate,
-                                       R_0285C8_PA_CL_UCP_0_W + i * 16,
-                                       fui(state->ucp[i][3]), NULL, 0);
-       }
-
-       free(rctx->states[R600_PIPE_STATE_CLIP]);
-       rctx->states[R600_PIPE_STATE_CLIP] = rstate;
-       r600_context_pipe_state_set(rctx, rstate);
-}
-
 static void evergreen_set_polygon_stipple(struct pipe_context *ctx,
                                         const struct pipe_poly_stipple *state)
 {
@@ -1735,7 +1704,6 @@ void cayman_init_state_functions(struct r600_context *rctx)
        rctx->context.delete_sampler_state = si_delete_sampler_state;
        rctx->context.delete_vertex_elements_state = r600_delete_vertex_element;
        rctx->context.delete_vs_state = r600_delete_vs_shader;
-       rctx->context.set_clip_state = evergreen_set_clip_state;
        rctx->context.set_constant_buffer = r600_set_constant_buffer;
        rctx->context.set_fragment_sampler_views = evergreen_set_ps_sampler_view;
        rctx->context.set_framebuffer_state = evergreen_set_framebuffer_state;
index 30324b78f19a06b61970d8a07479dfd9c0d05ec2..17aba13c6824b760a9c8df4f2dadf09162276531 100644 (file)
@@ -77,7 +77,6 @@ struct r600_atom_surface_sync {
 enum r600_pipe_state_id {
        R600_PIPE_STATE_CONFIG,
        R600_PIPE_STATE_SEAMLESS_CUBEMAP,
-       R600_PIPE_STATE_CLIP,
        R600_PIPE_STATE_SCISSOR,
        R600_PIPE_STATE_VIEWPORT,
        R600_PIPE_STATE_RASTERIZER,
@@ -242,7 +241,6 @@ struct r600_context {
        /* for saving when using blitter */
        struct pipe_stencil_ref         stencil_ref;
        struct pipe_viewport_state      viewport;
-       struct pipe_clip_state          clip;
        struct r600_pipe_state          config;
        struct si_pipe_shader   *ps_shader;
        struct si_pipe_shader   *vs_shader;
index 51ee5c593d014b97e48e5333ef5ae1cc5870233e..9e52f8695792502756f7bc6007a67b1565ed9e40 100644 (file)
@@ -193,10 +193,35 @@ static void si_set_blend_color(struct pipe_context *ctx,
        si_pm4_set_state(rctx, blend_color, pm4);
 }
 
+static void si_set_clip_state(struct pipe_context *ctx,
+                             const struct pipe_clip_state *state)
+{
+       struct r600_context *rctx = (struct r600_context *)ctx;
+       struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
+
+       if (pm4 == NULL)
+               return;
+
+       for (int i = 0; i < 6; i++) {
+               si_pm4_set_reg(pm4, R_0285BC_PA_CL_UCP_0_X + i * 16,
+                              fui(state->ucp[i][0]));
+               si_pm4_set_reg(pm4, R_0285C0_PA_CL_UCP_0_Y + i * 16,
+                              fui(state->ucp[i][1]));
+               si_pm4_set_reg(pm4, R_0285C4_PA_CL_UCP_0_Z + i * 16,
+                              fui(state->ucp[i][2]));
+               si_pm4_set_reg(pm4, R_0285C8_PA_CL_UCP_0_W + i * 16,
+                              fui(state->ucp[i][3]));
+        }
+
+       si_pm4_set_state(rctx, clip, pm4);
+}
+
 void si_init_state_functions(struct r600_context *rctx)
 {
        rctx->context.create_blend_state = si_create_blend_state;
        rctx->context.bind_blend_state = si_bind_blend_state;
        rctx->context.delete_blend_state = si_delete_blend_state;
        rctx->context.set_blend_color = si_set_blend_color;
+
+       rctx->context.set_clip_state = si_set_clip_state;
 }
index f02bb5b1b6415a9e1768b27f97cce9baac8991bf..1ba6dcaa02b285d8e84388deff53ff1cb9d30bc9 100644 (file)
@@ -39,6 +39,7 @@ union si_state {
        struct {
                struct si_state_blend   *blend;
                struct si_pm4_state     *blend_color;
+               struct si_pm4_state     *clip;
        } named;
        struct si_pm4_state     *array[0];
 };