wined3d: Allocate memory for default pool resources too.

This commit is contained in:
Stefan Dösinger 2007-10-22 12:37:21 +02:00 committed by Alexandre Julliard
parent a175e7b68e
commit f1f84a3615
2 changed files with 2 additions and 15 deletions

View File

@ -101,8 +101,8 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3
} \ } \
WineD3DAdapterChangeGLRam(This, _size); \ WineD3DAdapterChangeGLRam(This, _size); \
} \ } \
object->resource.allocatedMemory = (0 == _size ? NULL : Pool == WINED3DPOOL_DEFAULT ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size)); \ object->resource.allocatedMemory = (0 == _size ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size + 4)); \
if (object->resource.allocatedMemory == NULL && _size != 0 && Pool != WINED3DPOOL_DEFAULT) { \ if (object->resource.allocatedMemory == NULL && _size != 0) { \
FIXME("Out of memory!\n"); \ FIXME("Out of memory!\n"); \
HeapFree(GetProcessHeap(), 0, object); \ HeapFree(GetProcessHeap(), 0, object); \
*pp##type = NULL; \ *pp##type = NULL; \
@ -310,9 +310,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
TRACE("(%p) : Size=%d, Usage=%d, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object); TRACE("(%p) : Size=%d, Usage=%d, FVF=%x, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->resource.allocatedMemory, object);
*ppVertexBuffer = (IWineD3DVertexBuffer *)object; *ppVertexBuffer = (IWineD3DVertexBuffer *)object;
if (Pool == WINED3DPOOL_DEFAULT ) { /* Allocate some system memory for now */
object->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->resource.size);
}
object->fvf = FVF; object->fvf = FVF;
/* Observations show that drawStridedSlow is faster on dynamic VBs than converting + /* Observations show that drawStridedSlow is faster on dynamic VBs than converting +
@ -398,10 +395,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
/* Allocate the storage for the device */ /* Allocate the storage for the device */
D3DCREATERESOURCEOBJECTINSTANCE(object,IndexBuffer,WINED3DRTYPE_INDEXBUFFER, Length) D3DCREATERESOURCEOBJECTINSTANCE(object,IndexBuffer,WINED3DRTYPE_INDEXBUFFER, Length)
if (Pool == WINED3DPOOL_DEFAULT ) { /* We need a local copy for drawStridedSlow */
object->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,object->resource.size);
}
if(Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC) && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) { if(Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC) && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) {
CreateIndexBufferVBO(This, object); CreateIndexBufferVBO(This, object);
} }

View File

@ -3280,12 +3280,6 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
This->glRect.bottom = This->pow2Height; This->glRect.bottom = This->pow2Height;
} }
if(This->resource.allocatedMemory == NULL) {
/* Make sure memory exists from the start, and it is initialized properly. D3D initializes surfaces,
* gl does not, so we need to upload zeroes to init the gl texture.
*/
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size + 4);
}
This->Flags |= SFLAG_INSYSMEM; This->Flags |= SFLAG_INSYSMEM;
return WINED3D_OK; return WINED3D_OK;