Changeset 42971 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine
- Timestamp:
- Aug 24, 2012 11:19:31 AM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r42516 r42971 1958 1958 } 1959 1959 1960 if (This->swapchains) 1961 { 1960 1962 HeapFree(GetProcessHeap(), 0, This->swapchains); 1961 1963 This->swapchains = NULL; 1962 1964 This->NumberOfSwapChains = 0; 1965 } 1966 else 1967 { 1968 Assert(!This->NumberOfSwapChains); 1969 } 1963 1970 1964 1971 for (i = 0; i < This->NumberOfPalettes; i++) HeapFree(GetProcessHeap(), 0, This->palettes[i]); … … 7005 7012 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 7006 7013 int i; 7014 IWineD3DSwapChain **pvOldBuf = This->swapchains; 7015 7007 7016 for (i = 0; i < This->NumberOfSwapChains; ++i) 7008 7017 { … … 7042 7051 context_destroy(This, This->contexts[0]); 7043 7052 } 7044 } 7053 This->swapchains = NULL; 7054 } 7055 7056 if (pvOldBuf) 7057 HeapFree(GetProcessHeap(), 0, pvOldBuf); 7058 7045 7059 return WINED3D_OK; 7046 7060 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r42499 r42971 62 62 } 63 63 64 VOID swapchain_invalidate(IWineD3DSwapChainImpl *pSwapchain) 64 static VOID swapchain_cleanup_rt_refs(IWineD3DSwapChainImpl *pSwapchain, IWineD3DSurface *rt, int iBb) 65 { 66 IWineD3DDeviceImpl *device = pSwapchain->device; 67 struct wined3d_context *context; 68 UINT i; 69 for (i = 0; i < device->numContexts; ++i) 70 { 71 context = device->contexts[i]; 72 73 if (rt == context->current_rt) 74 { 75 context->current_rt = NULL; 76 } 77 } 78 79 if (device->NumberOfSwapChains) 80 { 81 IWineD3DSwapChainImpl *pDefaultSwapchain = (IWineD3DSwapChainImpl*)device->swapchains[0]; 82 for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) 83 { 84 if (device->render_targets[i] == rt) 85 { 86 IWineD3DSurface *newRt; 87 if (i) 88 newRt = NULL; 89 else if (iBb == -1) /* front buffer */ 90 newRt = pDefaultSwapchain->frontBuffer; 91 else 92 newRt = pDefaultSwapchain->backBuffer ? pDefaultSwapchain->backBuffer[0] : pDefaultSwapchain->frontBuffer; 93 94 IWineD3DDevice_SetRenderTarget((IWineD3DDevice*)device, i, newRt, TRUE); 95 } 96 } 97 } 98 } 99 100 static VOID swapchain_cleanup_refs(IWineD3DSwapChainImpl *pSwapchain) 65 101 { 66 102 /* first make sure the swapchain is not used by anyone */ … … 76 112 context->currentSwapchain = NULL; 77 113 } 78 79 if (pSwapchain->frontBuffer == context->current_rt) 80 {81 context->current_rt = NULL;82 } 83 elseif (pSwapchain->backBuffer)84 85 86 87 88 if (pSwapchain->backBuffer[j] == context->current_rt)89 {90 context->current_rt = NULL;91 break; 92 } 93 } 94 } 95 }114 } 115 116 if (pSwapchain->frontBuffer) 117 swapchain_cleanup_rt_refs(pSwapchain, pSwapchain->frontBuffer, -1); 118 119 if (pSwapchain->backBuffer) 120 { 121 UINT j; 122 for (j = 0; j < pSwapchain->presentParms.BackBufferCount; ++j) 123 { 124 swapchain_cleanup_rt_refs(pSwapchain, pSwapchain->backBuffer[j], j); 125 } 126 } 127 } 128 129 static VOID swapchain_invalidate(IWineD3DSwapChainImpl *pSwapchain) 130 { 131 swapchain_cleanup_refs(pSwapchain); 96 132 97 133 pSwapchain->win_handle = NULL; … … 105 141 { 106 142 IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; 107 WINED3DDISPLAYMODE mode;108 143 unsigned int i; 109 144 … … 111 146 112 147 IWineD3DSwapChain_SetGammaRamp(iface, 0, &This->orig_gamma); 148 149 #ifdef VBOX_WITH_WDDM 150 /* first remove swapchain from a list to ensure context is properly acquired 151 * & gl resources are properly cleared on last swapchain destruction */ 152 IWineD3DDevice_RemoveSwapChain((IWineD3DDevice*)This->device, (IWineD3DSwapChain*)This); 153 154 swapchain_cleanup_refs(This); 155 #endif 113 156 114 157 /* Release the swapchain's draw buffers. Make sure This->backBuffer[0] is … … 154 197 This->presentRt = NULL; 155 198 } 156 #endif 157 199 200 if(This->win_handle) { 201 VBoxExtWndDestroy(This->win_handle, This->hDC); 202 swapchain_invalidate(This); 203 } 204 else 205 { 206 WARN("null win info"); 207 } 208 #else 158 209 IWineD3DDevice_RemoveSwapChain((IWineD3DDevice*)This->device, (IWineD3DSwapChain*)This); 159 210 if (!This->device->NumberOfSwapChains) … … 165 216 */ 166 217 if(This->presentParms.Windowed == FALSE && This->presentParms.AutoRestoreDisplayMode) { 218 WINED3DDISPLAYMODE mode; 167 219 mode.Width = This->orig_width; 168 220 mode.Height = This->orig_height; … … 172 224 } 173 225 } 174 #ifdef VBOX_WITH_WDDM 175 if(This->win_handle) { 176 VBoxExtWndDestroy(This->win_handle, This->hDC); 177 swapchain_invalidate(This); 178 } 179 else 180 { 181 WARN("null win info"); 182 } 183 #else 226 184 227 HeapFree(GetProcessHeap(), 0, This->context); 185 228 #endif 229 186 230 HeapFree(GetProcessHeap(), 0, This); 187 231 }
Note:
See TracChangeset
for help on using the changeset viewer.