Commit 50e9ad66 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Clear the last device in WineD3D_CreateFakeGLContext().

parent 670d9ad9
......@@ -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) {
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment