Module: wine Branch: master Commit: 401e99b0c074af848379b2602df37fb1e6c7536b URL: http://source.winehq.org/git/wine.git/?a=commit;h=401e99b0c074af848379b2602d...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Thu Jul 23 10:54:33 2009 +0200
wined3d: Remove some unnecessary code.
Now that we don't depend on activeContext and lastActiveRenderTarget to be non-NULL this code can go.
---
dlls/wined3d/context.c | 52 ++------------------------------------------- dlls/wined3d/swapchain.c | 16 -------------- 2 files changed, 3 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 02159fb..2e50634 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -467,59 +467,13 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; UINT i;
+ if (!This->d3d_initialized) return; + switch(type) { case WINED3DRTYPE_SURFACE: { - if (This->activeContext && (IWineD3DSurface *)resource == This->activeContext->current_rt) - { - IWineD3DSwapChainImpl *swapchain; - - TRACE("Last active render target destroyed.\n"); - - /* Find a replacement surface for the currently active back - * buffer. The context manager does not do NULL checks, so - * switch to a valid target as long as the currently set - * surface is still valid. Use the surface of the implicit - * swpchain. If that is the same as the destroyed surface the - * device is destroyed and the lastActiveRenderTarget member - * shouldn't matter. */ - swapchain = This->swapchains ? (IWineD3DSwapChainImpl *)This->swapchains[0] : NULL; - if (swapchain) - { - if (swapchain->backBuffer && swapchain->backBuffer[0] != (IWineD3DSurface *)resource) - { - TRACE("Activating primary back buffer.\n"); - ActivateContext(This, swapchain->backBuffer[0], CTXUSAGE_RESOURCELOAD); - } - else if (!swapchain->backBuffer && swapchain->frontBuffer != (IWineD3DSurface *)resource) - { - /* Single buffering environment */ - TRACE("Activating primary front buffer.\n"); - - ActivateContext(This, swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD); - } - else - { - /* Implicit render target destroyed, that means the - * device is being destroyed whatever we set here, it - * shouldn't matter. */ - TRACE("Device is being destroyed, setting current_rt to 0xdeadbabe.\n"); - This->activeContext->current_rt = (IWineD3DSurface *)0xdeadbabe; - } - } - else - { - WARN("Render target set, but swapchain does not exist!\n"); - - /* May happen during ddraw uninitialization. */ - This->activeContext->current_rt = (IWineD3DSurface *)0xdeadcafe; - } - } - else if (This->d3d_initialized) - { - ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD); - } + ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
for (i = 0; i < This->numContexts; ++i) { diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 27770ca..683640a 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -66,22 +66,6 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface, D3DCB
for (i = 0; i < This->num_contexts; ++i) { - if (This->context[i] == This->wineD3DDevice->activeContext) - { - IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)This->wineD3DDevice->swapchains[0]; - - /* Avoid destroying the currently active context for non-implicit swapchains. */ - if (This != swapchain) - { - TRACE("Would destroy currently active context %p on a non-implicit swapchain.\n", This->context[i]); - - if (swapchain->backBuffer) - ActivateContext(This->wineD3DDevice, swapchain->backBuffer[0], CTXUSAGE_RESOURCELOAD); - else - ActivateContext(This->wineD3DDevice, swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD); - } - } - DestroyContext(This->wineD3DDevice, This->context[i]); } /* Restore the screen resolution if we rendered in fullscreen