Module: wine Branch: master Commit: 4c99bd5f87adc1c035c8efff1d8e0169505ccbcb URL: http://source.winehq.org/git/wine.git/?a=commit;h=4c99bd5f87adc1c035c8efff1d...
Author: Stefan Dösinger stefan@codeweavers.com Date: Fri Jan 25 18:13:27 2008 +0100
wined3d: Destroy FBOs and reset pointers on Reset.
---
dlls/wined3d/device.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 640a5e2..a2509a7 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -6799,6 +6799,35 @@ static HRESULT WINAPI reset_unload_resources(IWineD3DResource *resource, void *d return S_OK; }
+static void reset_fbo_state(IWineD3DDevice *iface) { + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; + unsigned int i; + + ENTER_GL(); + GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)); + checkGLcall("glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)"); + + if (This->fbo) { + GL_EXTCALL(glDeleteFramebuffersEXT(1, &This->fbo)); + This->fbo = 0; + } + if (This->src_fbo) { + GL_EXTCALL(glDeleteFramebuffersEXT(1, &This->src_fbo)); + This->src_fbo = 0; + } + if (This->dst_fbo) { + GL_EXTCALL(glDeleteFramebuffersEXT(1, &This->dst_fbo)); + This->dst_fbo = 0; + } + checkGLcall("Tear down fbos\n"); + LEAVE_GL(); + + for (i = 0; i < GL_LIMITS(buffers); ++i) { + This->fbo_color_attachments[i] = NULL; + } + This->fbo_depth_attachment = NULL; +} + static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DSwapChainImpl *swapchain; @@ -6859,6 +6888,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE ERR("What do do about a changed auto depth stencil parameter?\n"); }
+ if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { + reset_fbo_state((IWineD3DDevice *) This); + } + IWineD3DDevice_EnumResources(iface, reset_unload_resources, NULL); LIST_FOR_EACH_ENTRY(shader, &This->shaders, IWineD3DBaseShaderImpl, baseShader.shader_list_entry) { This->shader_backend->shader_destroy((IWineD3DBaseShader *) shader);