Module: wine
Branch: master
Commit: 3f0ea3d082342d62ede57383bf896751d4353c20
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3f0ea3d082342d62ede57383b…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Mon Sep 17 14:55:08 2007 +0200
wined3d: Move lastActiveRenderTarget cleanup to the device.
---
dlls/wined3d/device.c | 31 +++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 31 -------------------------------
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 729acf7..30b80cd 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -6869,6 +6869,37 @@ static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IW
/* Cleanup any FBO attachments if d3d is enabled */
if(This->d3d_initialized) {
+ if((IWineD3DSurface *)resource == This->lastActiveRenderTarget) {
+ IWineD3DSwapChainImpl *swapchain = This->swapchains ? (IWineD3DSwapChainImpl *) This->swapchains[0] : NULL;
+
+ 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
+ */
+ 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 {
+ TRACE("Device is being destroyed, setting lastActiveRenderTarget = 0xdeadbabe\n");
+ /* Implicit render target destroyed, that means the device is being destroyed
+ * whatever we set here, it shouldn't matter
+ */
+ This->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadbabe;
+ }
+ } else {
+ /* May happen during ddraw uninitialization */
+ TRACE("Render target set, but swapchain does not exist!\n");
+ This->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadcafe;
+ }
+ }
+
for (i = 0; i < GL_LIMITS(buffers); ++i) {
if (This->fbo_color_attachments[i] == (IWineD3DSurface *)resource) {
bind_fbo(iface, GL_FRAMEBUFFER_EXT, &This->fbo);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 6675f4e..e42c80b 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -343,37 +343,6 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
renderbuffer_entry_t *entry, *entry2;
TRACE("(%p) : cleaning up\n", This);
- if(iface == device->lastActiveRenderTarget) {
- IWineD3DSwapChainImpl *swapchain = device->swapchains ? (IWineD3DSwapChainImpl *) device->swapchains[0] : NULL;
-
- 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
- */
- if(swapchain) {
- if(swapchain->backBuffer && swapchain->backBuffer[0] != iface) {
- TRACE("Activating primary back buffer\n");
- ActivateContext(device, swapchain->backBuffer[0], CTXUSAGE_RESOURCELOAD);
- } else if(!swapchain->backBuffer && swapchain->frontBuffer != iface) {
- /* Single buffering environment */
- TRACE("Activating primary front buffer\n");
- ActivateContext(device, swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD);
- } else {
- TRACE("Device is being destroyed, setting lastActiveRenderTarget = 0xdeadbabe\n");
- /* Implicit render target destroyed, that means the device is being destroyed
- * whatever we set here, it shouldn't matter
- */
- device->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadbabe;
- }
- } else {
- /* May happen during ddraw uninitialization */
- TRACE("Render target set, but swapchain does not exist!\n");
- device->lastActiveRenderTarget = (IWineD3DSurface *) 0xdeadcafe;
- }
- }
-
if (This->glDescription.textureName != 0) { /* release the openGL texture.. */
/* Need a context to destroy the texture. Use the currently active render target, but only if
Module: wine
Branch: master
Commit: e324da14940fdb6e894b739c2f43a481fd7852fc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e324da14940fdb6e894b739c2…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Mon Sep 17 12:56:33 2007 +0200
wined3d: Remove a pbo check.
---
dlls/wined3d/surface.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 05303d3..4e42990 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1427,10 +1427,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
TRACE("DIBSection at : %p\n", This->dib.bitmap_data);
/* copy the existing surface to the dib section */
if(This->resource.allocatedMemory) {
- /* In case of a PBO, allocatedMemory=NULL, it isn't NULL between a LockRect and a UnlockRect */
- if(!(This->Flags & SFLAG_PBO))
- memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, b_info->bmiHeader.biSizeImage);
- /* We won't need that any more */
+ memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, b_info->bmiHeader.biSizeImage);
} else {
/* This is to make LockRect read the gl Texture although memory is allocated */
This->Flags &= ~SFLAG_INSYSMEM;