wined3d: Also pass the destination state directly to wined3d_state_record_lights().

This commit is contained in:
Henri Verbeet 2010-10-01 12:25:49 +02:00 committed by Alexandre Julliard
parent 545dc012cf
commit 5fd1b5c023

View file

@ -537,26 +537,23 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
return refCount; return refCount;
} }
/********************************************************** static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state)
* IWineD3DStateBlockImpl parts follows
**********************************************************/
static void record_lights(IWineD3DStateBlockImpl *This, const struct wined3d_state *state)
{ {
UINT i; UINT i;
/* Lights... For a recorded state block, we just had a chain of actions to perform, /* Lights... For a recorded state block, we just had a chain of actions
* so we need to walk that chain and update any actions which differ * to perform, so we need to walk that chain and update any actions which
*/ * differ. */
for (i = 0; i < LIGHTMAP_SIZE; ++i) for (i = 0; i < LIGHTMAP_SIZE; ++i)
{ {
struct list *e, *f; struct list *e, *f;
LIST_FOR_EACH(e, &This->state.light_map[i]) LIST_FOR_EACH(e, &dst_state->light_map[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;
/* Look up the light in the destination */ /* Look up the light in the destination */
LIST_FOR_EACH(f, &state->light_map[i]) LIST_FOR_EACH(f, &src_state->light_map[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)
@ -566,12 +563,12 @@ static void record_lights(IWineD3DStateBlockImpl *This, const struct wined3d_sta
if (realLight->glIndex == -1 && src->glIndex != -1) if (realLight->glIndex == -1 && src->glIndex != -1)
{ {
/* Light disabled */ /* Light disabled */
This->state.lights[src->glIndex] = NULL; dst_state->lights[src->glIndex] = NULL;
} }
else if (realLight->glIndex != -1 && src->glIndex == -1) else if (realLight->glIndex != -1 && src->glIndex == -1)
{ {
/* Light enabled */ /* Light enabled */
This->state.lights[realLight->glIndex] = src; dst_state->lights[realLight->glIndex] = src;
} }
src->glIndex = realLight->glIndex; src->glIndex = realLight->glIndex;
updated = TRUE; updated = TRUE;
@ -583,13 +580,13 @@ static void record_lights(IWineD3DStateBlockImpl *This, const struct wined3d_sta
{ {
/* This can happen if the light was originally created as a /* This can happen if the light was originally created as a
* default light for SetLightEnable() while recording. */ * default light for SetLightEnable() while recording. */
WARN("Light %u in stateblock %p does not exist in device state %p.\n", WARN("Light %u in dst_state %p does not exist in src_state %p.\n",
src->OriginalIndex, This, state); src->OriginalIndex, dst_state, src_state);
src->OriginalParms = WINED3D_default_light; src->OriginalParms = WINED3D_default_light;
if (src->glIndex != -1) if (src->glIndex != -1)
{ {
This->state.lights[src->glIndex] = NULL; dst_state->lights[src->glIndex] = NULL;
src->glIndex = -1; src->glIndex = -1;
} }
} }
@ -879,7 +876,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This->state.pixel_shader = src_state->pixel_shader; This->state.pixel_shader = src_state->pixel_shader;
} }
record_lights(This, src_state); wined3d_state_record_lights(&This->state, src_state);
TRACE("Captue done.\n"); TRACE("Captue done.\n");