Changeset 32545 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Sep 16, 2010 10:00:43 AM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r32501 r32545 1917 1917 IDirect3DDevice9 *pDevice9If = NULL; 1918 1918 HWND hOldWnd = pSwapchain->hWnd; 1919 //#define VBOXDISP_NEWWND_ON_SWAPCHAINUPDATE 1919 1920 #ifndef VBOXDISP_NEWWND_ON_SWAPCHAINUPDATE 1920 1921 if (!hOldWnd) … … 4759 4760 Assert(hr == S_OK); 4760 4761 if (hr == S_OK) 4762 { 4763 if(pResource->Flags.Primary) 4764 { 4765 for (UINT i = 0; i < pResource->SurfCount; ++i) 4766 { 4767 vboxWddmSwapchainFindCreate(pDevice, &pRc->aAllocations[i]); 4768 } 4769 Assert(bIssueCreateResource); 4770 } 4761 4771 continue; 4772 } 4762 4773 4763 4774 /* fail branch */ … … 5632 5643 { 5633 5644 #ifndef VBOXWDDM_WITH_VISIBLE_FB 5634 if (pSrcSwapchain && vboxWddmSwapchainGetFb(pSrcSwapchain)->pAlloc != pSrcAlloc 5645 if (pSrcSwapchain 5646 && pSrcSwapchain->pRenderTargetFbCopy 5647 && vboxWddmSwapchainGetFb(pSrcSwapchain)->pAlloc != pSrcAlloc 5635 5648 && vboxWddmSwapchainNumRTs(pSrcSwapchain) > 1) /* work-around wine backbuffer */ 5636 5649 { … … 5671 5684 pSrcSurfIf = pSrcSwapchain->pRenderTargetFbCopy; 5672 5685 Assert(pSrcSurfIf); 5673 hr = p Device9If->GetFrontBufferData(0,pSrcSurfIf);5686 hr = pSrcSwapchain->pSwapChainIf->GetFrontBufferData(pSrcSurfIf); 5674 5687 Assert(hr == S_OK); 5675 5688 if (hr == S_OK) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/wined3d.h
r32461 r32545 7308 7308 virtual HRESULT STDMETHODCALLTYPE AddSwapChain( 7309 7309 IWineD3DSwapChain *swapchain) = 0; 7310 7311 virtual HRESULT STDMETHODCALLTYPE RemoveSwapChain( 7312 IWineD3DSwapChain *swapchain) = 0; 7310 7313 #endif 7311 7314 }; … … 8074 8077 8075 8078 HRESULT (STDMETHODCALLTYPE *AddSwapChain)( 8079 IWineD3DDevice* This, 8080 IWineD3DSwapChain *swapchain); 8081 8082 HRESULT (STDMETHODCALLTYPE *RemoveSwapChain)( 8076 8083 IWineD3DDevice* This, 8077 8084 IWineD3DSwapChain *swapchain); … … 8236 8243 #define IWineD3DDevice_Flush(This) (This)->lpVtbl->Flush(This) 8237 8244 #define IWineD3DDevice_AddSwapChain(This,swapchain) (This)->lpVtbl->AddSwapChain(This,swapchain) 8245 #define IWineD3DDevice_RemoveSwapChain(This,swapchain) (This)->lpVtbl->RemoveSwapChain(This,swapchain) 8238 8246 #endif 8239 8247 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/arb_program_shader.c
r32461 r32545 6969 6969 if (wined3d_settings.strict_draw_ordering || (dst_swapchain 6970 6970 && ((IWineD3DSurface *)dst_surface == dst_swapchain->frontBuffer 6971 || dst_swapchain->num_contexts > 1))) 6971 #ifdef VBOXWDDM 6972 || dst_swapchain->device->numContexts > 1 6973 #else 6974 || dst_swapchain->num_contexts > 1 6975 #endif 6976 ))) 6972 6977 wglFlush(); /* Flush to ensure ordering across contexts. */ 6973 6978 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r32508 r32545 757 757 { 758 758 #ifdef VBOXWDDM 759 # ifdef DEBUG_misha 760 Assert(0); 761 # endif 759 762 TRACE("Updating context %p window from %p to %p.\n", 760 763 context, context->win_handle, swapchain->win_handle); … … 776 779 #ifdef VBOXWDDM 777 780 context->win_handle = swapchain->win_handle; 778 context->hdc = GetDC(context->win_handle);779 781 context->currentSwapchain = swapchain; 780 782 #else 781 783 context->win_handle = context->swapchain->win_handle; 782 784 #endif 783 785 if (!(context->hdc = GetDC(context->win_handle))) 784 786 { … … 786 788 goto err; 787 789 } 788 #endif789 790 790 791 if (!context_set_pixel_format(context->gl_info, context->hdc, context->pixel_format)) … … 1595 1596 const struct wined3d_format_desc *ds_format_desc) 1596 1597 { 1597 int i, j; 1598 int swapchains = IWineD3DDevice_GetNumberOfSwapChains(device); 1598 int i; 1599 1599 DWORD tid = GetCurrentThreadId(); 1600 1600 struct wined3d_context *context = NULL; 1601 1601 1602 // Assert(0); 1603 1604 for(i = 0 ; i < swapchains ; i ++) 1605 { 1606 IWineD3DSwapChainImpl *curSwapChain; 1607 IWineD3DDevice_GetSwapChain(device, i, &curSwapChain); 1608 if (curSwapChain->ds_format == ds_format_desc) 1609 { 1610 for(j = 0; j < curSwapChain->num_contexts; j++) { 1611 if(curSwapChain->context[j]->tid == tid) { 1612 context = curSwapChain->context[j]; 1613 break; 1614 } 1615 } 1616 } 1617 else 1618 { 1619 Assert(0); 1620 } 1621 1622 IWineD3DSwapChain_Release(curSwapChain); 1623 1624 if (context) 1602 Assert(0); 1603 1604 for(i = 0 ; i < device->numContexts ; i ++) 1605 { 1606 if(device->contexts[i]->tid == tid) { 1607 context = device->contexts[i]; 1625 1608 break; 1609 } 1626 1610 } 1627 1611 1628 1612 if (!context) 1629 1613 { 1630 Assert(! swapchains);1614 Assert(!device->NumberOfSwapChains); 1631 1615 context = context_create(swapchain, target, ds_format_desc); 1632 1616 } … … 1915 1899 { 1916 1900 unsigned int i; 1917 1901 #ifdef VBOXWDDM 1902 IWineD3DDeviceImpl *device = ((IWineD3DSwapChainImpl*)swapchain)->device; 1903 for (i = 0; i < device->numContexts; ++i) 1904 { 1905 if (device->contexts[i]->tid == tid) 1906 return device->contexts[i]; 1907 } 1908 #else 1918 1909 for(i = 0; i < ((IWineD3DSwapChainImpl *) swapchain)->num_contexts; i++) { 1919 1910 if(((IWineD3DSwapChainImpl *) swapchain)->context[i]->tid == tid) { … … 1921 1912 } 1922 1913 } 1923 1924 #ifdef VBOXWDDM1925 Assert(0);1926 1914 #endif 1927 1915 -
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 }; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r32508 r32545 488 488 Assert(shared_handle); 489 489 VBOXSHRC_SET_INITIALIZED(surface); 490 IWineD3DSurface_LoadLocation( surface, SFLAG_INTEXTURE, NULL);490 IWineD3DSurface_LoadLocation((IWineD3DSurface*)surface, SFLAG_INTEXTURE, NULL); 491 491 if (!VBOXSHRC_IS_SHARED_OPENED(surface)) 492 492 { … … 3792 3792 if (wined3d_settings.strict_draw_ordering || (dstSwapchain 3793 3793 && ((IWineD3DSurface *)This == dstSwapchain->frontBuffer 3794 || dstSwapchain->num_contexts > 1))) 3794 #ifdef VBOXWDDM 3795 || dstSwapchain->device->numContexts > 1 3796 #else 3797 || dstSwapchain->num_contexts > 1 3798 #endif 3799 ))) 3795 3800 wglFlush(); /* Flush to ensure ordering across contexts. */ 3796 3801 … … 4402 4407 if (wined3d_settings.strict_draw_ordering || (swapchain 4403 4408 && ((IWineD3DSurface *)This == swapchain->frontBuffer 4404 || swapchain->num_contexts > 1))) 4409 #ifdef VBOXWDDM 4410 || swapchain->device->numContexts > 1 4411 #else 4412 || swapchain->num_contexts > 1 4413 #endif 4414 ))) 4405 4415 wglFlush(); /* Flush to ensure ordering across contexts. */ 4406 4416 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface_gdi.c
r28475 r32545 440 440 IWineD3DSurfaceImpl *dds_primary; 441 441 IWineD3DSwapChainImpl *swapchain; 442 swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[ 0];442 swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[This->resource.device->NumberOfSwapChains-1]; 443 443 dds_primary = (IWineD3DSurfaceImpl *)swapchain->frontBuffer; 444 444 if (dds_primary && dds_primary->palette) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r32461 r32545 83 83 This->backBuffer = NULL; 84 84 } 85 85 #ifndef VBOXWDDM 86 86 for (i = 0; i < This->num_contexts; ++i) 87 87 { 88 88 context_destroy(This->device, This->context[i]); 89 89 } 90 /* Restore the screen resolution if we rendered in fullscreen 91 * This will restore the screen resolution to what it was before creating the swapchain. In case of d3d8 and d3d9 92 * this will be the original desktop resolution. In case of d3d7 this will be a NOP because ddraw sets the resolution 93 * before starting up Direct3D, thus orig_width and orig_height will be equal to the modes in the presentation params 94 */ 95 if(This->presentParms.Windowed == FALSE && This->presentParms.AutoRestoreDisplayMode) { 96 mode.Width = This->orig_width; 97 mode.Height = This->orig_height; 98 mode.RefreshRate = 0; 99 mode.Format = This->orig_fmt; 100 IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)This->device, 0, &mode); 101 } 102 90 #else 91 IWineD3DDevice_RemoveSwapChain(This->device, This); 92 if (!This->device->NumberOfSwapChains) 93 #endif 94 { 95 /* Restore the screen resolution if we rendered in fullscreen 96 * This will restore the screen resolution to what it was before creating the swapchain. In case of d3d8 and d3d9 97 * this will be the original desktop resolution. In case of d3d7 this will be a NOP because ddraw sets the resolution 98 * before starting up Direct3D, thus orig_width and orig_height will be equal to the modes in the presentation params 99 */ 100 if(This->presentParms.Windowed == FALSE && This->presentParms.AutoRestoreDisplayMode) { 101 mode.Width = This->orig_width; 102 mode.Height = This->orig_height; 103 mode.RefreshRate = 0; 104 mode.Format = This->orig_fmt; 105 IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)This->device, 0, &mode); 106 } 107 } 108 #ifdef VBOXWDDM 109 if(This->device_window) { 110 ReleaseDC(This->device_window, This->hDC); 111 } 112 #else 103 113 HeapFree(GetProcessHeap(), 0, This->context); 114 #endif 104 115 HeapFree(GetProcessHeap(), 0, This); 105 116 } … … 353 364 } 354 365 366 #ifdef VBOXWDDM 367 if (This->device->numContexts > 1) wglFinish(); 368 #else 355 369 if (This->num_contexts > 1) wglFinish(); 370 #endif 356 371 SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ 357 372 … … 720 735 swapchain->win_handle = window; 721 736 swapchain->device_window = window; 737 #ifdef VBOXWDDM 738 Assert(window); 739 swapchain->hDC = GetDC(window); 740 if (!swapchain->hDC) 741 { 742 DWORD winEr = GetLastError(); 743 WARN("Failed to get a window DC, winEr %d.\n", winEr); 744 Assert(0); 745 goto err; 746 } 747 #endif 722 748 723 749 if (!present_parameters->Windowed && window) … … 812 838 } 813 839 840 #ifndef VBOXWDDM 814 841 swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context)); 815 842 if (!swapchain->context) … … 820 847 } 821 848 swapchain->num_contexts = 1; 849 #endif 822 850 823 851 if (surface_type == SURFACE_OPENGL) 824 852 { 853 struct wined3d_context * swapchainContext; 825 854 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 826 855 … … 844 873 845 874 #ifdef VBOXWDDM 846 swapchain ->context[0]= context_find_create(device, swapchain, (IWineD3DSurfaceImpl *)swapchain->frontBuffer,875 swapchainContext = context_find_create(device, swapchain, (IWineD3DSurfaceImpl *)swapchain->frontBuffer, 847 876 swapchain->ds_format); 877 if (!swapchainContext) 848 878 #else 849 879 swapchain->context[0] = context_create(swapchain, (IWineD3DSurfaceImpl *)swapchain->frontBuffer, 850 880 swapchain->ds_format); 851 #endif852 881 if (!swapchain->context[0]) 882 #endif 853 883 { 854 884 WARN("Failed to create context.\n"); … … 856 886 goto err; 857 887 } 888 #ifdef VBOXWDDM 889 context_release(swapchainContext); 890 #else 858 891 context_release(swapchain->context[0]); 892 #endif 859 893 } 860 894 else 861 895 { 896 #ifndef VBOXWDDM 862 897 swapchain->context[0] = NULL; 898 #endif 863 899 } 864 900 … … 943 979 } 944 980 981 #ifdef VBOXWDDM 982 if (!device->NumberOfSwapChains) 983 { 984 while (device->numContexts) 985 { 986 context_destroy(device, device->contexts[0]); 987 } 988 } 989 #else 945 990 if (swapchain->context) 946 991 { … … 953 998 HeapFree(GetProcessHeap(), 0, swapchain->context); 954 999 } 1000 #endif 955 1001 956 1002 if (swapchain->frontBuffer) IWineD3DSurface_Release(swapchain->frontBuffer); … … 973 1019 } 974 1020 context_release(ctx); 975 1021 #ifdef VBOXWDDM 1022 /* no need to do anything since context gets added to the device context list within the context_create call */ 1023 #else 976 1024 newArray = HeapAlloc(GetProcessHeap(), 0, sizeof(*newArray) * This->num_contexts + 1); 977 1025 if(!newArray) { … … 985 1033 This->context = newArray; 986 1034 This->num_contexts++; 987 1035 #endif 988 1036 TRACE("Returning context %p\n", ctx); 989 1037 return ctx; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain_gdi.c
r31868 r32545 80 80 } 81 81 82 #ifndef VBOXWDDM 82 83 HeapFree(GetProcessHeap(), 0, This->context); 84 #endif 83 85 HeapFree(GetProcessHeap(), 0, This); 84 86 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r32461 r32545 2643 2643 unsigned int vSyncCounter; 2644 2644 2645 #ifndef VBOXWDDM 2645 2646 struct wined3d_context **context; 2646 2647 unsigned int num_contexts; 2648 #endif 2647 2649 2648 2650 HWND win_handle; 2649 2651 HWND device_window; 2652 #ifdef VBOXWDDM 2653 HDC hDC; 2654 #endif 2650 2655 }; 2651 2656
Note:
See TracChangeset
for help on using the changeset viewer.