d3dx9: Use bitmask instead of BOOL array for light_updated.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2017-08-31 16:08:31 +03:00 committed by Alexandre Julliard
parent c48658dbb8
commit e06b7693d6
1 changed files with 12 additions and 8 deletions

View File

@ -178,7 +178,7 @@ struct ID3DXEffectImpl
DWORD begin_flags; DWORD begin_flags;
D3DLIGHT9 current_light[8]; D3DLIGHT9 current_light[8];
BOOL light_updated[8]; unsigned int light_updated;
D3DMATERIAL9 current_material; D3DMATERIAL9 current_material;
BOOL material_updated; BOOL material_updated;
}; };
@ -3067,7 +3067,7 @@ static HRESULT d3dx9_apply_state(struct ID3DXEffectImpl *effect, struct d3dx_pas
state_table[state->operation].op); state_table[state->operation].op);
d3dx9_set_light_parameter(state_table[state->operation].op, d3dx9_set_light_parameter(state_table[state->operation].op,
&effect->current_light[state->index], param_value); &effect->current_light[state->index], param_value);
effect->light_updated[state->index] = TRUE; effect->light_updated |= 1u << state->index;
return D3D_OK; return D3D_OK;
} }
case SC_MATERIAL: case SC_MATERIAL:
@ -3112,15 +3112,19 @@ static HRESULT d3dx9_apply_pass_states(struct ID3DXEffectImpl *effect, struct d3
ret = hr; ret = hr;
} }
} }
for (i = 0; i < ARRAY_SIZE(effect->current_light); ++i)
if (effect->light_updated)
{ {
if (effect->light_updated[i] for (i = 0; i < ARRAY_SIZE(effect->current_light); ++i)
&& FAILED(hr = SET_D3D_STATE(effect, SetLight, i, &effect->current_light[i])))
{ {
WARN("Error setting light, hr %#x.\n", hr); if ((effect->light_updated & (1u << i))
ret = hr; && FAILED(hr = SET_D3D_STATE(effect, SetLight, i, &effect->current_light[i])))
{
WARN("Error setting light, hr %#x.\n", hr);
ret = hr;
}
} }
effect->light_updated[i] = FALSE; effect->light_updated = 0;
} }
if (effect->material_updated if (effect->material_updated