diff options
author | Marek Olšák <[email protected]> | 2011-10-25 19:20:14 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-10-25 19:21:49 +0200 |
commit | 765503bb5dc21dd9cacf11039fa1555b887804f2 (patch) | |
tree | ce36fa229d0ebb152a4ce1a6ad2ec2334d4e27d9 /src/gallium/drivers/r600 | |
parent | 3d7934760930fdf208032aca2d933baf7768fdfc (diff) |
r600g: move some code out of draw_vbo into new r600_update_derived_state
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 49c576c7854..2261527cc33 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -552,6 +552,36 @@ static int r600_shader_rebuild(struct pipe_context * ctx, struct r600_pipe_shade return 0; } +static void r600_update_derived_state(struct r600_pipe_context *rctx) +{ + if (!rctx->blit) { + if (rctx->have_depth_fb || rctx->have_depth_texture) + r600_flush_depth_textures(rctx); + } + + if (rctx->chip_class < EVERGREEN) { + r600_update_sampler_states(rctx); + } + + if (rctx->vs_shader->shader.clamp_color != rctx->clamp_vertex_color) { + r600_shader_rebuild(&rctx->context, rctx->vs_shader); + } + + if ((rctx->ps_shader->shader.clamp_color != rctx->clamp_fragment_color) || + ((rctx->chip_class >= EVERGREEN) && rctx->ps_shader->shader.fs_write_all && + (rctx->ps_shader->shader.nr_cbufs != rctx->nr_cbufs))) { + r600_shader_rebuild(&rctx->context, rctx->ps_shader); + } + + if (rctx->spi_dirty) { + r600_spi_update(rctx); + } + + if (rctx->alpha_ref_dirty) { + r600_update_alpha_ref(rctx); + } +} + void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; @@ -565,13 +595,7 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) return; } - if (!rctx->blit) { - if (rctx->have_depth_fb || rctx->have_depth_texture) - r600_flush_depth_textures(rctx); - } - - if (rctx->chip_class < EVERGREEN) - r600_update_sampler_states(rctx); + r600_update_derived_state(rctx); u_vbuf_draw_begin(rctx->vbuf_mgr, info); r600_vertex_buffer_update(rctx); @@ -606,19 +630,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.info.index_bias = info->start; } - if (rctx->vs_shader->shader.clamp_color != rctx->clamp_vertex_color) - r600_shader_rebuild(ctx, rctx->vs_shader); - - if ((rctx->ps_shader->shader.clamp_color != rctx->clamp_fragment_color) || - ((rctx->chip_class >= EVERGREEN) && rctx->ps_shader->shader.fs_write_all && - (rctx->ps_shader->shader.nr_cbufs != rctx->nr_cbufs))) - r600_shader_rebuild(ctx, rctx->ps_shader); - - if (rctx->spi_dirty) - r600_spi_update(rctx); - - if (rctx->alpha_ref_dirty) - r600_update_alpha_ref(rctx); mask = (1ULL << ((unsigned)rctx->framebuffer.nr_cbufs * 4)) - 1; |