[PATCH v2 1/5] wined3d: Pass a wined3d_device_context to wined3d_device_get_blend_state().

Zebediah Figura z.figura12 at gmail.com
Thu Apr 15 23:16:02 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/d3d11/device.c       | 4 ++--
 dlls/wined3d/device.c     | 9 +++++----
 dlls/wined3d/wined3d.spec | 2 +-
 include/wine/wined3d.h    | 2 ++
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index d93256e77ad..70d14c7f2c5 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2137,7 +2137,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargetsAndUnord
 static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11DeviceContext1 *iface,
         ID3D11BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
 {
-    struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
+    struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
     struct wined3d_blend_state *wined3d_state;
     struct d3d_blend_state *blend_state_impl;
 
@@ -2145,7 +2145,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11Devi
             iface, blend_state, blend_factor, sample_mask);
 
     wined3d_mutex_lock();
-    if ((wined3d_state = wined3d_device_get_blend_state(device->wined3d_device,
+    if ((wined3d_state = wined3d_device_context_get_blend_state(context->wined3d_context,
             (struct wined3d_color *)blend_factor, sample_mask)))
     {
         blend_state_impl = wined3d_blend_state_get_parent(wined3d_state);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 974db90037d..39701886450 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1603,12 +1603,12 @@ void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
     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,
+struct wined3d_blend_state * CDECL wined3d_device_context_get_blend_state(const struct wined3d_device_context *context,
         struct wined3d_color *blend_factor, unsigned int *sample_mask)
 {
-    const struct wined3d_state *state = device->cs->c.state;
+    const struct wined3d_state *state = context->state;
 
-    TRACE("device %p, blend_factor %p, sample_mask %p.\n", device, blend_factor, sample_mask);
+    TRACE("context %p, blend_factor %p, sample_mask %p.\n", context, blend_factor, sample_mask);
 
     *blend_factor = state->blend_factor;
     *sample_mask = state->sample_mask;
@@ -3921,6 +3921,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
     const struct wined3d_stateblock_state *state = &stateblock->stateblock_state;
     const struct wined3d_saved_states *changed = &stateblock->changed;
     const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT;
+    struct wined3d_device_context *context = &device->cs->c;
     unsigned int i, j, start, idx;
     struct wined3d_range range;
     uint32_t map;
@@ -4153,7 +4154,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
         if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR))
             wined3d_color_from_d3dcolor(&colour, state->rs[WINED3D_RS_BLENDFACTOR]);
         else
-            wined3d_device_get_blend_state(device, &colour, &sample_mask);
+            wined3d_device_context_get_blend_state(context, &colour, &sample_mask);
 
         if ((entry = wine_rb_get(&device->blend_states, &desc)))
         {
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 406e511c0f6..35fbc44ee64 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -55,7 +55,6 @@
 @ cdecl wined3d_device_end_scene(ptr)
 @ cdecl wined3d_device_evict_managed_resources(ptr)
 @ cdecl wined3d_device_get_available_texture_mem(ptr)
-@ cdecl wined3d_device_get_blend_state(ptr ptr)
 @ cdecl wined3d_device_get_clip_status(ptr ptr)
 @ cdecl wined3d_device_get_compute_shader(ptr)
 @ cdecl wined3d_device_get_creation_parameters(ptr ptr)
@@ -170,6 +169,7 @@
 @ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
 @ cdecl wined3d_device_context_flush(ptr)
 @ cdecl wined3d_device_context_generate_mipmaps(ptr ptr)
+@ cdecl wined3d_device_context_get_blend_state(ptr ptr ptr)
 @ cdecl wined3d_device_context_get_constant_buffer(ptr long long)
 @ cdecl wined3d_device_context_get_shader(ptr long)
 @ cdecl wined3d_device_context_issue_query(ptr ptr long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 1a58c671934..5b936017191 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2565,6 +2565,8 @@ void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context
 void __cdecl wined3d_device_context_flush(struct wined3d_device_context *context);
 void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
         struct wined3d_shader_resource_view *view);
+struct wined3d_blend_state * __cdecl wined3d_device_context_get_blend_state(
+        const struct wined3d_device_context *context, struct wined3d_color *blend_factor, unsigned int *sample_mask);
 struct wined3d_buffer * __cdecl wined3d_device_context_get_constant_buffer(const struct wined3d_device_context *context,
         enum wined3d_shader_type shader_type, unsigned int idx);
 struct wined3d_shader * __cdecl wined3d_device_context_get_shader(const struct wined3d_device_context *context,
-- 
2.30.2




More information about the wine-devel mailing list