Commit 817b520c authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Prevent unneeded context switches.

parent 9b0d661e
...@@ -860,10 +860,17 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU ...@@ -860,10 +860,17 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
/* Activate the opengl context */ /* Activate the opengl context */
if(context != This->activeContext) { if(context != This->activeContext) {
BOOL ret; BOOL ret;
TRACE("Switching gl ctx to %p, hdc=%p ctx=%p\n", context, context->hdc, context->glCtx);
ret = pwglMakeCurrent(context->hdc, context->glCtx); /* Prevent an unneeded context switch as those are expensive */
if(ret == FALSE) { if(context->glCtx && (context->glCtx == pwglGetCurrentContext())) {
ERR("Failed to activate the new context\n"); TRACE("Already using gl context %p\n", context->glCtx);
}
else {
TRACE("Switching gl ctx to %p, hdc=%p ctx=%p\n", context, context->hdc, context->glCtx);
ret = pwglMakeCurrent(context->hdc, context->glCtx);
if(ret == FALSE) {
ERR("Failed to activate the new context\n");
}
} }
This->activeContext = context; This->activeContext = context;
} }
......
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