Zebediah Figura : wined3d: Introduce wined3d_device_context_set_depth_stencil_state().

Alexandre Julliard julliard at winehq.org
Thu Mar 11 15:59:35 CST 2021


Module: wine
Branch: master
Commit: 41f521b59be289978a5b2b42338b81f666376210
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=41f521b59be289978a5b2b42338b81f666376210

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Mar 10 19:25:16 2021 -0600

wined3d: Introduce wined3d_device_context_set_depth_stencil_state().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/device.c     | 36 ++++++++++++++++++++++--------------
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  2 ++
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0b24342d2f3..3864bcfbb81 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1761,22 +1761,9 @@ struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct w
 void CDECL wined3d_device_set_depth_stencil_state(struct wined3d_device *device,
         struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref)
 {
-    struct wined3d_state *state = device->cs->c.state;
-    struct wined3d_depth_stencil_state *prev;
-
     TRACE("device %p, depth_stencil_state %p, stencil_ref %u.\n", device, depth_stencil_state, stencil_ref);
 
-    prev = state->depth_stencil_state;
-    if (prev == depth_stencil_state && state->stencil_ref == stencil_ref)
-        return;
-
-    if (depth_stencil_state)
-        wined3d_depth_stencil_state_incref(depth_stencil_state);
-    state->depth_stencil_state = depth_stencil_state;
-    state->stencil_ref = stencil_ref;
-    wined3d_device_context_emit_set_depth_stencil_state(&device->cs->c, depth_stencil_state, stencil_ref);
-    if (prev)
-        wined3d_depth_stencil_state_decref(prev);
+    wined3d_device_context_set_depth_stencil_state(&device->cs->c, depth_stencil_state, stencil_ref);
 }
 
 struct wined3d_depth_stencil_state * CDECL wined3d_device_get_depth_stencil_state(const struct wined3d_device *device,
@@ -2142,6 +2129,27 @@ void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context
         wined3d_blend_state_decref(prev);
 }
 
+void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
+        struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref)
+{
+    struct wined3d_state *state = context->state;
+    struct wined3d_depth_stencil_state *prev;
+
+    TRACE("context %p, depth_stencil_state %p, stencil_ref %u.\n", context, depth_stencil_state, stencil_ref);
+
+    prev = state->depth_stencil_state;
+    if (prev == depth_stencil_state && state->stencil_ref == stencil_ref)
+        return;
+
+    if (depth_stencil_state)
+        wined3d_depth_stencil_state_incref(depth_stencil_state);
+    state->depth_stencil_state = depth_stencil_state;
+    state->stencil_ref = stencil_ref;
+    wined3d_device_context_emit_set_depth_stencil_state(context, depth_stencil_state, stencil_ref);
+    if (prev)
+        wined3d_depth_stencil_state_decref(prev);
+}
+
 void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
 {
     TRACE("device %p, shader %p.\n", device, shader);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 17cff7ffb9f..04bb975da73 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -169,6 +169,7 @@
 
 @ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
 @ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
+@ cdecl wined3d_device_context_set_depth_stencil_state(ptr ptr long)
 @ cdecl wined3d_device_context_set_shader(ptr long ptr)
 
 @ cdecl wined3d_output_find_closest_matching_mode(ptr ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index ead427a13f6..c52f328c277 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2553,6 +2553,8 @@ void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_contex
         struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask);
 void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context,
         enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer);
+void __cdecl wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
+        struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref);
 void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *context,
         enum wined3d_shader_type type, struct wined3d_shader *shader);
 




More information about the wine-cvs mailing list