[Mesa-dev] [PATCH] r600g: fix crash in set_framebuffer_state

Grigori Goronzy greg at chown.ath.cx
Thu Oct 10 19:17:49 CEST 2013


We should be able to safely set the framebuffer state without a
fragment shader bound. bind_ps_state will take care of updating the
necessary state bits later.
---
 src/gallium/drivers/r600/evergreen_state.c | 4 +++-
 src/gallium/drivers/r600/r600_state.c      | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 83cb024..22de003 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1822,7 +1822,9 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
 		rctx->db_misc_state.atom.dirty = true;
 	}
 
-	evergreen_update_db_shader_control(rctx);
+	if (rctx->ps_shader) {
+		evergreen_update_db_shader_control(rctx);
+	}
 
 	/* Calculate the CS size. */
 	rctx->framebuffer.atom.num_dw = 4; /* SCISSOR */
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index b01ab9c..ee08de9 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1662,7 +1662,9 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
 		rctx->alphatest_state.atom.dirty = true;
 	}
 
-	r600_update_db_shader_control(rctx);
+	if (rctx->ps_shader) {
+		r600_update_db_shader_control(rctx);
+	}
 
 	/* Calculate the CS size. */
 	rctx->framebuffer.atom.num_dw =
-- 
1.8.1.2



More information about the mesa-dev mailing list