Changeset 32545 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
- Timestamp:
- Sep 16, 2010 10:00:43 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r32461 r32545 6296 6296 } 6297 6297 6298 static void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChainImpl *swapchain) 6298 static void delete_opengl_contexts(IWineD3DDevice *iface 6299 #ifndef VBOXWDDM 6300 , IWineD3DSwapChainImpl *swapchain 6301 #endif 6302 ) 6299 6303 { 6300 6304 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; … … 6335 6339 context_destroy(This, This->contexts[0]); 6336 6340 } 6341 #ifndef VBOXWDDM 6337 6342 HeapFree(GetProcessHeap(), 0, swapchain->context); 6338 6343 swapchain->context = NULL; 6339 6344 swapchain->num_contexts = 0; 6345 #endif 6340 6346 } 6341 6347 … … 6347 6353 IWineD3DSurfaceImpl *target; 6348 6354 6355 #ifndef VBOXWDDM 6349 6356 /* Recreate the primary swapchain's context */ 6350 6357 swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); … … 6354 6361 return E_OUTOFMEMORY; 6355 6362 } 6363 #endif 6356 6364 6357 6365 target = (IWineD3DSurfaceImpl *)(swapchain->backBuffer ? swapchain->backBuffer[0] : swapchain->frontBuffer); … … 6359 6367 { 6360 6368 WARN("Failed to create context.\n"); 6369 #ifndef VBOXWDDM 6361 6370 HeapFree(GetProcessHeap(), 0, swapchain->context); 6371 #endif 6362 6372 return E_FAIL; 6363 6373 } 6364 6374 6375 #ifndef VBOXWDDM 6365 6376 swapchain->context[0] = context; 6366 6377 swapchain->num_contexts = 1; 6378 #endif 6367 6379 create_dummy_textures(This); 6368 6380 context_release(context); … … 6399 6411 context_release(context); 6400 6412 context_destroy(This, context); 6413 #ifndef VBOXWDDM 6401 6414 HeapFree(GetProcessHeap(), 0, swapchain->context); 6402 6415 swapchain->num_contexts = 0; 6416 #endif 6403 6417 return hr; 6404 6418 } … … 6411 6425 WINED3DDISPLAYMODE mode; 6412 6426 TRACE("(%p)\n", This); 6427 6428 #ifdef VBOXWDDM 6429 /* todo: implement multi-swapchain handlling!!! */ 6430 Assert(0); 6431 #endif 6413 6432 6414 6433 hr = IWineD3DDevice_GetSwapChain(iface, 0, (IWineD3DSwapChain **) &swapchain); … … 6499 6518 IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->stateBlock); 6500 6519 6501 delete_opengl_contexts(iface, swapchain); 6520 delete_opengl_contexts(iface 6521 #ifndef VBOXWDDM 6522 , swapchain 6523 #endif 6524 ); 6502 6525 6503 6526 if(pPresentationParameters->Windowed) { … … 6865 6888 return E_OUTOFMEMORY; 6866 6889 } 6867 IUnknown_AddRef(swapchain);6868 6890 This->swapchains = (IWineD3DSwapChain *)pvNewBuf; 6869 6891 This->swapchains[This->NumberOfSwapChains] = swapchain; 6870 6892 ++This->NumberOfSwapChains; 6893 return WINED3D_OK; 6894 } 6895 6896 static HRESULT WINAPI IWineD3DDeviceImpl_RemoveSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain) 6897 { 6898 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 6899 int i; 6900 for (i = 0; i < This->NumberOfSwapChains; ++i) 6901 { 6902 if (This->swapchains[i] == swapchain) 6903 { 6904 break; 6905 } 6906 } 6907 6908 if (i == This->NumberOfSwapChains) 6909 { 6910 WARN("swapchain 0x%p is not part of device 0x%p\n", swapchain, iface); 6911 return E_INVALIDARG; 6912 } 6913 6914 --This->NumberOfSwapChains; 6915 if (This->NumberOfSwapChains) 6916 { 6917 IWineD3DSwapChain **pvNewBuf = (IWineD3DSwapChain **)HeapAlloc(GetProcessHeap(), 0, (This->NumberOfSwapChains) * sizeof(IWineD3DSwapChain *)); 6918 if(!pvNewBuf) { 6919 ERR("Out of memory!\n"); 6920 return E_OUTOFMEMORY; 6921 } 6922 if (i) { 6923 memcpy (pvNewBuf, This->swapchains, i*sizeof(IWineD3DSwapChain *)); 6924 } 6925 if (i < This->NumberOfSwapChains) { 6926 memcpy (pvNewBuf + i, This->swapchains +i+1, (This->NumberOfSwapChains - i)*sizeof(IWineD3DSwapChain *)); 6927 } 6928 6929 This->swapchains = (IWineD3DSwapChain *)pvNewBuf; 6930 } 6931 else 6932 { 6933 while (This->numContexts) 6934 { 6935 context_destroy(This, This->contexts[0]); 6936 } 6937 } 6871 6938 return WINED3D_OK; 6872 6939 } … … 7029 7096 IWineD3DDeviceImpl_Flush, 7030 7097 IWineD3DDeviceImpl_AddSwapChain, 7098 IWineD3DDeviceImpl_RemoveSwapChain, 7031 7099 #endif 7032 7100 };
Note:
See TracChangeset
for help on using the changeset viewer.