Module: wine
Branch: master
Commit: 1fbc6e560d06e85b09b7e8460ae941cb0ba62062
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1fbc6e560d06e85b09b7e8460…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Wed Apr 22 19:19:41 2009 +0200
wined3d: Fix an issue in buffer_get_sysmem.
Checking for the doublebuffer flag can cause confusion if no VBO has
been allocated for the buffer. Checking for allocatedMemory is the
more direct approach.
---
dlls/wined3d/buffer.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index d201a53..8f68f5d 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -590,7 +590,8 @@ static ULONG STDMETHODCALLTYPE buffer_AddRef(IWineD3DBuffer *iface)
const BYTE *buffer_get_sysmem(struct wined3d_buffer *This)
{
- if(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) return This->resource.allocatedMemory;
+ /* AllocatedMemory exists if the buffer is double buffered or has no buffer object at all */
+ if(This->resource.allocatedMemory) return This->resource.allocatedMemory;
This->resource.heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size + RESOURCE_ALIGNMENT);
This->resource.allocatedMemory = (BYTE *)(((ULONG_PTR)This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));