Module: wine Branch: master Commit: e3507a725f9a039f460dea21071aab2649bd27ef URL: http://source.winehq.org/git/wine.git/?a=commit;h=e3507a725f9a039f460dea2107...
Author: Henri Verbeet hverbeet@gmail.com Date: Sun Aug 24 23:43:02 2008 +0200
wined3d: glDeleteFramebuffersEXT() needs a context.
---
dlls/wined3d/context.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 6a05434..a190b2b 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -644,15 +644,16 @@ static void RemoveContextFromArray(IWineD3DDeviceImpl *This, WineD3DContext *con *****************************************************************************/ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
- /* check that we are the current context first */ TRACE("Destroying ctx %p\n", context); - if(pwglGetCurrentContext() == context->glCtx){ - pwglMakeCurrent(NULL, NULL); - } else { + + /* The correct GL context needs to be active to cleanup the GL resources below */ + if(pwglGetCurrentContext() != context->glCtx){ + pwglMakeCurrent(context->hdc, context->glCtx); last_device = NULL; }
- /* FIXME: We probably need an active context to do this... */ + ENTER_GL(); + if (context->fbo) { GL_EXTCALL(glDeleteFramebuffersEXT(1, &context->fbo)); } @@ -663,9 +664,13 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) { GL_EXTCALL(glDeleteFramebuffersEXT(1, &context->dst_fbo)); }
+ LEAVE_GL(); + HeapFree(GetProcessHeap(), 0, context->fbo_color_attachments); context->fbo_color_attachments = NULL;
+ /* Cleanup the GL context */ + pwglMakeCurrent(NULL, NULL); if(context->isPBuffer) { GL_EXTCALL(wglReleasePbufferDCARB(context->pbuffer, context->hdc)); GL_EXTCALL(wglDestroyPbufferARB(context->pbuffer));