r600g: consolidate set_viewport_state functions
authorMarek Olšák <maraeo@gmail.com>
Sun, 9 Sep 2012 23:08:10 +0000 (01:08 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 13 Sep 2012 18:18:44 +0000 (20:18 +0200)
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c

index c8a2c35edc2c884442b8590c8efeaa58373c216d..ee71747ef22203da8a94082e66ce78ab2302c4f4 100644 (file)
@@ -1207,29 +1207,6 @@ static void evergreen_set_scissor_state(struct pipe_context *ctx,
        r600_context_pipe_state_set(rctx, rstate);
 }
 
-static void evergreen_set_viewport_state(struct pipe_context *ctx,
-                                       const struct pipe_viewport_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->viewport = *state;
-       rstate->id = R600_PIPE_STATE_VIEWPORT;
-       r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]));
-       r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]));
-       r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]));
-       r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]));
-       r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]));
-       r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]));
-
-       free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
-       rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
-       r600_context_pipe_state_set(rctx, rstate);
-}
-
 void evergreen_init_color_surface(struct r600_context *rctx,
                                  struct r600_surface *surf)
 {
@@ -2206,7 +2183,6 @@ void evergreen_init_state_functions(struct r600_context *rctx)
        rctx->context.set_framebuffer_state = evergreen_set_framebuffer_state;
        rctx->context.set_polygon_stipple = evergreen_set_polygon_stipple;
        rctx->context.set_scissor_state = evergreen_set_scissor_state;
-       rctx->context.set_viewport_state = evergreen_set_viewport_state;
        evergreen_init_compute_state_functions(rctx);
 }
 
index add0d7d2231e4da56edb124ecc293ef95af82f9a..a802d935aa21e3e070f4a191d01e877d0eb2496e 100644 (file)
@@ -1201,29 +1201,6 @@ static void r600_pipe_set_scissor_state(struct pipe_context *ctx,
        r600_set_scissor_state(rctx, state);
 }
 
-static void r600_set_viewport_state(struct pipe_context *ctx,
-                                       const struct pipe_viewport_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->viewport = *state;
-       rstate->id = R600_PIPE_STATE_VIEWPORT;
-       r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]));
-       r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]));
-       r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]));
-       r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]));
-       r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]));
-       r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]));
-
-       free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
-       rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
-       r600_context_pipe_state_set(rctx, rstate);
-}
-
 static struct r600_resource *r600_buffer_create_helper(struct r600_screen *rscreen,
                                                       unsigned size, unsigned alignment)
 {
@@ -2080,7 +2057,6 @@ void r600_init_state_functions(struct r600_context *rctx)
        rctx->context.set_framebuffer_state = r600_set_framebuffer_state;
        rctx->context.set_polygon_stipple = r600_set_polygon_stipple;
        rctx->context.set_scissor_state = r600_pipe_set_scissor_state;
-       rctx->context.set_viewport_state = r600_set_viewport_state;
 }
 
 /* Adjust GPR allocation on R6xx/R7xx */
index fd67d405da3c2ae6cb4400aa41ae40c8b43a4b50..13995e04ba561170b40036d1cb282ba51b35cc71 100644 (file)
@@ -632,6 +632,29 @@ static void r600_set_ps_sampler_views(struct pipe_context *ctx, unsigned count,
        r600_set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, count, views);
 }
 
+static void r600_set_viewport_state(struct pipe_context *ctx,
+                                       const struct pipe_viewport_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->viewport = *state;
+       rstate->id = R600_PIPE_STATE_VIEWPORT;
+       r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]));
+       r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]));
+       r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]));
+       r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]));
+       r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]));
+       r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]));
+
+       free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
+       rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
+       r600_context_pipe_state_set(rctx, rstate);
+}
+
 static void *r600_create_vertex_elements(struct pipe_context *ctx, unsigned count,
                                         const struct pipe_vertex_element *elements)
 {
@@ -1481,6 +1504,7 @@ void r600_init_common_state_functions(struct r600_context *rctx)
        rctx->context.set_constant_buffer = r600_set_constant_buffer;
        rctx->context.set_sample_mask = r600_set_sample_mask;
        rctx->context.set_stencil_ref = r600_set_pipe_stencil_ref;
+       rctx->context.set_viewport_state = r600_set_viewport_state;
        rctx->context.set_vertex_buffers = r600_set_vertex_buffers;
        rctx->context.set_index_buffer = r600_set_index_buffer;
        rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_views;