Henri Verbeet : wined3d: Set SFLAG_DYNLOCK for lockable render targets.

Alexandre Julliard julliard at winehq.org
Wed May 11 13:02:55 CDT 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue May 10 21:18:44 2011 +0200

wined3d: Set SFLAG_DYNLOCK for lockable render targets.

---

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

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ff84102..9891b96 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -7423,6 +7423,15 @@ HRESULT surface_init(struct wined3d_surface *surface, WINED3DSURFTYPE surface_ty
         surface->flags |= SFLAG_DISCARD;
     if (lockable || format_id == WINED3DFMT_D16_LOCKABLE)
         surface->flags |= SFLAG_LOCKABLE;
+    /* I'm not sure if this qualifies as a hack or as an optimization. It
+     * seems reasonable to assume that lockable render targets will get
+     * locked, so we might as well set SFLAG_DYNLOCK right at surface
+     * creation. However, the other reason we want to do this is that several
+     * ddraw applications access surface memory while the surface isn't
+     * mapped. The SFLAG_DYNLOCK behaviour of keeping SYSMEM around for
+     * future locks prevents these from crashing. */
+    if (lockable && (usage & WINED3DUSAGE_RENDERTARGET))
+        surface->flags |= SFLAG_DYNLOCK;
 
     /* Mark the texture as dirty so that it gets loaded first time around. */
     surface_add_dirty_rect(surface, NULL);




More information about the wine-cvs mailing list