Module: wine Branch: master Commit: e06b7693d6f0980b1db2fa3b9920c7a925ceb8be URL: http://source.winehq.org/git/wine.git/?a=commit;h=e06b7693d6f0980b1db2fa3b99...
Author: Paul Gofman gofmanp@gmail.com Date: Thu Aug 31 16:08:31 2017 +0300
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
---
dlls/d3dx9_36/effect.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 8095a0e..864f0e5 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -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