wined3d: Initialize surfaces at creation.

This commit is contained in:
Stefan Dösinger 2007-07-08 23:33:48 +02:00 committed by Alexandre Julliard
parent 965471e378
commit 9ba3f389f6
1 changed files with 5 additions and 4 deletions

View File

@ -3464,13 +3464,14 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
This->glRect.bottom = This->pow2Height; This->glRect.bottom = This->pow2Height;
} }
if(GL_SUPPORT(APPLE_CLIENT_STORAGE) && This->resource.allocatedMemory == NULL) { if(This->resource.allocatedMemory == NULL) {
/* Make sure that memory is allocated from the start if we are going to use GL_APPLE_client_storage. /* Make sure memory exists from the start, and it is initialized properly. D3D initializes surfaces,
* Otherwise a glTexImage2D with a NULL pointer may be done, e.g. when blitting or with offscreen render * gl does not, so we need to upload zeroes to init the gl texture.
* targets, thus the client storage wouldn't be used for that texture
*/ */
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size + 4); This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size + 4);
} }
This->Flags |= SFLAG_INSYSMEM;
return WINED3D_OK; return WINED3D_OK;
} }