Roderick Colenbrander : wined3d: Add color_fill to blit_shader.
Alexandre Julliard
julliard at winehq.org
Tue Mar 30 10:39:44 CDT 2010
Module: wine
Branch: master
Commit: a7d3b616c43c66adcce9bc63ddc4f91d5c84bc82
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7d3b616c43c66adcce9bc63ddc4f91d5c84bc82
Author: Roderick Colenbrander <thunderbird2k at gmail.com>
Date: Thu Mar 25 17:01:33 2010 +0100
wined3d: Add color_fill to blit_shader.
---
dlls/wined3d/arb_program_shader.c | 7 +++
dlls/wined3d/surface.c | 78 +++++++++++++++++++++++++++++-------
dlls/wined3d/wined3d_private.h | 2 +
3 files changed, 72 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index da8072c..8e613c9 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -6848,12 +6848,19 @@ static BOOL arbfp_blit_color_fixup_supported(const struct wined3d_gl_info *gl_in
}
}
+static HRESULT arbfp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect, DWORD fill_color)
+{
+ FIXME("Color filling not implemented by arbfp_blit\n");
+ return WINED3DERR_INVALIDCALL;
+}
+
const struct blit_shader arbfp_blit = {
arbfp_blit_alloc,
arbfp_blit_free,
arbfp_blit_set,
arbfp_blit_unset,
arbfp_blit_color_fixup_supported,
+ arbfp_blit_color_fill
};
#undef GLINFO_LOCATION
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2cfcb36..7bb983f 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4183,20 +4183,10 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
} else {
/* Source-Less Blit to render target */
if (Flags & WINEDDBLT_COLORFILL) {
- /* This is easy to handle for the D3D Device... */
DWORD color;
TRACE("Colorfill\n");
- /* This == (IWineD3DSurfaceImpl *) myDevice->render_targets[0] || dstSwapchain
- must be true if we are here */
- if (This != (IWineD3DSurfaceImpl *) myDevice->render_targets[0] &&
- !(This == (IWineD3DSurfaceImpl*) dstSwapchain->frontBuffer ||
- (dstSwapchain->backBuffer && This == (IWineD3DSurfaceImpl*) dstSwapchain->backBuffer[0]))) {
- TRACE("Surface is higher back buffer, falling back to software\n");
- return WINED3DERR_INVALIDCALL;
- }
-
/* The color as given in the Blt function is in the format of the frame-buffer...
* 'clear' expect it in ARGB format => we need to do some conversion :-)
*/
@@ -4206,10 +4196,16 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
return WINED3DERR_INVALIDCALL;
}
- TRACE("(%p) executing Render Target override, color = %x\n", This, color);
- IWineD3DDeviceImpl_ClearSurface(myDevice, This, 1 /* Number of rectangles */,
- &rect, WINED3DCLEAR_TARGET, color, 0.0f /* Z */, 0 /* Stencil */);
- return WINED3D_OK;
+ /* This == (IWineD3DSurfaceImpl *) myDevice->render_targets[0] || dstSwapchain
+ must be true if we are here */
+ if (This != (IWineD3DSurfaceImpl *) myDevice->render_targets[0] &&
+ !(This == (IWineD3DSurfaceImpl*) dstSwapchain->frontBuffer ||
+ (dstSwapchain->backBuffer && This == (IWineD3DSurfaceImpl*) dstSwapchain->backBuffer[0]))) {
+ TRACE("Surface is higher back buffer, falling back to software\n");
+ return cpu_blit.color_fill(myDevice, This, (RECT*)&rect, color);
+ }
+
+ return ffp_blit.color_fill(myDevice, This, (RECT*)&rect, color);
}
}
@@ -5245,10 +5241,62 @@ static BOOL ffp_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info
return FALSE;
}
+static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect, DWORD fill_color)
+{
+ return IWineD3DDeviceImpl_ClearSurface(device, dst_surface, 1 /* Number of rectangles */,
+ (const WINED3DRECT*)dst_rect, WINED3DCLEAR_TARGET, fill_color, 0.0f /* Z */, 0 /* Stencil */);
+}
+
const struct blit_shader ffp_blit = {
ffp_blit_alloc,
ffp_blit_free,
ffp_blit_set,
ffp_blit_unset,
- ffp_blit_color_fixup_supported
+ ffp_blit_color_fixup_supported,
+ ffp_blit_color_fill
+};
+
+static HRESULT cpu_blit_alloc(IWineD3DDevice *iface)
+{
+ return WINED3D_OK;
+}
+
+/* Context activation is done by the caller. */
+static void cpu_blit_free(IWineD3DDevice *iface)
+{
+}
+
+/* Context activation is done by the caller. */
+static HRESULT cpu_blit_set(IWineD3DDevice *iface, const struct wined3d_format_desc *format_desc,
+ GLenum textype, UINT width, UINT height)
+{
+ return WINED3D_OK;
+}
+
+/* Context activation is done by the caller. */
+static void cpu_blit_unset(IWineD3DDevice *iface)
+{
+}
+
+static BOOL cpu_blit_color_fixup_supported(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup)
+{
+ return FALSE;
+}
+
+static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect, DWORD fill_color)
+{
+ WINEDDBLTFX BltFx;
+ memset(&BltFx, 0, sizeof(BltFx));
+ BltFx.dwSize = sizeof(BltFx);
+ BltFx.u5.dwFillColor = color_convert_argb_to_fmt(fill_color, dst_surface->resource.format_desc->format);
+ return IWineD3DBaseSurfaceImpl_Blt((IWineD3DSurface*)dst_surface, dst_rect, NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT);
+}
+
+const struct blit_shader cpu_blit = {
+ cpu_blit_alloc,
+ cpu_blit_free,
+ cpu_blit_set,
+ cpu_blit_unset,
+ cpu_blit_color_fixup_supported,
+ cpu_blit_color_fill
};
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0f134d7..77c7d83 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1177,10 +1177,12 @@ struct blit_shader
GLenum textype, UINT width, UINT height);
void (*unset_shader)(IWineD3DDevice *iface);
BOOL (*color_fixup_supported)(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup);
+ HRESULT (*color_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect, DWORD fill_color);
};
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;
typedef enum ContextUsage {
CTXUSAGE_RESOURCELOAD = 1, /* Only loads textures: No State is applied */
More information about the wine-cvs
mailing list