wined3d: Pass a wined3d_device_context to wined3d_texture_blt().

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-06 20:56:44 -05:00 committed by Alexandre Julliard
parent 8c4061a778
commit 86dcbadffb
10 changed files with 38 additions and 28 deletions

View file

@ -1348,6 +1348,7 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
IDirect3DSurface8 *src_surface, const RECT *src_rects, UINT rect_count,
IDirect3DSurface8 *dst_surface, const POINT *dst_points)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_surface *src = unsafe_impl_from_IDirect3DSurface8(src_surface);
struct d3d8_surface *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface);
enum wined3d_format_id src_format, dst_format;
@ -1394,7 +1395,7 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
if (!rect_count && !src_rects && !dst_points)
{
RECT rect = {0, 0, src_w, src_h};
wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &rect,
wined3d_device_context_blt(device->immediate_context, dst->wined3d_texture, dst->sub_resource_idx, &rect,
src->wined3d_texture, src->sub_resource_idx, &rect, 0, NULL, WINED3D_TEXF_POINT);
}
else
@ -1410,7 +1411,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
RECT dst_rect = {dst_points[i].x, dst_points[i].y,
dst_points[i].x + w, dst_points[i].y + h};
wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
wined3d_device_context_blt(device->immediate_context,
dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
}
}
@ -1422,7 +1424,8 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
UINT h = src_rects[i].bottom - src_rects[i].top;
RECT dst_rect = {0, 0, w, h};
wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
wined3d_device_context_blt(device->immediate_context,
dst->wined3d_texture, dst->sub_resource_idx, &dst_rect,
src->wined3d_texture, src->sub_resource_idx, &src_rects[i], 0, NULL, WINED3D_TEXF_POINT);
}
}

View file

@ -1750,6 +1750,7 @@ static HRESULT WINAPI d3d9_device_UpdateTexture(IDirect3DDevice9Ex *iface,
static HRESULT WINAPI d3d9_device_GetRenderTargetData(IDirect3DDevice9Ex *iface,
IDirect3DSurface9 *render_target, IDirect3DSurface9 *dst_surface)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct d3d9_surface *rt_impl = unsafe_impl_from_IDirect3DSurface9(render_target);
struct d3d9_surface *dst_impl = unsafe_impl_from_IDirect3DSurface9(dst_surface);
struct wined3d_sub_resource_desc wined3d_desc;
@ -1772,7 +1773,8 @@ static HRESULT WINAPI d3d9_device_GetRenderTargetData(IDirect3DDevice9Ex *iface,
if (wined3d_desc.multisample_type)
hr = D3DERR_INVALIDCALL;
else
hr = wined3d_texture_blt(dst_impl->wined3d_texture, dst_impl->sub_resource_idx, &dst_rect,
hr = wined3d_device_context_blt(device->immediate_context,
dst_impl->wined3d_texture, dst_impl->sub_resource_idx, &dst_rect,
rt_impl->wined3d_texture, rt_impl->sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT);
wined3d_mutex_unlock();
@ -1873,8 +1875,9 @@ static HRESULT WINAPI d3d9_device_StretchRect(IDirect3DDevice9Ex *iface, IDirect
}
}
hr = wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, dst_rect, src->wined3d_texture,
src->sub_resource_idx, src_rect, 0, NULL, wined3d_texture_filter_type_from_d3d(filter));
hr = wined3d_device_context_blt(device->immediate_context, dst->wined3d_texture,
dst->sub_resource_idx, dst_rect, src->wined3d_texture, src->sub_resource_idx,
src_rect, 0, NULL, wined3d_texture_filter_type_from_d3d(filter));
if (hr == WINEDDERR_INVALIDRECT)
hr = D3DERR_INVALIDCALL;
if (SUCCEEDED(hr) && dst->texture)

View file

@ -6173,8 +6173,8 @@ static void copy_mipmap_chain(struct d3d_device *device, struct ddraw_surface *d
UINT src_h = src_rect.bottom - src_rect.top;
RECT dst_rect = {point.x, point.y, point.x + src_w, point.y + src_h};
if (FAILED(hr = wined3d_texture_blt(ddraw_surface_get_any_texture(dst_level, DDRAW_SURFACE_RW),
dst_level->sub_resource_idx, &dst_rect,
if (FAILED(hr = wined3d_device_context_blt(device->immediate_context,
ddraw_surface_get_any_texture(dst_level, DDRAW_SURFACE_RW), dst_level->sub_resource_idx, &dst_rect,
ddraw_surface_get_any_texture(src_level, DDRAW_SURFACE_READ),
src_level->sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
ERR("Blit failed, hr %#x.\n", hr);

View file

@ -112,7 +112,7 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
else
dst_texture = ddraw->wined3d_frontbuffer;
if (SUCCEEDED(hr = wined3d_texture_blt(dst_texture, 0, rect,
if (SUCCEEDED(hr = wined3d_device_context_blt(ddraw->immediate_context, dst_texture, 0, rect,
ddraw_surface_get_any_texture(surface, DDRAW_SURFACE_READ), surface->sub_resource_idx, rect, 0,
NULL, WINED3D_TEXF_POINT)) && swap_interval)
{
@ -1561,9 +1561,10 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT *
if (!(flags & DDBLT_ASYNC))
wined3d_flags |= WINED3D_BLT_SYNCHRONOUS;
return wined3d_texture_blt(ddraw_surface_get_any_texture(dst_surface, DDRAW_SURFACE_RW),
dst_surface->sub_resource_idx, dst_rect, ddraw_surface_get_any_texture(src_surface, DDRAW_SURFACE_READ),
src_surface->sub_resource_idx, src_rect, wined3d_flags, fx, filter);
return wined3d_device_context_blt(dst_surface->ddraw->immediate_context,
ddraw_surface_get_any_texture(dst_surface, DDRAW_SURFACE_RW), dst_surface->sub_resource_idx, dst_rect,
ddraw_surface_get_any_texture(src_surface, DDRAW_SURFACE_READ), src_surface->sub_resource_idx, src_rect,
wined3d_flags, fx, filter);
}
static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, const RECT *dst_rect_in,
@ -4410,9 +4411,10 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH ddraw_surface7_BltFast(IDirectDrawSurfac
if (src_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
hr = ddraw_surface_update_frontbuffer(src_impl, src_rect, TRUE, 0);
if (SUCCEEDED(hr))
hr = wined3d_texture_blt(ddraw_surface_get_any_texture(dst_impl, DDRAW_SURFACE_RW),
dst_impl->sub_resource_idx, &dst_rect, ddraw_surface_get_any_texture(src_impl,DDRAW_SURFACE_READ),
src_impl->sub_resource_idx, src_rect, flags, NULL, WINED3D_TEXF_POINT);
hr = wined3d_device_context_blt(dst_impl->ddraw->immediate_context,
ddraw_surface_get_any_texture(dst_impl, DDRAW_SURFACE_RW), dst_impl->sub_resource_idx, &dst_rect,
ddraw_surface_get_any_texture(src_impl,DDRAW_SURFACE_READ), src_impl->sub_resource_idx, src_rect,
flags, NULL, WINED3D_TEXF_POINT);
if (SUCCEEDED(hr) && (dst_impl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
hr = ddraw_surface_update_frontbuffer(dst_impl, &dst_rect, FALSE, 0);
wined3d_mutex_unlock();

View file

@ -563,7 +563,7 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
RECT rect = {0, 0, logo_texture->resource.width, logo_texture->resource.height};
/* Blit the logo into the upper left corner of the back-buffer. */
wined3d_texture_blt(back_buffer, 0, &rect, logo_texture, 0,
wined3d_device_context_blt(&cs->c, back_buffer, 0, &rect, logo_texture, 0,
&rect, WINED3D_BLT_SRC_CKEY, NULL, WINED3D_TEXF_POINT);
}
@ -588,7 +588,7 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
if (desc->windowed)
MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&dst_rect, 2);
if (wined3d_clip_blit(&clip_rect, &dst_rect, &src_rect))
wined3d_texture_blt(back_buffer, 0, &dst_rect, cursor_texture, 0,
wined3d_device_context_blt(&cs->c, back_buffer, 0, &dst_rect, cursor_texture, 0,
&src_rect, WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT);
}

View file

@ -5197,7 +5197,7 @@ void CDECL wined3d_device_resolve_sub_resource(struct wined3d_device *device,
src_level = src_sub_resource_idx % src_texture->level_count;
SetRect(&src_rect, 0, 0, wined3d_texture_get_level_width(src_texture, src_level),
wined3d_texture_get_level_height(src_texture, src_level));
wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect,
wined3d_device_context_blt(&device->cs->c, dst_texture, dst_sub_resource_idx, &dst_rect,
src_texture, src_sub_resource_idx, &src_rect, 0, &fx, WINED3D_TEXF_POINT);
}

View file

@ -266,7 +266,7 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc
wine_dbgstr_rect(&dst_rect));
}
return wined3d_texture_blt(dst_texture, sub_resource_idx, &dst_rect,
return wined3d_device_context_blt(&swapchain->device->cs->c, dst_texture, sub_resource_idx, &dst_rect,
swapchain->front_buffer, 0, &src_rect, 0, NULL, WINED3D_TEXF_POINT);
}

View file

@ -3858,17 +3858,18 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
return WINED3D_OK;
}
HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
HRESULT CDECL wined3d_device_context_blt(struct wined3d_device_context *context,
struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect,
struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect,
unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{
struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
HRESULT hr;
TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_rect %s, src_texture %p, "
TRACE("context %p, dst_texture %p, dst_sub_resource_idx %u, dst_rect %s, src_texture %p, "
"src_sub_resource_idx %u, src_rect %s, flags %#x, fx %p, filter %s.\n",
dst_texture, dst_sub_resource_idx, wine_dbgstr_rect(dst_rect), src_texture,
context, dst_texture, dst_sub_resource_idx, wine_dbgstr_rect(dst_rect), src_texture,
src_sub_resource_idx, wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter));
if (dst_sub_resource_idx >= dst_texture->level_count * dst_texture->layer_count

View file

@ -163,6 +163,7 @@
@ cdecl wined3d_device_update_texture(ptr ptr ptr)
@ cdecl wined3d_device_validate_device(ptr ptr)
@ cdecl wined3d_device_context_blt(ptr ptr long ptr ptr long ptr long ptr long)
@ cdecl wined3d_device_context_copy_resource(ptr ptr ptr)
@ cdecl wined3d_device_context_copy_sub_resource_region(ptr ptr long long long long ptr long ptr long)
@ cdecl wined3d_device_context_copy_uav_counter(ptr ptr long ptr)
@ -327,7 +328,6 @@
@ cdecl wined3d_swapchain_state_set_fullscreen(ptr ptr ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
@ cdecl wined3d_texture_create(ptr ptr long long long ptr ptr ptr ptr)
@ cdecl wined3d_texture_decref(ptr)
@ cdecl wined3d_texture_from_resource(ptr)

View file

@ -2549,6 +2549,10 @@ 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);
HRESULT __cdecl wined3d_device_context_blt(struct wined3d_device_context *context,
struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect,
struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect,
unsigned int flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter);
void __cdecl wined3d_device_context_copy_resource(struct wined3d_device_context *context,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource);
HRESULT __cdecl wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context,
@ -2893,9 +2897,6 @@ HRESULT __cdecl wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region);
HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned int dst_idx, const RECT *dst_rect_in,
struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags,
const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter);
HRESULT __cdecl wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture);