Commit e06b7693 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Use bitmask instead of BOOL array for light_updated.

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