summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/stateblock9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-08-16 21:39:42 +0200
committerAxel Davy <[email protected]>2016-02-04 22:12:17 +0100
commita82e67812a18208643919f44066452bd06558797 (patch)
treefea488ac28129098113097ff9f91a8f06dbe3a6f /src/gallium/state_trackers/nine/stateblock9.c
parent9c1d93f8e71506cff14596ab0bfc84ea23411c9e (diff)
st/nine: Initialize lights in stateblocks
This fixes a crash. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/stateblock9.c')
-rw-r--r--src/gallium/state_trackers/nine/stateblock9.c4
1 files changed, 4 insertions, 0 deletions
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)