diff options
author | Marek Olšák <[email protected]> | 2012-09-10 20:03:09 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-13 20:18:44 +0200 |
commit | 2b8d39bbfc111166105d7e06f6f6f908fea3d243 (patch) | |
tree | 4fd906baef8595c32193691314da38ec09a6bfff /src/gallium/drivers/r600/evergreen_state.c | |
parent | de89fe1e5de581df280df41170f411692c6ddf4a (diff) |
r600g: atomize clip state
Reviewed-by: Jerome Glisse <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/evergreen_state.c')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 01c84adcd5c..afa03ed3ad6 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1122,43 +1122,13 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte return &view->base; } -static void evergreen_set_clip_state(struct pipe_context *ctx, - const struct pipe_clip_state *state) +static void evergreen_emit_clip_state(struct r600_context *rctx, struct r600_atom *atom) { - struct r600_context *rctx = (struct r600_context *)ctx; - struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state); - struct pipe_constant_buffer cb; - - 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_UCP0_X + i * 16, - fui(state->ucp[i][0])); - r600_pipe_state_add_reg(rstate, - R_0285C0_PA_CL_UCP0_Y + i * 16, - fui(state->ucp[i][1]) ); - r600_pipe_state_add_reg(rstate, - R_0285C4_PA_CL_UCP0_Z + i * 16, - fui(state->ucp[i][2])); - r600_pipe_state_add_reg(rstate, - R_0285C8_PA_CL_UCP0_W + i * 16, - fui(state->ucp[i][3])); - } - - free(rctx->states[R600_PIPE_STATE_CLIP]); - rctx->states[R600_PIPE_STATE_CLIP] = rstate; - r600_context_pipe_state_set(rctx, rstate); + struct radeon_winsys_cs *cs = rctx->cs; + struct pipe_clip_state *state = &rctx->clip_state.state; - cb.buffer = NULL; - cb.user_buffer = state->ucp; - cb.buffer_offset = 0; - cb.buffer_size = 4*4*8; - ctx->set_constant_buffer(ctx, PIPE_SHADER_VERTEX, 1, &cb); - pipe_resource_reference(&cb.buffer, NULL); + r600_write_context_reg_seq(cs, R_0285BC_PA_CL_UCP0_X, 6*4); + r600_write_array(cs, 6*4, (unsigned*)state); } static void evergreen_set_polygon_stipple(struct pipe_context *ctx, @@ -2190,6 +2160,7 @@ void evergreen_init_state_functions(struct r600_context *rctx) r600_init_atom(rctx, &rctx->alphatest_state.atom, id++, r600_emit_alphatest_state, 6); r600_init_atom(rctx, &rctx->blend_color.atom, id++, r600_emit_blend_color, 6); r600_init_atom(rctx, &rctx->cb_misc_state.atom, id++, evergreen_emit_cb_misc_state, 0); + r600_init_atom(rctx, &rctx->clip_state.atom, id++, evergreen_emit_clip_state, 26); r600_init_atom(rctx, &rctx->db_misc_state.atom, id++, evergreen_emit_db_misc_state, 7); r600_init_atom(rctx, &rctx->stencil_ref.atom, id++, r600_emit_stencil_ref, 4); r600_init_atom(rctx, &rctx->viewport.atom, id++, r600_emit_viewport_state, 8); @@ -2199,7 +2170,6 @@ void evergreen_init_state_functions(struct r600_context *rctx) rctx->context.create_rasterizer_state = evergreen_create_rs_state; rctx->context.create_sampler_state = evergreen_create_sampler_state; rctx->context.create_sampler_view = evergreen_create_sampler_view; - rctx->context.set_clip_state = evergreen_set_clip_state; 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; |