From b9379fc3892b85ab2e39e64a5cf9ee6f8c679453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 16 Jul 2007 19:49:34 +0200 Subject: [PATCH] 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 43c65b696b4..07d5a796aa4 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 ebb07bf0618..dfe27a91dca 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;