Commit b98ece0d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use the blitter interface in wined3d_cs_exec_clear().

parent 52979b6b
...@@ -7877,14 +7877,14 @@ static void arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli ...@@ -7877,14 +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, 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 *clear_rect, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil) const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{ {
struct wined3d_blitter *next; struct wined3d_blitter *next;
if ((next = blitter->next)) if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
clear_rect, draw_rect, flags, colour, depth, stencil); clear_rects, draw_rect, flags, colour, depth, stencil);
} }
static const struct wined3d_blitter_ops arbfp_blitter_ops = static const struct wined3d_blitter_ops arbfp_blitter_ops =
......
...@@ -420,9 +420,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) ...@@ -420,9 +420,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
device = cs->device; device = cs->device;
wined3d_get_draw_rect(state, &draw_rect); wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, device->blitter->ops->blitter_clear(device->blitter, device, device->adapter->gl_info.limits.buffers,
state->fb, op->rect_count, op->rects, &draw_rect, op->flags, state->fb, op->rect_count, op->rects, &draw_rect, op->flags, &op->color, op->depth, op->stencil);
&op->color, op->depth, op->stencil);
if (op->flags & WINED3DCLEAR_TARGET) if (op->flags & WINED3DCLEAR_TARGET)
{ {
......
...@@ -4190,13 +4190,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi ...@@ -4190,13 +4190,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
{ {
struct wined3d_fb_state fb = {&view, NULL}; struct wined3d_fb_state fb = {&view, NULL};
device->blitter->ops->blitter_clear(device->blitter, device, 1, &fb, device->blitter->ops->blitter_clear(device->blitter, device, 1, &fb,
rect, &draw_rect, flags, color, depth, stencil); 1, rect, &draw_rect, flags, color, depth, stencil);
} }
else else
{ {
struct wined3d_fb_state fb = {NULL, view}; struct wined3d_fb_state fb = {NULL, view};
device->blitter->ops->blitter_clear(device->blitter, device, 0, &fb, device->blitter->ops->blitter_clear(device->blitter, device, 0, &fb,
rect, &draw_rect, flags, color, depth, stencil); 1, rect, &draw_rect, flags, color, depth, stencil);
} }
return WINED3D_OK; return WINED3D_OK;
......
...@@ -2449,14 +2449,14 @@ static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_ ...@@ -2449,14 +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, 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 *clear_rect, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil) const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{ {
struct wined3d_blitter *next; struct wined3d_blitter *next;
if ((next = blitter->next)) if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
clear_rect, draw_rect, flags, colour, depth, stencil); clear_rects, draw_rect, flags, colour, depth, stencil);
} }
static void fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op, static void fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
...@@ -2586,7 +2586,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, ...@@ -2586,7 +2586,7 @@ 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, 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 *clear_rect, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil) const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{ {
struct wined3d_rendertarget_view *view; struct wined3d_rendertarget_view *view;
...@@ -2627,14 +2627,14 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de ...@@ -2627,14 +2627,14 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
goto next; goto next;
} }
device_clear_render_targets(device, rt_count, fb, 1, device_clear_render_targets(device, rt_count, fb, rect_count,
clear_rect, draw_rect, flags, colour, depth, stencil); clear_rects, draw_rect, flags, colour, depth, stencil);
return; return;
next: next:
if ((next = blitter->next)) if ((next = blitter->next))
next->ops->blitter_clear(next, device, rt_count, fb, next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
clear_rect, draw_rect, flags, colour, depth, stencil); clear_rects, draw_rect, flags, colour, depth, stencil);
} }
static void ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op, static void ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op,
...@@ -3425,35 +3425,44 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view, ...@@ -3425,35 +3425,44 @@ 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, 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 *clear_rect, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil) const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{ {
struct wined3d_color c = {depth, 0.0f, 0.0f, 0.0f}; struct wined3d_color c = {depth, 0.0f, 0.0f, 0.0f};
struct wined3d_rendertarget_view *view; struct wined3d_rendertarget_view *view;
struct wined3d_box box; struct wined3d_box box;
unsigned int i; unsigned int i, j;
box.left = max(clear_rect->left, draw_rect->left); if (!rect_count)
box.top = max(clear_rect->top, draw_rect->top); {
box.right = min(clear_rect->right, draw_rect->right); rect_count = 1;
box.bottom = min(clear_rect->bottom, draw_rect->bottom); clear_rects = draw_rect;
}
for (i = 0; i < rect_count; ++i)
{
box.left = max(clear_rects[i].left, draw_rect->left);
box.top = max(clear_rects[i].top, draw_rect->top);
box.right = min(clear_rects[i].right, draw_rect->right);
box.bottom = min(clear_rects[i].bottom, draw_rect->bottom);
box.front = 0; box.front = 0;
box.back = 1; box.back = 1;
if (box.left >= box.right || box.top >= box.bottom) if (box.left >= box.right || box.top >= box.bottom)
return; continue;
if (flags & WINED3DCLEAR_TARGET) if (flags & WINED3DCLEAR_TARGET)
{ {
for (i = 0; i < rt_count; ++i) for (j = 0; j < rt_count; ++j)
{ {
if ((view = fb->render_targets[i])) if ((view = fb->render_targets[j]))
surface_cpu_blt_colour_fill(view, &box, colour); surface_cpu_blt_colour_fill(view, &box, colour);
} }
} }
if ((flags & WINED3DCLEAR_ZBUFFER) && (view = fb->depth_stencil)) if ((flags & WINED3DCLEAR_ZBUFFER) && (view = fb->depth_stencil))
surface_cpu_blt_colour_fill(view, &box, &c); surface_cpu_blt_colour_fill(view, &box, &c);
}
if (flags & ~(WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER)) if (flags & ~(WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER))
FIXME("flags %#x not implemented.\n", flags); FIXME("flags %#x not implemented.\n", flags);
......
...@@ -1877,7 +1877,7 @@ struct wined3d_blitter_ops ...@@ -1877,7 +1877,7 @@ struct wined3d_blitter_ops
{ {
void (*blitter_destroy)(struct wined3d_blitter *blitter, struct wined3d_context *context); void (*blitter_destroy)(struct wined3d_blitter *blitter, struct wined3d_context *context);
void (*blitter_clear)(struct wined3d_blitter *blitter, struct wined3d_device *device, void (*blitter_clear)(struct wined3d_blitter *blitter, struct wined3d_device *device,
unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *clear_rect, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects,
const RECT *draw_rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil); 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, 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 *src_surface, DWORD src_location, const RECT *src_rect,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment