Changeset 32461 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
- Timestamp:
- Sep 13, 2010 5:59:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r31828 r32461 331 331 { 332 332 const struct wined3d_gl_info *gl_info = context->gl_info; 333 #ifdef VBOXWDDM 334 IWineD3DDeviceImpl *device = context->device; 335 #else 333 336 IWineD3DDeviceImpl *device = context->swapchain->device; 337 #endif 334 338 struct fbo_entry *entry; 335 339 … … 348 352 { 349 353 const struct wined3d_gl_info *gl_info = context->gl_info; 354 #ifdef VBOXWDDM 355 IWineD3DDeviceImpl *device = context->device; 356 #else 350 357 IWineD3DDeviceImpl *device = context->swapchain->device; 358 #endif 351 359 352 360 context_bind_fbo(context, GL_FRAMEBUFFER, &entry->id); … … 377 385 { 378 386 const struct wined3d_gl_info *gl_info = context->gl_info; 387 #ifdef VBOXWDDM 388 IWineD3DDeviceImpl *device = context->device; 389 #else 379 390 IWineD3DDeviceImpl *device = context->swapchain->device; 391 #endif 380 392 struct fbo_entry *entry; 381 393 … … 413 425 { 414 426 const struct wined3d_gl_info *gl_info = context->gl_info; 427 #ifdef VBOXWDDM 428 IWineD3DDeviceImpl *device = context->device; 429 #else 415 430 IWineD3DDeviceImpl *device = context->swapchain->device; 431 #endif 416 432 unsigned int i; 417 433 … … 734 750 } 735 751 736 static void context_update_window(struct wined3d_context *context) 737 { 752 static void context_update_window(struct wined3d_context *context 753 #ifdef VBOXWDDM 754 , IWineD3DSwapChainImpl *swapchain 755 #endif 756 ) 757 { 758 #ifdef VBOXWDDM 759 TRACE("Updating context %p window from %p to %p.\n", 760 context, context->win_handle, swapchain->win_handle); 761 #else 738 762 TRACE("Updating context %p window from %p to %p.\n", 739 763 context, context->win_handle, context->swapchain->win_handle); 764 #endif 740 765 741 766 if (context->valid) … … 749 774 else context->valid = 1; 750 775 776 #ifdef VBOXWDDM 777 context->win_handle = swapchain->win_handle; 778 context->hdc = GetDC(context->win_handle); 779 context->currentSwapchain = swapchain; 780 #else 751 781 context->win_handle = context->swapchain->win_handle; 752 782 … … 756 786 goto err; 757 787 } 788 #endif 758 789 759 790 if (!context_set_pixel_format(context->gl_info, context->hdc, context->pixel_format)) … … 777 808 } 778 809 779 static void context_validate(struct wined3d_context *context) 810 static void context_validate(struct wined3d_context *context 811 #ifdef VBOXWDDM 812 , IWineD3DSwapChainImpl *swapchain 813 #endif 814 ) 780 815 { 781 816 HWND wnd = WindowFromDC(context->hdc); … … 788 823 } 789 824 790 if (context->win_handle != context->swapchain->win_handle) 791 context_update_window(context); 825 if ( 826 #ifdef VBOXWDDM 827 swapchain && context->win_handle != swapchain->win_handle 828 #else 829 context->win_handle != context->swapchain->win_handle 830 #endif 831 ) 832 { 833 context_update_window(context 834 #ifdef VBOXWDDM 835 , swapchain 836 #endif 837 ); 838 } 792 839 } 793 840 … … 805 852 restore_dc = pwglGetCurrentDC(); 806 853 807 context_validate(context); 854 context_validate(context 855 #ifdef VBOXWDDM 856 , NULL//context->device->swapchains[0] 857 #endif 858 ); 808 859 if (context->valid && restore_ctx != context->glCtx) pwglMakeCurrent(context->hdc, context->glCtx); 809 860 else restore_ctx = NULL; … … 1210 1261 } 1211 1262 1263 1264 1265 1212 1266 /***************************************************************************** 1213 1267 * context_create … … 1361 1415 } 1362 1416 1417 #ifdef VBOXWDDM 1418 ret->device = device; 1419 ret->currentSwapchain = swapchain; 1420 #else 1363 1421 ret->swapchain = swapchain; 1422 #endif 1364 1423 ret->current_rt = (IWineD3DSurface *)target; 1365 1424 ret->tid = GetCurrentThreadId(); … … 1529 1588 return NULL; 1530 1589 } 1590 1591 #ifdef VBOXWDDM 1592 static void context_setup_target(IWineD3DDeviceImpl *device, struct wined3d_context *context, IWineD3DSurface *target); 1593 1594 struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1595 const struct wined3d_format_desc *ds_format_desc) 1596 { 1597 IWineD3DSwapChainImpl *swapChain = NULL; 1598 int i, j; 1599 int swapchains = IWineD3DDevice_GetNumberOfSwapChains(device); 1600 DWORD tid = GetCurrentThreadId(); 1601 struct wined3d_context *context = NULL; 1602 1603 Assert(0); 1604 1605 for(i = 0 ; i < swapchains ; i ++) 1606 { 1607 IWineD3DDevice_GetSwapChain(device, i, &swapChain); 1608 if (swapChain->ds_format == ds_format_desc) 1609 { 1610 for(j = 0; j < swapChain->num_contexts; j++) { 1611 if(swapChain->context[j]->tid == tid 1612 && swapChain->context[j]->tid == tid) { 1613 context = swapChain->context[j]; 1614 break; 1615 } 1616 } 1617 } 1618 else 1619 { 1620 Assert(0); 1621 } 1622 1623 if (context) 1624 break; 1625 IWineD3DSwapChain_Release(swapChain); 1626 } 1627 1628 if (!context) 1629 { 1630 Assert(!swapchains); 1631 context = context_create(swapchain, target, ds_format_desc); 1632 } 1633 else 1634 { 1635 Assert(swapChain); 1636 context_validate(context, swapChain); 1637 context_setup_target(device, context, target); 1638 context_enter(context); 1639 Assert(context->valid); 1640 IWineD3DSwapChain_Release(swapChain); 1641 } 1642 1643 return context; 1644 } 1645 #endif 1531 1646 1532 1647 /***************************************************************************** … … 1807 1922 return ((IWineD3DSwapChainImpl *) swapchain)->context[i]; 1808 1923 } 1809 1810 } 1924 } 1925 1926 #ifdef VBOXWDDM 1927 Assert(0); 1928 #endif 1811 1929 1812 1930 /* Create a new context for the thread */ … … 1839 1957 if (current_context 1840 1958 && current_context->current_rt 1841 && current_context->swapchain->device == This) 1959 #ifdef VBOXWDDM 1960 && current_context->device == This 1961 #else 1962 && current_context->swapchain->device == This 1963 #endif 1964 ) 1842 1965 { 1843 1966 target = current_context->current_rt; … … 1853 1976 if (current_context && current_context->current_rt == target) 1854 1977 { 1855 context_validate(current_context); 1978 context_validate(current_context 1979 #ifdef VBOXWDDM 1980 , NULL// current_context->device->swapchains[0] 1981 #endif 1982 ); 1856 1983 return current_context; 1857 1984 } … … 1862 1989 context = findThreadContextForSwapChain(swapchain, tid); 1863 1990 IWineD3DSwapChain_Release(swapchain); 1991 #ifdef VBOXWDDM 1992 context_validate(context, swapchain); 1993 #endif 1864 1994 } 1865 1995 else … … 1868 1998 1869 1999 /* Stay with the currently active context. */ 1870 if (current_context && current_context->swapchain->device == This) 2000 if (current_context 2001 #ifdef VBOXWDDM 2002 && current_context->device == This 2003 #else 2004 && current_context->swapchain->device == This 2005 #endif 2006 ) 1871 2007 { 1872 2008 context = current_context; … … 1882 2018 context = findThreadContextForSwapChain(This->swapchains[0], tid); 1883 2019 } 1884 } 1885 2020 #ifdef VBOXWDDM 2021 context_validate(context, 2022 NULL//This->swapchains[0] 2023 ); 2024 #endif 2025 } 2026 2027 #ifndef VBOXWDDM 1886 2028 context_validate(context); 2029 #endif 1887 2030 1888 2031 return context;
Note:
See TracChangeset
for help on using the changeset viewer.