Module: wine Branch: master Commit: 50e9ad66e2d6b170d47b0e79cc4e04fb219a1455 URL: http://source.winehq.org/git/wine.git/?a=commit;h=50e9ad66e2d6b170d47b0e79cc...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Thu Jul 2 10:01:36 2009 +0200
wined3d: Clear the last device in WineD3D_CreateFakeGLContext().
---
dlls/wined3d/context.c | 11 ++++++++--- dlls/wined3d/directx.c | 1 + dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 6be40c7..8fa9786 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -36,6 +36,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); */ static IWineD3DDeviceImpl *last_device;
+void context_set_last_device(IWineD3DDeviceImpl *device) +{ + last_device = device; +} + /* FBO helper functions */
/* GL locking is done by the caller */ @@ -1078,7 +1083,7 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar ERR("Failed to make previous GL context %p current.\n", oldCtx); } } else { - last_device = This; + context_set_last_device(This); } This->frag_pipe->enable_extension((IWineD3DDevice *) This, TRUE);
@@ -1167,7 +1172,7 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
/* The correct GL context needs to be active to cleanup the GL resources below */ has_glctx = pwglMakeCurrent(context->hdc, context->glCtx); - last_device = NULL; + context_set_last_device(NULL);
if (!has_glctx) WARN("Failed to activate context. Window already destroyed?\n");
@@ -1750,7 +1755,7 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU sizeof(*This->activeContext->pshader_const_dirty) * GL_LIMITS(pshader_constantsF)); } This->activeContext = context; - last_device = This; + context_set_last_device(This); }
switch (usage) { diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 4d16957..9e50b0d 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -308,6 +308,7 @@ static BOOL WineD3D_CreateFakeGLContext(void) { goto fail; } } + context_set_last_device(NULL);
ret: TRACE("incrementing ref from %i\n", wined3d_fake_gl_context_ref); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 7af5719..c5ba435 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1256,6 +1256,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource void context_bind_fbo(IWineD3DDevice *iface, GLenum target, GLuint *fbo); void context_attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer); void context_attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface); +void context_set_last_device(IWineD3DDeviceImpl *device);
void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain); HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain);