Commit 03e85bf9 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Merge wined3d_blitter_ops.color_fill() and wined3d_blitter_ops.depth_fill().

parent 8c98be47
......@@ -7868,18 +7868,10 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_
context->gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
}
static HRESULT arbfp_blit_color_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, const struct wined3d_color *color)
static void arbfp_blit_clear(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
FIXME("Color filling not implemented by arbfp_blit\n");
return WINED3DERR_INVALIDCALL;
}
static HRESULT arbfp_blit_depth_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD clear_flags, float depth, DWORD stencil)
{
FIXME("Depth/stencil filling not implemented by arbfp_blit.\n");
return WINED3DERR_INVALIDCALL;
ERR("This blitter does not implement clears.\n");
}
const struct wined3d_blitter_ops arbfp_blit =
......@@ -7887,7 +7879,6 @@ const struct wined3d_blitter_ops arbfp_blit =
arbfp_blit_alloc,
arbfp_blit_free,
arbfp_blit_supported,
arbfp_blit_color_fill,
arbfp_blit_depth_fill,
arbfp_blit_clear,
arbfp_blit_surface,
};
......@@ -4196,10 +4196,7 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return WINED3DERR_INVALIDCALL;
}
if (blit_op == WINED3D_BLIT_OP_COLOR_FILL)
blitter->color_fill(device, view, rect, color);
else
blitter->depth_fill(device, view, rect, flags, depth, stencil);
blitter->blitter_clear(device, view, rect, flags, color, depth, stencil);
return WINED3D_OK;
}
......
......@@ -2450,18 +2450,10 @@ static void fbo_blitter_free(struct wined3d_device *device)
{
}
static HRESULT fbo_blitter_colour_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, const struct wined3d_color *colour)
static void fbo_blitter_clear(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
ERR("This blitter does not implement colour fills.\n");
return E_NOTIMPL;
}
static HRESULT fbo_blitter_depth_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD clear_flags, float depth, DWORD stencil)
{
ERR("This blitter does not implement depth/stencil fills.\n");
return E_NOTIMPL;
ERR("This blitter does not implement clears.\n");
}
static void fbo_blitter_blit(struct wined3d_device *device, enum wined3d_blit_op op,
......@@ -2492,8 +2484,7 @@ const struct wined3d_blitter_ops fbo_blitter_ops =
fbo_blitter_alloc,
fbo_blitter_free,
fbo_blitter_supported,
fbo_blitter_colour_fill,
fbo_blitter_depth_fill,
fbo_blitter_clear,
fbo_blitter_blit,
};
......@@ -2574,27 +2565,21 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
}
}
static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, const struct wined3d_color *color)
static void ffp_blit_clear(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
{
const RECT draw_rect = {0, 0, view->width, view->height};
struct wined3d_fb_state fb = {&view, NULL};
device_clear_render_targets(device, 1, &fb, 1, rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
return WINED3D_OK;
}
static HRESULT ffp_blit_depth_fill(struct wined3d_device *device,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD clear_flags,
float depth, DWORD stencil)
{
const RECT draw_rect = {0, 0, view->width, view->height};
struct wined3d_fb_state fb = {NULL, view};
if (flags != WINED3DCLEAR_TARGET)
{
struct wined3d_fb_state fb = {NULL, view};
device_clear_render_targets(device, 0, &fb, 1, rect, &draw_rect, clear_flags, NULL, depth, stencil);
device_clear_render_targets(device, 0, &fb, 1, rect, &draw_rect, flags, NULL, depth, stencil);
return;
}
return WINED3D_OK;
device_clear_render_targets(device, 1, &fb, 1, rect, &draw_rect, flags, colour, 0.0f, 0);
}
static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op,
......@@ -2708,8 +2693,7 @@ const struct wined3d_blitter_ops ffp_blit =
ffp_blit_alloc,
ffp_blit_free,
ffp_blit_supported,
ffp_blit_color_fill,
ffp_blit_depth_fill,
ffp_blit_clear,
ffp_blit_blit_surface,
};
......@@ -3296,7 +3280,7 @@ release:
return hr;
}
static HRESULT surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
const struct wined3d_box *box, const struct wined3d_color *colour)
{
unsigned int x, y, w, h, bpp;
......@@ -3309,7 +3293,7 @@ static HRESULT surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *vie
if (view->format_flags & WINED3DFMT_FLAG_BLOCKS)
{
FIXME("Not implemented for format %s.\n", debug_d3dformat(view->format->id));
return E_NOTIMPL;
return;
}
c = wined3d_format_convert_from_float(view->format, colour);
......@@ -3356,7 +3340,7 @@ static HRESULT surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *vie
default:
FIXME("Not implemented for bpp %u.\n", bpp);
wined3d_resource_unmap(view->resource, view->sub_resource_idx);
return WINED3DERR_NOTAVAILABLE;
return;
}
row = map.data;
......@@ -3366,32 +3350,27 @@ static HRESULT surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *vie
memcpy(row, map.data, w * bpp);
}
wined3d_resource_unmap(view->resource, view->sub_resource_idx);
return WINED3D_OK;
}
static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, const struct wined3d_color *color)
static void cpu_blit_clear(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *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};
return surface_cpu_blt_colour_fill(view, &box, color);
}
static HRESULT cpu_blit_depth_fill(struct wined3d_device *device,
struct wined3d_rendertarget_view *view, const RECT *rect, DWORD clear_flags,
float depth, DWORD stencil)
{
const struct wined3d_box box = {rect->left, rect->top, rect->right, rect->bottom, 0, 1};
struct wined3d_color color = {depth, 0.0f, 0.0f, 0.0f};
if (flags == WINED3DCLEAR_TARGET)
{
surface_cpu_blt_colour_fill(view, &box, colour);
return;
}
if (clear_flags != WINED3DCLEAR_ZBUFFER)
if (flags == WINED3DCLEAR_ZBUFFER)
{
FIXME("clear_flags %#x not implemented.\n", clear_flags);
return WINED3DERR_INVALIDCALL;
surface_cpu_blt_colour_fill(view, &box, &c);
return;
}
return surface_cpu_blt_colour_fill(view, &box, &color);
FIXME("flags %#x not implemented.\n", flags);
}
static void cpu_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op,
......@@ -3408,8 +3387,7 @@ const struct wined3d_blitter_ops cpu_blit =
cpu_blit_alloc,
cpu_blit_free,
cpu_blit_supported,
cpu_blit_color_fill,
cpu_blit_depth_fill,
cpu_blit_clear,
cpu_blit_blit_surface,
};
......
......@@ -1875,10 +1875,8 @@ struct wined3d_blitter_ops
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op,
const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format,
const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format);
HRESULT (*color_fill)(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, const struct wined3d_color *color);
HRESULT (*depth_fill)(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD clear_flags, float depth, DWORD stencil);
void (*blitter_clear)(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil);
void (*blit_surface)(struct wined3d_device *device, 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,
......
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