Stefan Dösinger : wined3d: Allocate memory for default pool resources too.

Alexandre Julliard julliard at winehq.org
Thu Nov 1 07:39:43 CDT 2007


Module: wine
Branch: master
Commit: f1f84a36155b9deb9983f12cd466b3ede31e6a13
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f1f84a36155b9deb9983f12cd466b3ede31e6a13

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Oct 22 12:37:21 2007 +0200

wined3d: Allocate memory for default pool resources too.

---

 dlls/wined3d/device.c  |   11 ++---------
 dlls/wined3d/surface.c |    6 ------
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2f957ae..17aeea2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -101,8 +101,8 @@ static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3
         } \
         WineD3DAdapterChangeGLRam(This, _size); \
     } \
-    object->resource.allocatedMemory = (0 == _size ? NULL : Pool == WINED3DPOOL_DEFAULT ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size)); \
-    if (object->resource.allocatedMemory == NULL && _size != 0 && Pool != WINED3DPOOL_DEFAULT) { \
+    object->resource.allocatedMemory = (0 == _size ? NULL : HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _size + 4)); \
+    if (object->resource.allocatedMemory == NULL && _size != 0) { \
         FIXME("Out of memory!\n"); \
         HeapFree(GetProcessHeap(), 0, object); \
         *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);
     *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;
 
     /* 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 */
     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)) {
         CreateIndexBufferVBO(This, object);
     }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index afb0b78..07501f2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3280,12 +3280,6 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
         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;
 
     return WINED3D_OK;




More information about the wine-cvs mailing list