wined3d: Remove some unnecessary code.

Now that we don't depend on activeContext and lastActiveRenderTarget to be
non-NULL this code can go.
This commit is contained in:
Henri Verbeet 2009-07-23 10:54:33 +02:00 committed by Alexandre Julliard
parent 57ccdb7e36
commit 401e99b0c0
2 changed files with 3 additions and 65 deletions

View File

@ -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)
{

View File

@ -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