From: Axel Davy Date: Sun, 16 Aug 2015 19:39:42 +0000 (+0200) Subject: st/nine: Initialize lights in stateblocks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a82e67812a18208643919f44066452bd06558797;p=mesa.git st/nine: Initialize lights in stateblocks This fixes a crash. Signed-off-by: Axel Davy Reviewed-by: Patrick Rudolph --- diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c index 6d6e1be0b7f..77039596fdc 100644 --- a/src/gallium/state_trackers/nine/stateblock9.c +++ b/src/gallium/state_trackers/nine/stateblock9.c @@ -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)