summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-11-27 13:13:13 +0100
committerAxel Davy <[email protected]>2016-12-20 23:44:21 +0100
commit32f6f91617b5d90d162aab1d4fb97e58c692edb9 (patch)
tree91b7f4b95700002b0660eef409a7143b76818ae5 /src/gallium/state_trackers/nine
parent1efdc8f5946af509da697b604c6f2639c7080bc9 (diff)
st/nine: Fix two special cases in ff ps
if first alpha stage is disabled and writes to temp, diffuse alpha is written to temp. Last stage always writes to current. Behaviour was deduced by tests with a test app. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index c3245a302ee..294fbc89779 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -1773,6 +1773,26 @@ nine_ff_get_ps(struct NineDevice9 *device)
}
}
+ /* Note: If colorop is D3DTOP_DISABLE for the first stage
+ * (which implies alphaop is too), nothing particular happens,
+ * that is, current is equal to diffuse (which is the case anyway,
+ * because it is how it is initialized).
+ * Special case seems if alphaop is D3DTOP_DISABLE and not colorop,
+ * because then if the resultarg is TEMP, then diffuse alpha is written
+ * to it. */
+ if (key.ts[0].colorop != D3DTOP_DISABLE &&
+ key.ts[0].alphaop == D3DTOP_DISABLE &&
+ key.ts[0].resultarg != 0) {
+ key.ts[0].alphaop = D3DTOP_SELECTARG1;
+ key.ts[0].alphaarg1 = D3DTA_DIFFUSE;
+ }
+ /* When no alpha stage writes to current, diffuse alpha is taken.
+ * Since we initialize current to diffuse, we have the behaviour. */
+
+ /* Last stage always writes to Current */
+ if (s >= 1)
+ key.ts[s-1].resultarg = 0;
+
key.projected = nine_ff_get_projected_key(state);
key.specular = !!state->rs[D3DRS_SPECULARENABLE];