st/nine: Small simplification for position_t and fog
authorAxel Davy <axel.davy@ens.fr>
Sat, 24 Sep 2016 08:14:42 +0000 (10:14 +0200)
committerAxel Davy <axel.davy@ens.fr>
Mon, 10 Oct 2016 21:43:50 +0000 (23:43 +0200)
position_t disables fog computation.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/nine_ff.c

index 7b3c67c30a35c01f028a8d521b5c8936909a3ed6..40717f1951004fe30ea9e0978d15747bfe7b7c2b 100644 (file)
@@ -919,9 +919,6 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
         struct ureg_dst tmp = ureg_DECL_temporary(ureg);
         struct ureg_dst tmp_x = ureg_writemask(tmp, TGSI_WRITEMASK_X);
         struct ureg_dst tmp_z = ureg_writemask(tmp, TGSI_WRITEMASK_Z);
-        if (key->position_t) {
-            ureg_MOV(ureg, ureg_saturate(tmp_x), ureg_scalar(vs->aCol[1], TGSI_SWIZZLE_W));
-        } else
         if (key->fog_range) {
             ureg_DP3(ureg, tmp_x, vs->aVtx, vs->aVtx);
             ureg_RSQ(ureg, tmp_z, _X(tmp));
@@ -941,7 +938,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
             ureg_MUL(ureg, tmp_x, _X(tmp), ureg_imm1f(ureg, -1.442695f));
             ureg_EX2(ureg, tmp_x, _X(tmp));
         } else
-        if (key->fog_mode == D3DFOG_LINEAR && !key->position_t) {
+        if (key->fog_mode == D3DFOG_LINEAR) {
             ureg_SUB(ureg, tmp_x, _XXXX(_CONST(28)), _Z(tmp));
             ureg_MUL(ureg, ureg_saturate(tmp_x), _X(tmp), _YYYY(_CONST(28)));
         }
@@ -1573,9 +1570,9 @@ nine_ff_get_vs(struct NineDevice9 *device)
         key.mtl_emissive = state->rs[D3DRS_EMISSIVEMATERIALSOURCE];
     }
     key.fog = !!state->rs[D3DRS_FOGENABLE];
-    key.fog_mode = state->rs[D3DRS_FOGENABLE] ? state->rs[D3DRS_FOGVERTEXMODE] : 0;
+    key.fog_mode = (!key.position_t && state->rs[D3DRS_FOGENABLE]) ? state->rs[D3DRS_FOGVERTEXMODE] : 0;
     if (key.fog_mode)
-        key.fog_range = !key.position_t && state->rs[D3DRS_RANGEFOGENABLE];
+        key.fog_range = state->rs[D3DRS_RANGEFOGENABLE];
 
     key.localviewer = !!state->rs[D3DRS_LOCALVIEWER];
     key.specular_enable = !!state->rs[D3DRS_SPECULARENABLE];