wined3d: Handle client storage in surface_init_sysmem().

This commit is contained in:
Henri Verbeet 2011-12-20 21:42:11 +01:00 committed by Alexandre Julliard
parent b57d1e7c33
commit 317d5406d5
1 changed files with 12 additions and 4 deletions

View File

@ -3956,13 +3956,21 @@ BOOL surface_init_sysmem(struct wined3d_surface *surface)
{
if (!surface->resource.allocatedMemory)
{
surface->resource.heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
surface->resource.size + RESOURCE_ALIGNMENT);
if (!surface->resource.heapMemory)
{
ERR("Out of memory\n");
return FALSE;
if (!(surface->resource.heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
surface->resource.size + RESOURCE_ALIGNMENT)))
{
ERR("Failed to allocate memory.\n");
return FALSE;
}
}
else if (!(surface->flags & SFLAG_CLIENT))
{
ERR("Surface %p has heapMemory %p and flags %#x.\n",
surface, surface->resource.heapMemory, surface->flags);
}
surface->resource.allocatedMemory =
(BYTE *)(((ULONG_PTR)surface->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1));
}