wined3d: Get rid of lastActiveRenderTarget.

This commit is contained in:
Henri Verbeet 2009-07-21 11:51:11 +02:00 committed by Alexandre Julliard
parent 223b9d5c01
commit 2d7500600b
3 changed files with 6 additions and 14 deletions

View File

@ -503,10 +503,8 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
/* Implicit render target destroyed, that means the /* Implicit render target destroyed, that means the
* device is being destroyed whatever we set here, it * device is being destroyed whatever we set here, it
* shouldn't matter. */ * shouldn't matter. */
TRACE("Device is being destroyed, setting lastActiveRenderTarget to 0xdeadbabe.\n"); TRACE("Device is being destroyed, setting current_rt to 0xdeadbabe.\n");
This->activeContext->current_rt = (IWineD3DSurface *)0xdeadbabe;
This->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadbabe;
This->activeContext->current_rt = This->lastActiveRenderTarget;
} }
} }
else else
@ -514,8 +512,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
WARN("Render target set, but swapchain does not exist!\n"); WARN("Render target set, but swapchain does not exist!\n");
/* May happen during ddraw uninitialization. */ /* May happen during ddraw uninitialization. */
This->lastActiveRenderTarget = (IWineD3DSurface *)0xdeadcafe; This->activeContext->current_rt = (IWineD3DSurface *)0xdeadcafe;
This->activeContext->current_rt = This->lastActiveRenderTarget;
} }
} }
else if (This->d3d_initialized) else if (This->d3d_initialized)
@ -1764,13 +1761,13 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
TRACE("(%p): Selecting context for render target %p, thread %d\n", This, target, tid); TRACE("(%p): Selecting context for render target %p, thread %d\n", This, target, tid);
if (!target) target = This->lastActiveRenderTarget; if (!target) target = This->activeContext->current_rt;
if(This->lastActiveRenderTarget != target || tid != This->lastThread) { if (This->activeContext->current_rt != target || tid != This->lastThread)
{
context = FindContext(This, target, tid); context = FindContext(This, target, tid);
context->draw_buffer_dirty = TRUE; context->draw_buffer_dirty = TRUE;
context->current_rt = target; context->current_rt = target;
This->lastActiveRenderTarget = target;
This->lastThread = tid; This->lastThread = tid;
} else { } else {
/* Stick to the old context */ /* Stick to the old context */

View File

@ -2158,12 +2158,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
if(swapchain->backBuffer && swapchain->backBuffer[0]) { if(swapchain->backBuffer && swapchain->backBuffer[0]) {
TRACE("Setting rendertarget to %p\n", swapchain->backBuffer); TRACE("Setting rendertarget to %p\n", swapchain->backBuffer);
This->render_targets[0] = swapchain->backBuffer[0]; This->render_targets[0] = swapchain->backBuffer[0];
This->lastActiveRenderTarget = swapchain->backBuffer[0];
} }
else { else {
TRACE("Setting rendertarget to %p\n", swapchain->frontBuffer); TRACE("Setting rendertarget to %p\n", swapchain->frontBuffer);
This->render_targets[0] = swapchain->frontBuffer; This->render_targets[0] = swapchain->frontBuffer;
This->lastActiveRenderTarget = swapchain->frontBuffer;
} }
IWineD3DSurface_AddRef(This->render_targets[0]); IWineD3DSurface_AddRef(This->render_targets[0]);
This->activeContext = swapchain->context[0]; This->activeContext = swapchain->context[0];

View File

@ -1535,9 +1535,6 @@ struct IWineD3DDeviceImpl
IWineD3DSurface *auto_depth_stencil_buffer; IWineD3DSurface *auto_depth_stencil_buffer;
IWineD3DSurface *stencilBufferTarget; IWineD3DSurface *stencilBufferTarget;
/* Caches to avoid unneeded context changes */
IWineD3DSurface *lastActiveRenderTarget;
/* palettes texture management */ /* palettes texture management */
UINT NumberOfPalettes; UINT NumberOfPalettes;
PALETTEENTRY **palettes; PALETTEENTRY **palettes;