st/nine: Initialize lights in stateblocks
authorAxel Davy <axel.davy@ens.fr>
Sun, 16 Aug 2015 19:39:42 +0000 (21:39 +0200)
committerAxel Davy <axel.davy@ens.fr>
Thu, 4 Feb 2016 21:12:17 +0000 (22:12 +0100)
This fixes a crash.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
src/gallium/state_trackers/nine/stateblock9.c

index 6d6e1be0b7fc2342323cc19206e7a8e163ed88a3..77039596fdc2a9b826bbc8494e2af5aac55cc677 100644 (file)
@@ -269,6 +269,10 @@ nine_state_copy_common(struct nine_state *dst,
             dst->ff.light = REALLOC(dst->ff.light,
                                     dst->ff.num_lights * sizeof(D3DLIGHT9),
                                     mask->ff.num_lights * sizeof(D3DLIGHT9));
+            for (i = dst->ff.num_lights; i < mask->ff.num_lights; ++i) {
+                memset(&dst->ff.light[i], 0, sizeof(D3DLIGHT9));
+                dst->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
+            }
             dst->ff.num_lights = mask->ff.num_lights;
         }
         for (i = 0; i < mask->ff.num_lights; ++i)