[PATCH 1/4] wined3d: Introduce wined3d_stateblock_set_light_enable().

Zebediah Figura z.figura12 at gmail.com
Fri Nov 15 09:46:50 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at 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,
-- 
2.23.0




More information about the wine-devel mailing list