st/nine: Use materials if source is not given.
authorAxel Davy <axel.davy@ens.fr>
Sat, 24 Sep 2016 20:49:31 +0000 (22:49 +0200)
committerAxel Davy <axel.davy@ens.fr>
Mon, 10 Oct 2016 21:43:50 +0000 (23:43 +0200)
Deduced by test on windows.

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

index 4c9292066846f005e3cac526fbdbb84a12de914e..86e142011c60fb33091719bcd3b93f5e3e93e97e 100644 (file)
@@ -1585,10 +1585,11 @@ nine_ff_get_vs(struct NineDevice9 *device)
         key.lighting = 0;
     }
     if ((key.lighting | key.darkness) && state->rs[D3DRS_COLORVERTEX]) {
-        key.mtl_diffuse = state->rs[D3DRS_DIFFUSEMATERIALSOURCE];
-        key.mtl_ambient = state->rs[D3DRS_AMBIENTMATERIALSOURCE];
-        key.mtl_specular = state->rs[D3DRS_SPECULARMATERIALSOURCE];
-        key.mtl_emissive = state->rs[D3DRS_EMISSIVEMATERIALSOURCE];
+        uint32_t mask = (key.color0in_one ? 0 : 1) | (key.color1in_zero ? 0 : 2);
+        key.mtl_diffuse = state->rs[D3DRS_DIFFUSEMATERIALSOURCE] & mask;
+        key.mtl_ambient = state->rs[D3DRS_AMBIENTMATERIALSOURCE] & mask;
+        key.mtl_specular = state->rs[D3DRS_SPECULARMATERIALSOURCE] & mask;
+        key.mtl_emissive = state->rs[D3DRS_EMISSIVEMATERIALSOURCE] & mask;
     }
     key.fog = !!state->rs[D3DRS_FOGENABLE];
     key.fog_mode = (!key.position_t && state->rs[D3DRS_FOGENABLE]) ? state->rs[D3DRS_FOGVERTEXMODE] : 0;