mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-03 20:08:57 +00:00
wined3d: Prevent unneeded context switches.
This commit is contained in:
parent
9b0d661e43
commit
817b520c3d
|
@ -860,10 +860,17 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
|
|||
/* Activate the opengl context */
|
||||
if(context != This->activeContext) {
|
||||
BOOL ret;
|
||||
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");
|
||||
|
||||
/* Prevent an unneeded context switch as those are expensive */
|
||||
if(context->glCtx && (context->glCtx == pwglGetCurrentContext())) {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue