Henri Verbeet : wined3d: Avoid some unneeded rendertarget copies.

Alexandre Julliard julliard at winehq.org
Wed Jun 17 10:43:25 CDT 2009


Module: wine
Branch: master
Commit: 60317d027a047c19c1a4789a60ed65b934bf51b1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=60317d027a047c19c1a4789a60ed65b934bf51b1

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Jun 17 10:19:53 2009 +0200

wined3d: Avoid some unneeded rendertarget copies.

---

 dlls/wined3d/drawprim.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index acbfbf9..5ff7477 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -554,16 +554,22 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertice
 
     IWineD3DDeviceImpl           *This = (IWineD3DDeviceImpl *)iface;
     IWineD3DSurfaceImpl          *target;
+    BOOL load_rt, modify_rt;
     unsigned int i;
 
     if (!index_count) return;
 
+    load_rt = This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE]
+            || This->stateBlock->renderState[WINED3DRS_ALPHATESTENABLE]
+            || This->stateBlock->renderState[WINED3DRS_COLORKEYENABLE];
+    modify_rt = This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE];
+
     /* Invalidate the back buffer memory so LockRect will read it the next time */
     for(i = 0; i < GL_LIMITS(buffers); i++) {
         target = (IWineD3DSurfaceImpl *) This->render_targets[i];
         if (target) {
-            IWineD3DSurface_LoadLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, NULL);
-            IWineD3DSurface_ModifyLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, TRUE);
+            if (load_rt) IWineD3DSurface_LoadLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, NULL);
+            if (modify_rt) IWineD3DSurface_ModifyLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, TRUE);
         }
     }
 




More information about the wine-cvs mailing list