wined3d: Pass a wined3d_device_context to wined3d_shader_resource_view_generate_mipmaps().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-04-08 23:45:06 -05:00 committed by Alexandre Julliard
parent 8163dcb6c8
commit 5a8b35c8f0
6 changed files with 31 additions and 27 deletions

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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)

View File

@ -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);