[PATCH 5/5] wined3d: Use the blitter interface in wined3d_cs_exec_clear().
Henri Verbeet
hverbeet at codeweavers.com
Tue Apr 4 02:07:47 CDT 2017
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
dlls/wined3d/arb_program_shader.c | 6 ++--
dlls/wined3d/cs.c | 5 ++--
dlls/wined3d/device.c | 4 +--
dlls/wined3d/surface.c | 61 ++++++++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 2 +-
5 files changed, 43 insertions(+), 35 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index db07d76..4eb603f 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -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,
- 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)
{
struct wined3d_blitter *next;
if ((next = blitter->next))
- next->ops->blitter_clear(next, device, rt_count, fb,
- clear_rect, draw_rect, flags, colour, depth, stencil);
+ next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
}
static const struct wined3d_blitter_ops arbfp_blitter_ops =
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 423650c..841ceca 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -420,9 +420,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
device = cs->device;
wined3d_get_draw_rect(state, &draw_rect);
- device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
- state->fb, op->rect_count, op->rects, &draw_rect, op->flags,
- &op->color, op->depth, op->stencil);
+ 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, &op->color, op->depth, op->stencil);
if (op->flags & WINED3DCLEAR_TARGET)
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1197755..11a56f2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4190,13 +4190,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
{
struct wined3d_fb_state fb = {&view, NULL};
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
{
struct wined3d_fb_state fb = {NULL, view};
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;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index b8f10ae..cc5444b 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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,
- 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)
{
struct wined3d_blitter *next;
if ((next = blitter->next))
- next->ops->blitter_clear(next, device, rt_count, fb,
- clear_rect, draw_rect, flags, colour, depth, stencil);
+ next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
}
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,
}
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)
{
struct wined3d_rendertarget_view *view;
@@ -2627,14 +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,
- clear_rect, draw_rect, flags, colour, depth, stencil);
+ device_clear_render_targets(device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
return;
next:
if ((next = blitter->next))
- next->ops->blitter_clear(next, device, rt_count, fb,
- clear_rect, draw_rect, flags, colour, depth, stencil);
+ next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
+ clear_rects, draw_rect, flags, colour, depth, stencil);
}
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,
}
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)
{
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;
+ unsigned int i, j;
- if (box.left >= box.right || box.top >= box.bottom)
- return;
+ if (!rect_count)
+ {
+ rect_count = 1;
+ clear_rects = draw_rect;
+ }
- if (flags & WINED3DCLEAR_TARGET)
+ for (i = 0; i < rect_count; ++i)
{
- for (i = 0; i < rt_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.back = 1;
+
+ if (box.left >= box.right || box.top >= box.bottom)
+ continue;
+
+ if (flags & WINED3DCLEAR_TARGET)
{
- if ((view = fb->render_targets[i]))
- surface_cpu_blt_colour_fill(view, &box, colour);
+ for (j = 0; j < rt_count; ++j)
+ {
+ if ((view = fb->render_targets[j]))
+ surface_cpu_blt_colour_fill(view, &box, colour);
+ }
}
- }
- if ((flags & WINED3DCLEAR_ZBUFFER) && (view = fb->depth_stencil))
- surface_cpu_blt_colour_fill(view, &box, &c);
+ if ((flags & WINED3DCLEAR_ZBUFFER) && (view = fb->depth_stencil))
+ surface_cpu_blt_colour_fill(view, &box, &c);
+ }
if (flags & ~(WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER))
FIXME("flags %#x not implemented.\n", flags);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ee25862..0211d8e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1877,7 +1877,7 @@ 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 *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);
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,
--
2.1.4
More information about the wine-patches
mailing list