Zebediah Figura : wined3d: Use wined3d_state_get_light() in wined3d_state_record_lights().
Alexandre Julliard
julliard at winehq.org
Mon Dec 3 15:28:54 CST 2018
Module: wine
Branch: master
Commit: 9f85d5dab0b17f53ec05f7706ea20b601b1aaf33
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9f85d5dab0b17f53ec05f7706ea20b601b1aaf33
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Dec 2 18:28:37 2018 -0600
wined3d: Use wined3d_state_get_light() in wined3d_state_record_lights().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/stateblock.c | 52 +++++++++++++++++++----------------------------
1 file changed, 21 insertions(+), 31 deletions(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 0b2ce50..9539ae0 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -622,6 +622,8 @@ void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3
static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state)
{
+ const struct wined3d_light_info *src;
+ struct wined3d_light_info *dst;
UINT i;
/* Lights... For a recorded state block, we just had a chain of actions
@@ -629,48 +631,36 @@ static void wined3d_state_record_lights(struct wined3d_state *dst_state, const s
* differ. */
for (i = 0; i < LIGHTMAP_SIZE; ++i)
{
- struct list *e, *f;
- LIST_FOR_EACH(e, &dst_state->light_map[i])
+ LIST_FOR_EACH_ENTRY(dst, &dst_state->light_map[i], struct wined3d_light_info, entry)
{
- BOOL updated = FALSE;
- struct wined3d_light_info *src = LIST_ENTRY(e, struct wined3d_light_info, entry), *realLight;
-
- /* Look up the light in the destination */
- LIST_FOR_EACH(f, &src_state->light_map[i])
+ if ((src = wined3d_state_get_light(src_state, dst->OriginalIndex)))
{
- realLight = LIST_ENTRY(f, struct wined3d_light_info, entry);
- if (realLight->OriginalIndex == src->OriginalIndex)
+ dst->OriginalParms = src->OriginalParms;
+
+ if (src->glIndex == -1 && dst->glIndex != -1)
{
- src->OriginalParms = realLight->OriginalParms;
-
- if (realLight->glIndex == -1 && src->glIndex != -1)
- {
- /* Light disabled */
- dst_state->lights[src->glIndex] = NULL;
- }
- else if (realLight->glIndex != -1 && src->glIndex == -1)
- {
- /* Light enabled */
- dst_state->lights[realLight->glIndex] = src;
- }
- src->glIndex = realLight->glIndex;
- updated = TRUE;
- break;
+ /* Light disabled. */
+ dst_state->lights[dst->glIndex] = NULL;
}
+ else if (src->glIndex != -1 && dst->glIndex == -1)
+ {
+ /* Light enabled. */
+ dst_state->lights[src->glIndex] = dst;
+ }
+ dst->glIndex = src->glIndex;
}
-
- if (!updated)
+ else
{
/* This can happen if the light was originally created as a
* default light for SetLightEnable() while recording. */
WARN("Light %u in dst_state %p does not exist in src_state %p.\n",
- src->OriginalIndex, dst_state, src_state);
+ dst->OriginalIndex, dst_state, src_state);
- src->OriginalParms = WINED3D_default_light;
- if (src->glIndex != -1)
+ dst->OriginalParms = WINED3D_default_light;
+ if (dst->glIndex != -1)
{
- dst_state->lights[src->glIndex] = NULL;
- src->glIndex = -1;
+ dst_state->lights[dst->glIndex] = NULL;
+ dst->glIndex = -1;
}
}
}
More information about the wine-cvs
mailing list