Henri Verbeet : wined3d: Move the surface map counting code to wined3d_surface_map().

Alexandre Julliard julliard at winehq.org
Thu Dec 1 14:05:31 CST 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Dec  1 07:31:39 2011 +0100

wined3d: Move the surface map counting code to wined3d_surface_map().

---

 dlls/wined3d/surface.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5ec4daa..b74e8d5 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -527,19 +527,6 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
 
     TRACE("surface %p.\n", surface);
 
-    /* Performance optimization: Count how often a surface is locked, if it is
-     * locked regularly do not throw away the system memory copy. This avoids
-     * the need to download the surface from OpenGL all the time. The surface
-     * is still downloaded if the OpenGL texture is changed. */
-    if (!(surface->flags & SFLAG_DYNLOCK))
-    {
-        if (++surface->lockCount > MAXLOCKCOUNT)
-        {
-            TRACE("Surface is locked regularly, not freeing the system memory copy any more.\n");
-            surface->flags |= SFLAG_DYNLOCK;
-        }
-    }
-
     /* Create a PBO for dynamically locked surfaces but don't do it for
      * converted or NPOT surfaces. Also don't create a PBO for systemmem
      * surfaces. */
@@ -3718,6 +3705,19 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
     if (!(surface->flags & SFLAG_LOCKABLE))
         WARN("Trying to lock unlockable surface.\n");
 
+    /* Performance optimization: Count how often a surface is mapped, if it is
+     * mapped regularly do not throw away the system memory copy. This avoids
+     * the need to download the surface from OpenGL all the time. The surface
+     * is still downloaded if the OpenGL texture is changed. */
+    if (!(surface->flags & SFLAG_DYNLOCK))
+    {
+        if (++surface->lockCount > MAXLOCKCOUNT)
+        {
+            TRACE("Surface is mapped regularly, not freeing the system memory copy any more.\n");
+            surface->flags |= SFLAG_DYNLOCK;
+        }
+    }
+
     surface->surface_ops->surface_map(surface, rect, flags);
 
     if (format->flags & WINED3DFMT_FLAG_BROKEN_PITCH)




More information about the wine-cvs mailing list