From f5c8153eddecd709bbcb15fd1bae110a16bf0029 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 4 Jan 2010 21:33:11 +0100 Subject: [PATCH] wined3d: Handle stateblock capture for default lights created while recording. For non-recorded stateblocks a light always exists in the device stateblock as well, since that's where it's copied from. However, when SetLightEnable() is called for a light that didn't a exist yet while recording a stateblock, the light is only created on the recorded stateblock. --- dlls/wined3d/stateblock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 03c3e73bf1f..48f9eacc453 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -573,8 +573,17 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock if (!updated) { - ERR("Light %u in stateblock %p does not exist in device stateblock %p.\n", + /* This can happen if the light was originally created as a + * default light for SetLightEnable() while recording. */ + WARN("Light %u in stateblock %p does not exist in device stateblock %p.\n", src->OriginalIndex, This, targetStateBlock); + + src->OriginalParms = WINED3D_default_light; + if (src->glIndex != -1) + { + This->activeLights[src->glIndex] = NULL; + src->glIndex = -1; + } } } } -- 2.11.4.GIT