summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-04-03 10:52:22 +0200
committerAxel Davy <[email protected]>2016-05-18 23:37:14 +0200
commitf297e7de0f3fc0bd4fec483d4bf778a9678992c7 (patch)
tree8b2594ae0de94f77438307fe943e9812ea76f93b /src/gallium/state_trackers
parentedc5cdced56756bfda898a4ed5bd480cd07c2d7e (diff)
st/nine: ATOC has effect only with ALPHATESTENABLE
ATOC extension does something only when alpha test is enabled. Use a second bit to encode the difference with ATIATOC. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/device9.c9
-rw-r--r--src/gallium/state_trackers/nine/nine_pipe.c2
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h4
3 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 7edba6b1e9f..ed5d17a6e07 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2429,11 +2429,18 @@ NineDevice9_SetRenderState( struct NineDevice9 *This,
/* NV hack */
if (unlikely(State == D3DRS_ADAPTIVETESS_Y)) {
if (Value == D3DFMT_ATOC || (Value == D3DFMT_UNKNOWN && state->rs[NINED3DRS_ALPHACOVERAGE])) {
- state->rs[NINED3DRS_ALPHACOVERAGE] = (Value == D3DFMT_ATOC);
+ state->rs[NINED3DRS_ALPHACOVERAGE] = (Value == D3DFMT_ATOC) ? 3 : 0;
+ state->rs[NINED3DRS_ALPHACOVERAGE] &= state->rs[D3DRS_ALPHATESTENABLE] ? 3 : 2;
state->changed.group |= NINE_STATE_BLEND;
return D3D_OK;
}
}
+ if (unlikely(State == D3DRS_ALPHATESTENABLE && (state->rs[NINED3DRS_ALPHACOVERAGE] & 2))) {
+ DWORD alphacoverage_prev = state->rs[NINED3DRS_ALPHACOVERAGE];
+ state->rs[NINED3DRS_ALPHACOVERAGE] = (Value ? 3 : 2);
+ if (state->rs[NINED3DRS_ALPHACOVERAGE] != alphacoverage_prev)
+ state->changed.group |= NINE_STATE_BLEND;
+ }
state->rs[State] = nine_fix_render_state_value(State, Value);
state->changed.rs[State / 32] |= 1 << (State % 32);
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c
index 461b416d2a2..fc708c29d38 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -162,7 +162,7 @@ nine_convert_blend_state(struct pipe_blend_state *blend_state, const DWORD *rs)
blend.dither = !!rs[D3DRS_DITHERENABLE];
/* blend.alpha_to_one = 0; */
- blend.alpha_to_coverage = !!rs[NINED3DRS_ALPHACOVERAGE];
+ blend.alpha_to_coverage = rs[NINED3DRS_ALPHACOVERAGE] & 1;
blend.rt[0].blend_enable = !!rs[D3DRS_ALPHABLENDENABLE];
if (blend.rt[0].blend_enable) {
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 91bf0cdb6e9..7e7a8996c91 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -33,6 +33,10 @@
#define NINED3DRS_VSPOINTSIZE (D3DRS_BLENDOPALPHA + 1)
#define NINED3DRS_RTMASK (D3DRS_BLENDOPALPHA + 2)
+/* ALPHACOVERAGE:
+ * bit 0: enable alpha coverage
+ * bit 1: ATOC is on
+ */
#define NINED3DRS_ALPHACOVERAGE (D3DRS_BLENDOPALPHA + 3)
#define D3DRS_LAST D3DRS_BLENDOPALPHA