[PATCH 1/1] wined3d: Use the resource size for copying between a surface's DIB and PBO.

Henri Verbeet hverbeet at codeweavers.com
Tue Aug 30 14:20:40 CDT 2011


The DIB size includes an extra line of padding, so using that would read /
write paste the end of the PBO. Preferably apply this before 78157, it fixes
some rare occasional crashes in the ddraw visual test.
---
 dlls/wined3d/surface.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ed047f2..48a5038 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1052,7 +1052,7 @@ static HRESULT surface_getdc(struct wined3d_surface *surface)
     /* Sync the DIB with the PBO. This can't be done earlier because Map()
      * activates the allocatedMemory. */
     if (surface->flags & SFLAG_PBO)
-        memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory, surface->dib.bitmap_size);
+        memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory, surface->resource.size);
 
     return hr;
 }
@@ -3813,11 +3813,9 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
         return WINEDDERR_NODC;
     }
 
+    /* Copy the contents of the DIB over to the PBO. */
     if ((surface->flags & SFLAG_PBO) && surface->resource.allocatedMemory)
-    {
-        /* Copy the contents of the DIB over to the PBO. */
-        memcpy(surface->resource.allocatedMemory, surface->dib.bitmap_data, surface->dib.bitmap_size);
-    }
+        memcpy(surface->resource.allocatedMemory, surface->dib.bitmap_data, surface->resource.size);
 
     /* We locked first, so unlock now. */
     wined3d_surface_unmap(surface);
-- 
1.7.3.4




More information about the wine-patches mailing list