Stefan Dösinger : wined3d: Duplicate flips in software if the local copy is up to date.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jul 18 05:13:35 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 9740555d837bd5b82a1a0c6cf625ea8c4635a7cf
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9740555d837bd5b82a1a0c6cf625ea8c4635a7cf
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Jul 17 23:01:32 2006 +0200
wined3d: Duplicate flips in software if the local copy is up to date.
---
dlls/wined3d/swapchain.c | 51 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 3585ee3..e4b385d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -332,8 +332,55 @@ #endif
IWineD3DDevice_Clear((IWineD3DDevice*)This->wineD3DDevice, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER, 0x00, 1.0, 0);
}
- ((IWineD3DSurfaceImpl *) This->frontBuffer)->Flags |= SFLAG_GLDIRTY;
- ((IWineD3DSurfaceImpl *) This->backBuffer[0])->Flags |= SFLAG_GLDIRTY;
+ if(!(((IWineD3DSurfaceImpl *) This->frontBuffer)->Flags & SFLAG_GLDIRTY) ||
+ !(((IWineD3DSurfaceImpl *) This->backBuffer[0])->Flags & SFLAG_GLDIRTY) ) {
+ /* Both memory copies of the surfaces are ok, flip them around too instead of dirtifying */
+ IWineD3DSurfaceImpl *front = (IWineD3DSurfaceImpl *) This->frontBuffer;
+ IWineD3DSurfaceImpl *back = (IWineD3DSurfaceImpl *) This->backBuffer[0];
+ BOOL frontdirty = front->Flags & SFLAG_GLDIRTY;
+ BOOL backdirty = back->Flags & SFLAG_GLDIRTY;
+
+ /* Flip the DC */
+ {
+ HDC tmp;
+ tmp = front->hDC;
+ front->hDC = back->hDC;
+ back->hDC = tmp;
+ }
+
+ /* Flip the DIBsection */
+ {
+ HBITMAP tmp;
+ tmp = front->dib.DIBsection;
+ front->dib.DIBsection = back->dib.DIBsection;
+ back->dib.DIBsection = tmp;
+ }
+
+ /* Flip the surface data */
+ {
+ void* tmp;
+
+ tmp = front->dib.bitmap_data;
+ front->dib.bitmap_data = back->dib.bitmap_data;
+ back->dib.bitmap_data = tmp;
+
+ tmp = front->resource.allocatedMemory;
+ front->resource.allocatedMemory = back->resource.allocatedMemory;
+ back->resource.allocatedMemory = tmp;
+ }
+
+ /* client_memory should not be different, but just in case */
+ {
+ BOOL tmp;
+ tmp = front->dib.client_memory;
+ front->dib.client_memory = back->dib.client_memory;
+ back->dib.client_memory = tmp;
+ }
+ if(frontdirty) back->Flags |= SFLAG_GLDIRTY;
+ else back->Flags &= ~SFLAG_GLDIRTY;
+ if(backdirty) front->Flags |= SFLAG_GLDIRTY;
+ else front->Flags &= ~SFLAG_GLDIRTY;
+ }
TRACE("returning\n");
return WINED3D_OK;
More information about the wine-cvs
mailing list