From bb62ea925a9aaebb053f0df14a9b7c995fdb6537 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 19 Oct 2016 23:36:50 +0200 Subject: st/nine: Refactor LightEnable Call a helper function. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/device9.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'src/gallium/state_trackers/nine/device9.c') diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 74c1bea7857..3fd1cdffab9 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -2123,7 +2123,6 @@ NineDevice9_LightEnable( struct NineDevice9 *This, BOOL Enable ) { struct nine_state *state = This->update; - unsigned i; DBG("This=%p Index=%u Enable=%i\n", This, Index, Enable); @@ -2139,30 +2138,8 @@ NineDevice9_LightEnable( struct NineDevice9 *This, light.Direction.z = 1.0f; NineDevice9_SetLight(This, Index, &light); } - user_assert(Index < state->ff.num_lights, D3DERR_INVALIDCALL); - - for (i = 0; i < state->ff.num_lights_active; ++i) { - if (state->ff.active_light[i] == Index) - break; - } - if (Enable) { - if (i < state->ff.num_lights_active) - return D3D_OK; - /* XXX wine thinks this should still succeed: - */ - user_assert(i < NINE_MAX_LIGHTS_ACTIVE, D3DERR_INVALIDCALL); - - state->ff.active_light[i] = Index; - state->ff.num_lights_active++; - } else { - if (i == state->ff.num_lights_active) - return D3D_OK; - --state->ff.num_lights_active; - for (; i < state->ff.num_lights_active; ++i) - state->ff.active_light[i] = state->ff.active_light[i + 1]; - } - state->changed.group |= NINE_STATE_FF_LIGHTING; + nine_state_light_enable(&state->ff, &state->changed.group, Index, Enable); return D3D_OK; } -- cgit v1.2.3