Commit a24d1479 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove the useless "changed" and "enabledChanged" fields from struct wined3d_light_info.

parent 3bc9d189
...@@ -2485,7 +2485,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I ...@@ -2485,7 +2485,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
list_add_head(&This->updateStateBlock->lightMap[Hi], &object->entry); list_add_head(&This->updateStateBlock->lightMap[Hi], &object->entry);
object->glIndex = -1; object->glIndex = -1;
object->OriginalIndex = Index; object->OriginalIndex = Index;
object->changed = TRUE;
} }
/* Initialize the object */ /* Initialize the object */
...@@ -2636,7 +2635,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D ...@@ -2636,7 +2635,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
} }
} }
lightInfo->enabledChanged = TRUE;
if(!Enable) { if(!Enable) {
if(lightInfo->glIndex != -1) { if(lightInfo->glIndex != -1) {
if(!This->isRecordingState) { if(!This->isRecordingState) {
......
...@@ -447,8 +447,6 @@ static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct li ...@@ -447,8 +447,6 @@ static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct li
struct wined3d_light_info *dst_light = HeapAlloc(GetProcessHeap(), 0, sizeof(*dst_light)); struct wined3d_light_info *dst_light = HeapAlloc(GetProcessHeap(), 0, sizeof(*dst_light));
*dst_light = *src_light; *dst_light = *src_light;
dst_light->changed = TRUE;
dst_light->enabledChanged = TRUE;
list_add_tail(&stateblock->lightMap[i], &dst_light->entry); list_add_tail(&stateblock->lightMap[i], &dst_light->entry);
} }
} }
...@@ -561,42 +559,34 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock ...@@ -561,42 +559,34 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock
LIST_FOR_EACH(e, &This->lightMap[i]) { LIST_FOR_EACH(e, &This->lightMap[i]) {
BOOL updated = FALSE; BOOL updated = FALSE;
struct wined3d_light_info *src = LIST_ENTRY(e, struct wined3d_light_info, entry), *realLight; struct wined3d_light_info *src = LIST_ENTRY(e, struct wined3d_light_info, entry), *realLight;
if (!src->changed && !src->enabledChanged) continue;
/* Look up the light in the destination */ /* Look up the light in the destination */
LIST_FOR_EACH(f, &targetStateBlock->lightMap[i]) { LIST_FOR_EACH(f, &targetStateBlock->lightMap[i]) {
realLight = LIST_ENTRY(f, struct wined3d_light_info, entry); realLight = LIST_ENTRY(f, struct wined3d_light_info, entry);
if(realLight->OriginalIndex == src->OriginalIndex) { if (realLight->OriginalIndex == src->OriginalIndex)
if(src->changed) { {
src->OriginalParms = realLight->OriginalParms; src->OriginalParms = realLight->OriginalParms;
if (realLight->glIndex == -1 && src->glIndex != -1)
{
/* Light disabled */
This->activeLights[src->glIndex] = NULL;
} }
if(src->enabledChanged) { else if (realLight->glIndex != -1 && src->glIndex == -1)
/* Need to double check because enabledChanged does not catch enabled -> disabled -> enabled {
* or disabled -> enabled -> disabled changes /* Light enabled */
*/ This->activeLights[realLight->glIndex] = src;
if(realLight->glIndex == -1 && src->glIndex != -1) {
/* Light disabled */
This->activeLights[src->glIndex] = NULL;
} else if(realLight->glIndex != -1 && src->glIndex == -1){
/* Light enabled */
This->activeLights[realLight->glIndex] = src;
}
src->glIndex = realLight->glIndex;
} }
src->glIndex = realLight->glIndex;
updated = TRUE; updated = TRUE;
break; break;
} }
} }
if(updated) { if (!updated)
/* Found a light, all done, proceed with next hash entry */ {
continue; ERR("Light %u in stateblock %p does not exist in device stateblock %p.\n",
} else if(src->changed) { src->OriginalIndex, This, targetStateBlock);
/* Otherwise assign defaul params */
src->OriginalParms = WINED3D_default_light;
} else {
/* Not enabled by default */
src->glIndex = -1;
} }
} }
} }
...@@ -987,12 +977,8 @@ static void apply_lights(IWineD3DDevice *pDevice, const IWineD3DStateBlockImpl * ...@@ -987,12 +977,8 @@ static void apply_lights(IWineD3DDevice *pDevice, const IWineD3DStateBlockImpl *
{ {
const struct wined3d_light_info *light = LIST_ENTRY(e, struct wined3d_light_info, entry); const struct wined3d_light_info *light = LIST_ENTRY(e, struct wined3d_light_info, entry);
if(light->changed) { IWineD3DDevice_SetLight(pDevice, light->OriginalIndex, &light->OriginalParms);
IWineD3DDevice_SetLight(pDevice, light->OriginalIndex, &light->OriginalParms); IWineD3DDevice_SetLightEnable(pDevice, light->OriginalIndex, light->glIndex != -1);
}
if(light->enabledChanged) {
IWineD3DDevice_SetLightEnable(pDevice, light->OriginalIndex, light->glIndex != -1);
}
} }
} }
} }
......
...@@ -1208,8 +1208,6 @@ struct wined3d_light_info ...@@ -1208,8 +1208,6 @@ struct wined3d_light_info
WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */ WINED3DLIGHT OriginalParms; /* Note D3D8LIGHT == D3D9LIGHT */
DWORD OriginalIndex; DWORD OriginalIndex;
LONG glIndex; LONG glIndex;
BOOL changed;
BOOL enabledChanged;
BOOL enabled; BOOL enabled;
/* Converted parms to speed up swapping lights */ /* Converted parms to speed up swapping lights */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment