Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 18 ++++++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 3 files changed, 20 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index bf1e577f85c..898a4bc93d4 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1679,6 +1679,24 @@ HRESULT CDECL wined3d_stateblock_set_light(struct wined3d_stateblock *stateblock return wined3d_light_state_set_light(&stateblock->stateblock_state.light_state, light_idx, light, &object); }
+HRESULT CDECL wined3d_stateblock_set_light_enable(struct wined3d_stateblock *stateblock, UINT light_idx, BOOL enable) +{ + struct wined3d_light_info *light_info; + HRESULT hr; + + TRACE("stateblock %p, light_idx %u, enable %#x.\n", stateblock, light_idx, enable); + + if (!(light_info = wined3d_light_state_get_light(&stateblock->stateblock_state.light_state, light_idx))) + { + if (FAILED(hr = wined3d_light_state_set_light(&stateblock->stateblock_state.light_state, light_idx, + &WINED3D_default_light, &light_info))) + return hr; + } + wined3d_light_state_enable_light(&stateblock->stateblock_state.light_state, + &stateblock->device->adapter->d3d_info, light_info, enable); + return S_OK; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 8591aa51648..ea04c85d385 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -268,6 +268,7 @@ @ cdecl wined3d_stateblock_set_clip_plane(ptr long ptr) @ cdecl wined3d_stateblock_set_index_buffer(ptr ptr long) @ cdecl wined3d_stateblock_set_light(ptr long ptr) +@ cdecl wined3d_stateblock_set_light_enable(ptr long long) @ cdecl wined3d_stateblock_set_material(ptr ptr) @ cdecl wined3d_stateblock_set_pixel_shader(ptr ptr) @ cdecl wined3d_stateblock_set_ps_consts_b(ptr long long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 33f668f9347..fac9eef5be2 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2677,6 +2677,7 @@ void __cdecl wined3d_stateblock_set_index_buffer(struct wined3d_stateblock *stat struct wined3d_buffer *index_buffer, enum wined3d_format_id format_id); HRESULT __cdecl wined3d_stateblock_set_light(struct wined3d_stateblock *stateblock, UINT light_idx, const struct wined3d_light *light); +HRESULT __cdecl wined3d_stateblock_set_light_enable(struct wined3d_stateblock *stateblock, UINT light_idx, BOOL enable); void __cdecl wined3d_stateblock_set_material(struct wined3d_stateblock *stateblock, const struct wined3d_material *material); void __cdecl wined3d_stateblock_set_pixel_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader); HRESULT __cdecl wined3d_stateblock_set_ps_consts_b(struct wined3d_stateblock *stateblock,
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 4c865f30568..ec1800a6492 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2222,7 +2222,9 @@ static HRESULT WINAPI d3d9_device_LightEnable(IDirect3DDevice9Ex *iface, DWORD i TRACE("iface %p, index %u, enable %#x.\n", iface, index, enable);
wined3d_mutex_lock(); - hr = wined3d_device_set_light_enable(device->wined3d_device, index, enable); + hr = wined3d_stateblock_set_light_enable(device->update_state, index, enable); + if (SUCCEEDED(hr) && !device->recording) + hr = wined3d_device_set_light_enable(device->wined3d_device, index, enable); wined3d_mutex_unlock();
return hr;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index a7a08b3f809..92b67b92740 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1781,7 +1781,9 @@ static HRESULT WINAPI d3d8_device_LightEnable(IDirect3DDevice8 *iface, DWORD ind TRACE("iface %p, index %u, enable %#x.\n", iface, index, enable);
wined3d_mutex_lock(); - hr = wined3d_device_set_light_enable(device->wined3d_device, index, enable); + hr = wined3d_stateblock_set_light_enable(device->update_state, index, enable); + if (SUCCEEDED(hr) && !device->recording) + hr = wined3d_device_set_light_enable(device->wined3d_device, index, enable); wined3d_mutex_unlock();
return hr;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 55a9c6b6a18..cdb2e9c2ba9 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -6431,7 +6431,9 @@ static HRESULT d3d_device7_LightEnable(IDirect3DDevice7 *iface, DWORD light_idx, TRACE("iface %p, light_idx %u, enabled %#x.\n", iface, light_idx, enabled);
wined3d_mutex_lock(); - hr = wined3d_device_set_light_enable(device->wined3d_device, light_idx, enabled); + hr = wined3d_stateblock_set_light_enable(device->update_state, light_idx, enabled); + if (SUCCEEDED(hr) && !device->recording) + hr = wined3d_device_set_light_enable(device->wined3d_device, light_idx, enabled); wined3d_mutex_unlock();
return hr_ddraw_from_wined3d(hr);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com