Module: wine Branch: master Commit: 2f028f034044c80e69f59b67ca1bc76e40119690 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f028f034044c80e69f59b67ca...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Jul 23 11:31:05 2010 +0200
wined3d: Avoid loading the destination surface in stretch_rect_fbo() if it will be completely overwritten.
---
dlls/wined3d/device.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 17a4b83..df9e1d6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5743,6 +5743,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice } }
+static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r) +{ + if ((r->left && r->right) || abs(r->right - r->left) != surface->currentDesc.Width) + return FALSE; + if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->currentDesc.Height) + return FALSE; + return TRUE; +} + void stretch_rect_fbo(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in, IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, const WINED3DTEXTUREFILTERTYPE filter) { @@ -5772,11 +5781,13 @@ void stretch_rect_fbo(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surfa break; }
- /* Make sure the drawables are up-to-date. Note that loading the - * destination surface isn't strictly required if we overwrite the - * entire surface. */ + /* Make sure the drawables are up-to-date. Loading the destination + * surface isn't required if the entire surface is overwritten. (And is + * in fact harmful if we're being called by surface_load_location() with + * the purpose of loading the destination surface.) */ surface_load_location(src_surface, SFLAG_INDRAWABLE, NULL); - surface_load_location(dst_surface, SFLAG_INDRAWABLE, NULL); + if (!surface_is_full_rect(dst_surface, &dst_rect)) + surface_load_location(dst_surface, SFLAG_INDRAWABLE, NULL);
if (!surface_is_offscreen(src_surface)) context = context_acquire(device, src_surface); else if (!surface_is_offscreen(dst_surface)) context = context_acquire(device, dst_surface);