wined3d: Pass boxes instead of rectangles to wined3d_surface_blt().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-07 10:56:42 +03:30 committed by Alexandre Julliard
parent 92008ec4cf
commit 433ac881dd
3 changed files with 23 additions and 24 deletions

View File

@ -2050,17 +2050,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
struct wined3d_surface *dst_surface, *src_surface;
struct wined3d_texture *dst_texture, *src_texture;
RECT dst_rect, src_rect;
dst_texture = texture_from_resource(op->dst_resource);
src_texture = texture_from_resource(op->src_resource);
dst_surface = dst_texture->sub_resources[op->dst_sub_resource_idx].u.surface;
src_surface = src_texture->sub_resources[op->src_sub_resource_idx].u.surface;
SetRect(&dst_rect, op->dst_box.left, op->dst_box.top, op->dst_box.right, op->dst_box.bottom);
SetRect(&src_rect, op->src_box.left, op->src_box.top, op->src_box.right, op->src_box.bottom);
if (FAILED(wined3d_surface_blt(dst_surface, &dst_rect, src_surface,
&src_rect, op->flags, &op->fx, op->filter)))
if (FAILED(wined3d_surface_blt(dst_surface, &op->dst_box, src_surface,
&op->src_box, op->flags, &op->fx, op->filter)))
FIXME("Blit failed.\n");
}
else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_3D)

View File

@ -3696,12 +3696,10 @@ struct wined3d_blitter *wined3d_cpu_blitter_create(void)
return blitter;
}
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const struct wined3d_box *dst_box,
struct wined3d_surface *src_surface, const struct wined3d_box *src_box, DWORD flags,
const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{
struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
struct wined3d_texture_sub_resource *src_sub_resource, *dst_sub_resource;
@ -3715,14 +3713,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
struct wined3d_context *context;
enum wined3d_blit_op blit_op;
BOOL scale, convert, resolve;
RECT src_rect, dst_rect;
static const DWORD simple_blit = WINED3D_BLT_SRC_CKEY
| WINED3D_BLT_SRC_CKEY_OVERRIDE
| WINED3D_BLT_ALPHA_TEST
| WINED3D_BLT_RAW;
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
TRACE("dst_surface %p, dst_box %s, src_surface %p, src_box %s, flags %#x, fx %p, filter %s.\n",
dst_surface, debug_box(dst_box), src_surface, debug_box(src_box),
flags, fx, debug_d3dtexturefiltertype(filter));
TRACE("Usage is %s.\n", debug_d3dusage(dst_texture->resource.usage));
@ -3737,6 +3736,9 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
fx->src_color_key.color_space_high_value);
}
SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom);
SetRect(&dst_rect, dst_box->left, dst_box->top, dst_box->right, dst_box->bottom);
if (!fx || !(fx->fx))
flags &= ~WINED3D_BLT_FX;
@ -3777,8 +3779,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
}
scale = src_rect->right - src_rect->left != dst_rect->right - dst_rect->left
|| src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top;
scale = src_box->right - src_box->left != dst_box->right - dst_box->left
|| src_box->bottom - src_box->top != dst_box->bottom - dst_box->top;
convert = src_texture->resource.format->id != dst_texture->resource.format->id;
resolve = src_texture->resource.multisample_type != dst_texture->resource.multisample_type;
@ -3799,8 +3801,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
valid_locations = device->blitter->ops->blitter_blit(device->blitter,
WINED3D_BLIT_OP_DEPTH_BLIT, context,
src_surface, src_texture->resource.draw_binding, src_rect,
dst_surface, dst_location, dst_rect, NULL, filter);
src_surface, src_texture->resource.draw_binding, &src_rect,
dst_surface, dst_location, &dst_rect, NULL, filter);
context_release(context);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, valid_locations);
@ -3854,9 +3856,9 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Not doing upload because the destination format needs conversion.\n");
else
{
POINT dst_point = {dst_rect->left, dst_rect->top};
POINT dst_point = {dst_box->left, dst_box->top};
if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, src_rect)))
if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, &src_rect)))
{
if (!wined3d_resource_is_offscreen(&dst_texture->resource))
{
@ -3903,8 +3905,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
context = context_acquire(device, dst_texture, dst_sub_resource_idx);
valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
src_surface, src_texture->resource.draw_binding, src_rect,
dst_surface, dst_location, dst_rect, colour_key, filter);
src_surface, src_texture->resource.draw_binding, &src_rect,
dst_surface, dst_location, &dst_rect, colour_key, filter);
context_release(context);
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, valid_locations);
@ -3914,10 +3916,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
fallback:
/* Special cases for render targets. */
if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter)))
if (SUCCEEDED(surface_blt_special(dst_surface, &dst_rect, src_surface, &src_rect, flags, fx, filter)))
return WINED3D_OK;
cpu:
return surface_cpu_blt(dst_texture, dst_sub_resource_idx, &dst_box,
src_texture, src_sub_resource_idx, &src_box, flags, fx, filter);
return surface_cpu_blt(dst_texture, dst_sub_resource_idx, dst_box,
src_texture, src_sub_resource_idx, src_box, flags, fx, filter);
}

View File

@ -3343,8 +3343,8 @@ static inline struct wined3d_texture_sub_resource *surface_get_sub_resource(stru
return &surface->container->sub_resources[surface_get_sub_resource_idx(surface)];
}
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const struct wined3d_box *dst_box,
struct wined3d_surface *src_surface, const struct wined3d_box *src_box, DWORD flags,
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
struct wined3d_context *context) DECLSPEC_HIDDEN;