wined3d: Pass a wined3d_fb_state structure 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:45 +02:00 committed by Alexandre Julliard
parent ce5b25b8bc
commit d8f9b6b7f7
4 changed files with 63 additions and 42 deletions

View File

@ -7877,13 +7877,13 @@ 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,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
const struct wined3d_color *colour, float depth, DWORD stencil) 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, view, rect, flags, colour, depth, stencil); next->ops->blitter_clear(next, device, rt_count, fb, rect, flags, colour, depth, stencil);
} }
static const struct wined3d_blitter_ops arbfp_blitter_ops = static const struct wined3d_blitter_ops arbfp_blitter_ops =

View File

@ -4185,7 +4185,16 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return hr; return hr;
} }
device->blitter->ops->blitter_clear(device->blitter, device, view, rect, flags, color, depth, stencil); 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);
}
else
{
struct wined3d_fb_state fb = {NULL, view};
device->blitter->ops->blitter_clear(device->blitter, device, 0, &fb, rect, flags, color, depth, stencil);
}
return WINED3D_OK; return WINED3D_OK;
} }

View File

@ -2449,13 +2449,13 @@ 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,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
const struct wined3d_color *colour, float depth, DWORD stencil) 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, view, rect, flags, colour, depth, stencil); next->ops->blitter_clear(next, device, rt_count, fb, 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,
@ -2585,25 +2585,26 @@ 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,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
const struct wined3d_color *colour, float depth, DWORD stencil) 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}; const RECT draw_rect = {0, 0, view->width, view->height};
struct wined3d_resource *resource = view->resource; struct wined3d_resource *resource;
struct wined3d_fb_state fb = {&view, NULL};
struct wined3d_blitter *next; struct wined3d_blitter *next;
unsigned int i;
if (flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < rt_count; ++i)
{
if (!(view = fb->render_targets[i]))
continue;
resource = view->resource;
if (resource->pool == WINED3D_POOL_SYSTEM_MEM) if (resource->pool == WINED3D_POOL_SYSTEM_MEM)
goto next; goto next;
if (flags != WINED3DCLEAR_TARGET)
{
struct wined3d_fb_state fb = {NULL, view};
device_clear_render_targets(device, 0, &fb, 1, rect, &draw_rect, flags, NULL, depth, stencil);
return;
}
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{ {
if (!((view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) if (!((view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE)
@ -2615,15 +2616,23 @@ static void ffp_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_de
goto next; goto next;
} }
/* FIXME: We should reject colour fills on formats with fixups, but this /* FIXME: We should reject colour fills on formats with fixups,
* would break P8 colour fills for example. */ * but this would break P8 colour fills for example. */
}
}
device_clear_render_targets(device, 1, &fb, 1, rect, &draw_rect, flags, colour, 0.0f, 0); if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
if (fb->depth_stencil && fb->depth_stencil->resource->pool == WINED3D_POOL_SYSTEM_MEM)
goto next;
}
device_clear_render_targets(device, rt_count, fb, 1, rect, &draw_rect, flags, colour, depth, stencil);
return; return;
next: next:
if ((next = blitter->next)) if ((next = blitter->next))
next->ops->blitter_clear(next, device, view, rect, flags, colour, depth, stencil); next->ops->blitter_clear(next, device, rt_count, fb, 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,
@ -3414,24 +3423,27 @@ 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,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
const struct wined3d_color *colour, float depth, DWORD stencil) 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}; 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_color c = {depth, 0.0f, 0.0f, 0.0f};
struct wined3d_rendertarget_view *view;
unsigned int i;
if (flags == WINED3DCLEAR_TARGET) if (flags & WINED3DCLEAR_TARGET)
{ {
for (i = 0; i < rt_count; ++i)
{
if ((view = fb->render_targets[i]))
surface_cpu_blt_colour_fill(view, &box, colour); surface_cpu_blt_colour_fill(view, &box, colour);
return; }
} }
if (flags == WINED3DCLEAR_ZBUFFER) if ((flags & WINED3DCLEAR_ZBUFFER) && (view = fb->depth_stencil))
{
surface_cpu_blt_colour_fill(view, &box, &c); surface_cpu_blt_colour_fill(view, &box, &c);
return;
}
if (flags & ~(WINED3DCLEAR_TARGET | WINED3DCLEAR_ZBUFFER))
FIXME("flags %#x not implemented.\n", flags); FIXME("flags %#x not implemented.\n", flags);
} }

View File

@ -1877,8 +1877,8 @@ 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,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags, unsigned int rt_count, const struct wined3d_fb_state *fb, const RECT *rect,
const struct wined3d_color *colour, float depth, DWORD stencil); 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,
struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect, struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect,