Mesa (master): r600g: move some code out of draw_vbo into new r600_update_derived_state

Marek Olšák mareko at kemper.freedesktop.org
Tue Oct 25 10:22:30 PDT 2011


Module: Mesa
Branch: master
Commit: 765503bb5dc21dd9cacf11039fa1555b887804f2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=765503bb5dc21dd9cacf11039fa1555b887804f2

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Oct 25 19:20:14 2011 +0200

r600g: move some code out of draw_vbo into new r600_update_derived_state

---

 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 49c576c..2261527 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;
 



More information about the mesa-commit mailing list