wined3d: Pass the draw rectangle to wined3d_blitter_ops.blitter_clear().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-04-04 09:07:46 +02:00 committed by Alexandre Julliard
parent d8f9b6b7f7
commit 52979b6b29
4 changed files with 36 additions and 20 deletions

View File

@ -7877,13 +7877,14 @@ static void arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
}
static void arbfp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *clear_rect,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
struct wined3d_blitter *next;
if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, rect, flags, colour, depth, stencil);
next->ops->blitter_clear(next, device, rt_count, fb,
clear_rect, draw_rect, flags, colour, depth, stencil);
}
static const struct wined3d_blitter_ops arbfp_blitter_ops =

View File

@ -4148,7 +4148,7 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
const struct wined3d_color *color, float depth, DWORD stencil)
{
struct wined3d_resource *resource;
RECT r;
RECT draw_rect, r;
TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil);
@ -4185,15 +4185,18 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return hr;
}
SetRect(&draw_rect, 0, 0, view->width, view->height);
if (flags == WINED3DCLEAR_TARGET)
{
struct wined3d_fb_state fb = {&view, NULL};
device->blitter->ops->blitter_clear(device->blitter, device, 1, &fb, rect, flags, color, depth, stencil);
device->blitter->ops->blitter_clear(device->blitter, device, 1, &fb,
rect, &draw_rect, flags, color, depth, stencil);
}
else
{
struct wined3d_fb_state fb = {NULL, view};
device->blitter->ops->blitter_clear(device->blitter, device, 0, &fb, rect, flags, color, depth, stencil);
device->blitter->ops->blitter_clear(device->blitter, device, 0, &fb,
rect, &draw_rect, flags, color, depth, stencil);
}
return WINED3D_OK;

View File

@ -2449,13 +2449,14 @@ static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
}
static void fbo_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *clear_rect,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
struct wined3d_blitter *next;
if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, rect, flags, colour, depth, stencil);
next->ops->blitter_clear(next, device, rt_count, fb,
clear_rect, draw_rect, flags, colour, depth, stencil);
}
static void fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
@ -2585,11 +2586,10 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
}
static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *clear_rect,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
struct wined3d_rendertarget_view *view = rt_count ? fb->render_targets[0] : fb->depth_stencil;
const RECT draw_rect = {0, 0, view->width, view->height};
struct wined3d_rendertarget_view *view;
struct wined3d_resource *resource;
struct wined3d_blitter *next;
unsigned int i;
@ -2627,12 +2627,14 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
goto next;
}
device_clear_render_targets(device, rt_count, fb, 1, rect, &draw_rect, flags, colour, depth, stencil);
device_clear_render_targets(device, rt_count, fb, 1,
clear_rect, draw_rect, flags, colour, depth, stencil);
return;
next:
if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, rect, flags, colour, depth, stencil);
next->ops->blitter_clear(next, device, rt_count, fb,
clear_rect, draw_rect, flags, colour, depth, stencil);
}
static void ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
@ -3423,14 +3425,24 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
}
static void cpu_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *clear_rect,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
const struct wined3d_box box = {rect->left, rect->top, rect->right, rect->bottom, 0, 1};
struct wined3d_color c = {depth, 0.0f, 0.0f, 0.0f};
struct wined3d_rendertarget_view *view;
struct wined3d_box box;
unsigned int i;
box.left = max(clear_rect->left, draw_rect->left);
box.top = max(clear_rect->top, draw_rect->top);
box.right = min(clear_rect->right, draw_rect->right);
box.bottom = min(clear_rect->bottom, draw_rect->bottom);
box.front = 0;
box.back = 1;
if (box.left >= box.right || box.top >= box.bottom)
return;
if (flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < rt_count; ++i)

View File

@ -1877,8 +1877,8 @@ struct wined3d_blitter_ops
{
void (*blitter_destroy)(struct wined3d_blitter *blitter, struct wined3d_context *context);
void (*blitter_clear)(struct wined3d_blitter *blitter, struct wined3d_device *device,
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil);
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *clear_rect,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil);
void (*blitter_blit)(struct wined3d_blitter *blitter, enum wined3d_blit_op op, struct wined3d_context *context,
struct wined3d_surface *src_surface, DWORD src_location, const RECT *src_rect,
struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect,