wined3d: Introduce surface_color_fill().

This is also a first attempt at a more structured interface to blitter
operations.
This commit is contained in:
Henri Verbeet 2010-08-29 21:57:42 +02:00 committed by Alexandre Julliard
parent 9363ea55ee
commit ecc67757ab
3 changed files with 45 additions and 15 deletions

View File

@ -3354,6 +3354,22 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT
context_release(context);
}
static HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color)
{
IWineD3DDeviceImpl *device = s->resource.device;
const struct blit_shader *blitter;
blitter = wined3d_select_blitter(&device->adapter->gl_info, BLIT_OP_COLOR_FILL,
NULL, 0, 0, NULL, rect, s->resource.usage, s->resource.pool, s->resource.format_desc);
if (!blitter)
{
FIXME("No blitter is capable of performing the requested color fill operation.\n");
return WINED3DERR_INVALIDCALL;
}
return blitter->color_fill(device, s, rect, color);
}
/* Not called from the VTable */
static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, const RECT *DestRect,
IWineD3DSurfaceImpl *src_surface, const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx,
@ -3737,21 +3753,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
if (!surface_convert_color_to_float(dst_surface, DDBltFx->u5.dwFillColor, &color))
return WINED3DERR_INVALIDCALL;
if (ffp_blit.blit_supported(gl_info, BLIT_OP_COLOR_FILL,
NULL, 0, 0, NULL,
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool,
dst_surface->resource.format_desc))
{
return ffp_blit.color_fill(device, dst_surface, &dst_rect, &color);
}
else if (cpu_blit.blit_supported(gl_info, BLIT_OP_COLOR_FILL,
NULL, 0, 0, NULL,
&dst_rect, dst_surface->resource.usage, dst_surface->resource.pool,
dst_surface->resource.format_desc))
{
return cpu_blit.color_fill(device, dst_surface, &dst_rect, &color);
}
return WINED3DERR_INVALIDCALL;
return surface_color_fill(dst_surface, &dst_rect, &color);
}
}

View File

@ -3136,3 +3136,26 @@ void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected,
else if (gl_info->supported[ATI_FRAGMENT_SHADER]) *ps_selected = SHADER_ATI;
else *ps_selected = SHADER_NONE;
}
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format,
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format)
{
static const struct blit_shader * const blitters[] =
{
&arbfp_blit,
&ffp_blit,
&cpu_blit,
};
unsigned int i;
for (i = 0; i < sizeof(blitters) / sizeof(*blitters); ++i)
{
if (blitters[i]->blit_supported(gl_info, blit_op,
src_rect, src_usage, src_pool, src_format,
dst_rect, dst_usage, dst_pool, dst_format))
return blitters[i];
}
return NULL;
}

View File

@ -1151,6 +1151,11 @@ extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN;
extern const struct blit_shader arbfp_blit DECLSPEC_HIDDEN;
extern const struct blit_shader cpu_blit DECLSPEC_HIDDEN;
const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op,
const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format_desc *src_format,
const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format_desc *dst_format)
DECLSPEC_HIDDEN;
/* Temporary blit_shader helper functions */
HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum blit_operation blit_op,