From 1fbc6e560d06e85b09b7e8460ae941cb0ba62062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 22 Apr 2009 19:19:41 +0200 Subject: [PATCH] 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 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index d201a53407d..8f68f5d659b 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));