Zebediah Figura : wined3d: Introduce wined3d_device_context_set_blend_state().

Alexandre Julliard julliard at winehq.org
Wed Mar 10 14:58:46 CST 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Mar  9 20:09:00 2021 -0600

wined3d: Introduce wined3d_device_context_set_blend_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     | 41 +++++++++++++++++++++++++----------------
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  2 ++
 3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8ea7351f5fc..d5179f68cd6 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1740,25 +1740,10 @@ static void resolve_depth_buffer(struct wined3d_device *device)
 void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
         struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor, unsigned int sample_mask)
 {
-    struct wined3d_state *state = device->cs->c.state;
-    struct wined3d_blend_state *prev;
-
     TRACE("device %p, blend_state %p, blend_factor %s, sample_mask %#x.\n",
             device, blend_state, debug_color(blend_factor), sample_mask);
 
-    prev = state->blend_state;
-    if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))
-            && sample_mask == state->sample_mask)
-        return;
-
-    if (blend_state)
-        wined3d_blend_state_incref(blend_state);
-    state->blend_state = blend_state;
-    state->blend_factor = *blend_factor;
-    state->sample_mask = sample_mask;
-    wined3d_device_context_emit_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask);
-    if (prev)
-        wined3d_blend_state_decref(prev);
+    wined3d_device_context_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask);
 }
 
 struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct wined3d_device *device,
@@ -2133,6 +2118,30 @@ void CDECL wined3d_device_context_set_constant_buffer(struct wined3d_device_cont
         wined3d_buffer_decref(prev);
 }
 
+void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
+        struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor, unsigned int sample_mask)
+{
+    struct wined3d_state *state = context->state;
+    struct wined3d_blend_state *prev;
+
+    TRACE("context %p, blend_state %p, blend_factor %p, sample_mask %#x.\n",
+            context, blend_state, blend_factor, sample_mask);
+
+    prev = state->blend_state;
+    if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))
+            && sample_mask == state->sample_mask)
+        return;
+
+    if (blend_state)
+        wined3d_blend_state_incref(blend_state);
+    state->blend_state = blend_state;
+    state->blend_factor = *blend_factor;
+    state->sample_mask = sample_mask;
+    wined3d_device_context_emit_set_blend_state(context, blend_state, blend_factor, sample_mask);
+    if (prev)
+        wined3d_blend_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 d88817d6551..17cff7ffb9f 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -167,6 +167,7 @@
 @ cdecl wined3d_device_update_texture(ptr ptr ptr)
 @ cdecl wined3d_device_validate_device(ptr ptr)
 
+@ 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_shader(ptr long ptr)
 
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0bdf53c651e..ead427a13f6 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2549,6 +2549,8 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device,
         struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture);
 HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
 
+void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
+        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_shader(struct wined3d_device_context *context,




More information about the wine-cvs mailing list