[PATCH 4/4] wined3d: use stretch_rect_fbo for swapchainless blits
Roderick Colenbrander
thunderbird2k at gmail.com
Wed Apr 28 07:29:22 CDT 2010
This patch improves performance by at least 20% under normal conditions in King's Bounty games. In some cases the game calls StretchRect a lot and the performance can drop to <10fps and in that case this patch helps even more.
---
dlls/wined3d/surface.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index deb5926..ca50933 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3423,15 +3423,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
if (srcSwapchain) IWineD3DSwapChain_Release((IWineD3DSwapChain *)srcSwapchain);
}
- /* Early sort out of cases where no render target is used */
- if (!dstSwapchain && !srcSwapchain
- && src_surface != device->render_targets[0]
- && dst_surface != device->render_targets[0])
- {
- TRACE("No surface is render target, not using hardware blit.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
/* No destination color keying supported */
if(Flags & (WINEDDBLT_KEYDEST | WINEDDBLT_KEYDESTOVERRIDE)) {
/* Can we support that with glBlendFunc if blitting to the frame buffer? */
@@ -3442,6 +3433,23 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
surface_get_rect(dst_surface, DestRect, &dst_rect);
if (src_surface) surface_get_rect(src_surface, SrcRect, &src_rect);
+ /* Early sort out of cases where no render target is used */
+ if (!dstSwapchain && !srcSwapchain
+ && src_surface != device->render_targets[0]
+ && dst_surface != device->render_targets[0])
+ {
+ if (fbo_blit_supported(&device->adapter->gl_info, BLIT_OP_BLIT,
+ &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format_desc,
+ &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format_desc))
+ {
+ stretch_rect_fbo(device, src_surface, &src_rect, dst_surface, &dst_rect, Filter);
+ return WINED3D_OK;
+ }
+
+ TRACE("No surface is render target, not using hardware blit.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
/* The only case where both surfaces on a swapchain are supported is a back buffer -> front buffer blit on the same swapchain */
if (dstSwapchain && dstSwapchain == srcSwapchain && dstSwapchain->back_buffers
&& dst_surface == dstSwapchain->front_buffer
--
1.6.3.3
More information about the wine-patches
mailing list