[PATCH 3/5] wined3d: Pass a wined3d_device_context to wined3d_shader_resource_view_generate_mipmaps().

Zebediah Figura z.figura12 at gmail.com
Wed Apr 7 21:20:01 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/d3d11/device.c       | 6 ++++--
 dlls/d3d9/texture.c       | 2 +-
 dlls/wined3d/view.c       | 7 ++++---
 dlls/wined3d/wined3d.spec | 2 +-
 include/wine/wined3d.h    | 3 ++-
 5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index ada668e3164..46cede6a2b8 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -1359,12 +1359,13 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearDepthStencilView(ID3D
 static void STDMETHODCALLTYPE d3d11_immediate_context_GenerateMips(ID3D11DeviceContext1 *iface,
         ID3D11ShaderResourceView *view)
 {
+    struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
     struct d3d_shader_resource_view *srv = unsafe_impl_from_ID3D11ShaderResourceView(view);
 
     TRACE("iface %p, view %p.\n", iface, view);
 
     wined3d_mutex_lock();
-    wined3d_shader_resource_view_generate_mipmaps(srv->wined3d_view);
+    wined3d_device_context_generate_mipmaps(context->wined3d_context, srv->wined3d_view);
     wined3d_mutex_unlock();
 }
 
@@ -4965,12 +4966,13 @@ static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device1 *
 static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device1 *iface,
         ID3D10ShaderResourceView *view)
 {
+    struct d3d_device *device = impl_from_ID3D10Device(iface);
     struct d3d_shader_resource_view *srv = unsafe_impl_from_ID3D10ShaderResourceView(view);
 
     TRACE("iface %p, view %p.\n", iface, view);
 
     wined3d_mutex_lock();
-    wined3d_shader_resource_view_generate_mipmaps(srv->wined3d_view);
+    wined3d_device_context_generate_mipmaps(device->immediate_context.wined3d_context, srv->wined3d_view);
     wined3d_mutex_unlock();
 }
 
diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c
index 989e6fd81c1..19f0363db07 100644
--- a/dlls/d3d9/texture.c
+++ b/dlls/d3d9/texture.c
@@ -100,7 +100,7 @@ void d3d9_texture_gen_auto_mipmap(struct d3d9_texture *texture)
     if (!(texture->flags & D3D9_TEXTURE_MIPMAP_DIRTY))
         return;
     d3d9_texture_acquire_shader_resource_view(texture);
-    wined3d_shader_resource_view_generate_mipmaps(texture->wined3d_srv);
+    wined3d_device_context_generate_mipmaps(texture->parent_device->immediate_context, texture->wined3d_srv);
     texture->flags &= ~D3D9_TEXTURE_MIPMAP_DIRTY;
 }
 
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index d386ebe1866..2d86f70f1bf 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -1404,11 +1404,12 @@ void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resou
     wined3d_context_vk_reference_texture(context_vk, texture_vk);
 }
 
-void CDECL wined3d_shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *view)
+void CDECL wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
+        struct wined3d_shader_resource_view *view)
 {
     struct wined3d_texture *texture;
 
-    TRACE("view %p.\n", view);
+    TRACE("context %p, view %p.\n", context, view);
 
     if (view->resource->type == WINED3D_RTYPE_BUFFER)
     {
@@ -1423,7 +1424,7 @@ void CDECL wined3d_shader_resource_view_generate_mipmaps(struct wined3d_shader_r
         return;
     }
 
-    wined3d_device_context_emit_generate_mipmaps(&view->resource->device->cs->c, view);
+    wined3d_device_context_emit_generate_mipmaps(context, view);
 }
 
 ULONG CDECL wined3d_unordered_access_view_incref(struct wined3d_unordered_access_view *view)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 34eca80a94e..70b73f1c710 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -171,6 +171,7 @@
 @ cdecl wined3d_device_context_draw_indirect(ptr ptr long long)
 @ cdecl wined3d_device_context_dispatch(ptr long long long)
 @ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
+@ cdecl wined3d_device_context_generate_mipmaps(ptr ptr)
 @ cdecl wined3d_device_context_resolve_sub_resource(ptr ptr long ptr long long)
 @ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
 @ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
@@ -260,7 +261,6 @@
 
 @ cdecl wined3d_shader_resource_view_create(ptr ptr ptr ptr ptr)
 @ cdecl wined3d_shader_resource_view_decref(ptr)
-@ cdecl wined3d_shader_resource_view_generate_mipmaps(ptr)
 @ cdecl wined3d_shader_resource_view_get_parent(ptr)
 @ cdecl wined3d_shader_resource_view_incref(ptr)
 
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0e356aa7ecb..05b07bd7e29 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2567,6 +2567,8 @@ void __cdecl wined3d_device_context_draw_indexed(struct wined3d_device_context *
         unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count);
 void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context *context,
         struct wined3d_buffer *buffer, unsigned int offset, bool indexed);
+void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
+        struct wined3d_shader_resource_view *view);
 void __cdecl wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context,
         struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx,
         struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, enum wined3d_format_id format_id);
@@ -2789,7 +2791,6 @@ HRESULT __cdecl wined3d_shader_resource_view_create(const struct wined3d_view_de
         struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops,
         struct wined3d_shader_resource_view **view);
 ULONG __cdecl wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view);
-void __cdecl wined3d_shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *view);
 void * __cdecl wined3d_shader_resource_view_get_parent(const struct wined3d_shader_resource_view *view);
 ULONG __cdecl wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view);
 
-- 
2.30.2




More information about the wine-devel mailing list