st/nine: Fix enabled lights in stateblocks
authorTiziano Bacocco <tizbac2@gmail.com>
Tue, 20 Jan 2015 23:41:11 +0000 (00:41 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:19 +0000 (00:07 +0100)
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Tiziano Bacocco <tizbac2@gmail.com>
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/stateblock9.c

index fe251fe3ce0dd4b28a6e9d9c372a8ec8e8c4d183..c6bd052dc8fbb075b19a999f0bd23f2480ada03d 100644 (file)
@@ -1965,7 +1965,9 @@ NineDevice9_GetLightEnable( struct NineDevice9 *This,
     for (i = 0; i < state->ff.num_lights_active; ++i)
         if (state->ff.active_light[i] == Index)
             break;
-    *pEnable = i != state->ff.num_lights_active;
+
+    *pEnable = i != state->ff.num_lights_active ? 128 : 0; // Taken from wine
+
     return D3D_OK;
 }
 
index 220b19618b1510e445e989c2a37b02f7b7146b0c..13217ae45470d4a80ce5979ba858259d8729f708 100644 (file)
@@ -275,7 +275,8 @@ nine_state_copy_common(struct nine_state *dst,
             if (mask->ff.light[i].Type != NINED3DLIGHT_INVALID)
                 dst->ff.light[i] = src->ff.light[i];
 
-        DBG("TODO: active lights\n");
+        memcpy(dst->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
+        dst->ff.num_lights_active = src->ff.num_lights_active;
     }
     if (mask->changed.group & NINE_STATE_FF_VSTRANSF) {
         for (i = 0; i < Elements(mask->ff.changed.transform); ++i) {
@@ -415,7 +416,8 @@ nine_state_copy_common_all(struct nine_state *dst,
         memcpy(dst->ff.light,
                src->ff.light, src->ff.num_lights * sizeof(dst->ff.light[0]));
 
-        DBG("TODO: active lights\n");
+        memcpy(dst->ff.active_light, src->ff.active_light, sizeof(src->ff.active_light) );
+        dst->ff.num_lights_active = src->ff.num_lights_active;
     }
 
     /* Transforms. */