Mesa (master): r600g: always derive alphatest state from the first colorbuffer

Marek Olšák mareko at kemper.freedesktop.org
Wed Jul 18 03:03:40 UTC 2012


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Wed Jul 18 04:17:11 2012 +0200

r600g: always derive alphatest state from the first colorbuffer

---

 src/gallium/drivers/r600/evergreen_state.c   |   21 +++++++++++++--------
 src/gallium/drivers/r600/r600_pipe.h         |    2 +-
 src/gallium/drivers/r600/r600_state.c        |   11 +++++++----
 src/gallium/drivers/r600/r600_state_common.c |    2 +-
 4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index a62d18e..d90ef3c 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1397,10 +1397,13 @@ void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rstate,
 		blend_bypass = 1;
 	}
 
-	alphatest_bypass = ntype == V_028C70_NUMBER_UINT || ntype == V_028C70_NUMBER_SINT;
-	if (rctx->alphatest_state.bypass != alphatest_bypass) {
-		rctx->alphatest_state.bypass = alphatest_bypass;
-		r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
+	/* Alpha-test is done on the first colorbuffer only. */
+	if (cb == 0) {
+		alphatest_bypass = ntype == V_028C70_NUMBER_UINT || ntype == V_028C70_NUMBER_SINT;
+		if (rctx->alphatest_state.bypass != alphatest_bypass) {
+			rctx->alphatest_state.bypass = alphatest_bypass;
+			r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
+		}
 	}
 
 	color_info |= S_028C70_FORMAT(format) |
@@ -1435,6 +1438,12 @@ void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rstate,
 		rctx->export_16bpc = false;
 	}
 
+	/* Alpha-test is done on the first colorbuffer only. */
+	if (cb == 0 && rctx->alphatest_state.cb0_export_16bpc != rctx->export_16bpc) {
+		rctx->alphatest_state.cb0_export_16bpc = rctx->export_16bpc;
+		r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
+	}
+
 	/* for possible dual-src MRT */
 	if (cb == 0 && rctx->framebuffer.nr_cbufs == 1 && !rtex->is_rat) {
 		r600_pipe_state_add_reg_bo(rstate,
@@ -1681,10 +1690,6 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
 		rctx->cb_misc_state.nr_cbufs = state->nr_cbufs;
 		r600_atom_dirty(rctx, &rctx->cb_misc_state.atom);
 	}
-	if (rctx->alphatest_state.export_16bpc != rctx->export_16bpc) {
-		rctx->alphatest_state.export_16bpc = rctx->export_16bpc;
-		r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
-	}
 }
 
 static void evergreen_emit_cb_misc_state(struct r600_context *rctx, struct r600_atom *atom)
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 063d9d3..2f16ff6 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -97,7 +97,7 @@ struct r600_alphatest_state {
 	unsigned sx_alpha_test_control; /* this comes from dsa state */
 	unsigned sx_alpha_ref; /* this comes from dsa state */
 	bool bypass;
-	bool export_16bpc; /* from set_framebuffer_state */
+	bool cb0_export_16bpc; /* from set_framebuffer_state */
 };
 
 enum r600_pipe_state_id {
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 4644034..269198b 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1426,10 +1426,13 @@ static void r600_cb(struct r600_context *rctx, struct r600_pipe_state *rstate,
 		blend_bypass = 1;
 	}
 
-	alphatest_bypass = ntype == V_0280A0_NUMBER_UINT || ntype == V_0280A0_NUMBER_SINT;
-	if (rctx->alphatest_state.bypass != alphatest_bypass) {
-		rctx->alphatest_state.bypass = alphatest_bypass;
-		r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
+	/* Alpha-test is done on the first colorbuffer only. */
+	if (cb == 0) {
+		alphatest_bypass = ntype == V_0280A0_NUMBER_UINT || ntype == V_0280A0_NUMBER_SINT;
+		if (rctx->alphatest_state.bypass != alphatest_bypass) {
+			rctx->alphatest_state.bypass = alphatest_bypass;
+			r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
+		}
 	}
 
 	color_info |= S_0280A0_FORMAT(format) |
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 6aff57a..89549f9 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -92,7 +92,7 @@ static void r600_emit_alphatest_state(struct r600_context *rctx, struct r600_ato
 	struct r600_alphatest_state *a = (struct r600_alphatest_state*)atom;
 	unsigned alpha_ref = a->sx_alpha_ref;
 
-	if (rctx->chip_class >= EVERGREEN && a->export_16bpc) {
+	if (rctx->chip_class >= EVERGREEN && a->cb0_export_16bpc) {
 		alpha_ref &= ~0x1FFF;
 	}
 




More information about the mesa-commit mailing list