summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-07-18 04:17:11 +0200
committerMarek Olšák <[email protected]>2012-07-18 04:17:11 +0200
commitde4fd087cbccd47e703f750968b79525ddbe4554 (patch)
tree646ac6f48717b1288a6537ed8f40982f34fe9578 /src
parentbc2f5fc01e678ecd19f921e5bc7bd55c131dde66 (diff)
r600g: always derive alphatest state from the first colorbuffer
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c21
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h2
-rw-r--r--src/gallium/drivers/r600/r600_state.c11
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c2
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 a62d18ed853..d90ef3c6042 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 063d9d38e63..2f16ff6e51c 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 4644034c916..269198bf971 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 6aff57a467a..89549f91e4b 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;
}