Zebediah Figura : wined3d: Pass a wined3d_device_context to wined3d_shader_resource_view_generate_mipmaps().
Alexandre Julliard
julliard at winehq.org
Fri Apr 9 14:53:20 CDT 2021
Module: wine
Branch: master
Commit: 5a8b35c8f062713b357491d140fdac675de7e208
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5a8b35c8f062713b357491d140fdac675de7e208
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Apr 8 23:45:06 2021 -0500
wined3d: Pass a wined3d_device_context to wined3d_shader_resource_view_generate_mipmaps().
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/d3d11/device.c | 6 ++++--
dlls/d3d9/texture.c | 2 +-
dlls/wined3d/device.c | 23 +++++++++++++++++++++++
dlls/wined3d/view.c | 22 ----------------------
dlls/wined3d/wined3d.spec | 2 +-
include/wine/wined3d.h | 3 ++-
6 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index d94babcbb24..ab5ad625bdf 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/device.c b/dlls/wined3d/device.c
index c7b743e0ff3..7051f3749a3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5291,6 +5291,29 @@ HRESULT CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *devic
return wined3d_device_context_set_depth_stencil_view(&device->cs->c, view);
}
+void CDECL wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context,
+ struct wined3d_shader_resource_view *view)
+{
+ struct wined3d_texture *texture;
+
+ TRACE("context %p, view %p.\n", context, view);
+
+ if (view->resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ WARN("Called on buffer resource %p.\n", view->resource);
+ return;
+ }
+
+ texture = texture_from_resource(view->resource);
+ if (!(texture->flags & WINED3D_TEXTURE_GENERATE_MIPMAPS))
+ {
+ WARN("Texture without the WINED3D_TEXTURE_GENERATE_MIPMAPS flag, ignoring.\n");
+ return;
+ }
+
+ wined3d_device_context_emit_generate_mipmaps(context, view);
+}
+
static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device,
struct wined3d_texture *cursor_image, unsigned int sub_resource_idx)
{
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index d386ebe1866..03abaf57102 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -1404,28 +1404,6 @@ 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)
-{
- struct wined3d_texture *texture;
-
- TRACE("view %p.\n", view);
-
- if (view->resource->type == WINED3D_RTYPE_BUFFER)
- {
- WARN("Called on buffer resource %p.\n", view->resource);
- return;
- }
-
- texture = texture_from_resource(view->resource);
- if (!(texture->flags & WINED3D_TEXTURE_GENERATE_MIPMAPS))
- {
- WARN("Texture without the WINED3D_TEXTURE_GENERATE_MIPMAPS flag, ignoring.\n");
- return;
- }
-
- wined3d_device_context_emit_generate_mipmaps(&view->resource->device->cs->c, view);
-}
-
ULONG CDECL wined3d_unordered_access_view_incref(struct wined3d_unordered_access_view *view)
{
ULONG refcount = InterlockedIncrement(&view->refcount);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index a18969a7e9a..3df1f19b837 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 36e6e5aae00..35bcb45f851 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);
More information about the wine-cvs
mailing list