Stefan Dösinger : wined3d: Allocate render target management members in Init3D.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 26 06:36:50 CDT 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Jul 16 19:49:34 2007 +0200

wined3d: Allocate render target management members in Init3D.

---

 dlls/wined3d/device.c  |   16 ++++++++++++----
 dlls/wined3d/directx.c |    4 ----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 43c65b6..07d5a79 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -192,10 +192,6 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
             GL_EXTCALL(glDeleteFramebuffersEXT(1, &This->dst_fbo));
         }
 
-        HeapFree(GetProcessHeap(), 0, This->render_targets);
-        HeapFree(GetProcessHeap(), 0, This->fbo_color_attachments);
-        HeapFree(GetProcessHeap(), 0, This->draw_buffers);
-
         if (This->glsl_program_lookup) hash_table_destroy(This->glsl_program_lookup);
 
         /* TODO: Clean up all the surfaces and textures! */
@@ -1809,6 +1805,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
     if (WINED3D_OK != hr)
         return hr;
 
+    This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurface *) * GL_LIMITS(buffers));
+    This->fbo_color_attachments = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurface *) * GL_LIMITS(buffers));
+    This->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLenum) * GL_LIMITS(buffers));
+
     /* Initialize the texture unit mapping to a 1:1 mapping */
     for (state = 0; state < MAX_COMBINED_SAMPLERS; ++state) {
         if (state < GL_LIMITS(fragment_samplers)) {
@@ -2010,6 +2010,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
         }
     }
 
+    HeapFree(GetProcessHeap(), 0, This->render_targets);
+    HeapFree(GetProcessHeap(), 0, This->fbo_color_attachments);
+    HeapFree(GetProcessHeap(), 0, This->draw_buffers);
+    This->render_targets = NULL;
+    This->fbo_color_attachments = NULL;
+    This->draw_buffers = NULL;
+
+
     This->d3d_initialized = FALSE;
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index ebb07bf..dfe27a9 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2475,10 +2475,6 @@ static HRESULT  WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
      * TODO: move the functionality where it belongs */
     select_shader_max_constants(object->ps_selected_mode, object->vs_selected_mode, &GLINFO_LOCATION);
 
-    object->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurface *) * GL_LIMITS(buffers));
-    object->fbo_color_attachments = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurface *) * GL_LIMITS(buffers));
-    object->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLenum) * GL_LIMITS(buffers));
-
     /* set the state of the device to valid */
     object->state = WINED3D_OK;
 




More information about the wine-cvs mailing list