Changeset 32461 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Sep 13, 2010 5:59:01 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c
r32281 r32461 462 462 return ret; 463 463 } 464 464 #ifdef VBOXWDDM 465 static HRESULT IDirect3DDevice9Impl_DoCreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, 466 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain) 467 #else 465 468 static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, 466 469 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain) 470 #endif 467 471 { 468 472 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; … … 493 497 return D3D_OK; 494 498 } 499 500 #ifdef VBOXWDDM 501 static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, 502 D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain) 503 { 504 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 505 IDirect3DSwapChain9Impl *newSwapchain; 506 HRESULT hr = IDirect3DDevice9Impl_DoCreateAdditionalSwapChain(iface, present_parameters, &newSwapchain); 507 if (FAILED(hr)) 508 { 509 ERR("Failed to create additional swapchain, hr %#x.\n", hr); 510 return hr; 511 } 512 513 /* add swapchain to the swapchain list */ 514 wined3d_mutex_lock(); 515 hr = IWineD3DDevice_AddSwapChain(This->WineD3DDevice, newSwapchain->wineD3DSwapChain); 516 wined3d_mutex_unlock(); 517 if (FAILED(hr)) 518 { 519 ERR("Failed to add additional swapchain, hr %#x.\n", hr); 520 IUnknown_Release(newSwapchain); 521 return hr; 522 } 523 524 *swapchain = (IDirect3DSwapChain9 *)newSwapchain; 525 return D3D_OK; 526 } 527 #endif 495 528 496 529 static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data) { … … 2898 2931 local_parameters.PresentationInterval = present_parameters->PresentationInterval; 2899 2932 2933 #ifdef VBOXWDDM 2934 hr = IDirect3DDevice9Impl_DoCreateAdditionalSwapChain((IDirect3DDevice9Ex *)This, 2935 &local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain); 2936 #else 2900 2937 hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This, 2901 2938 &local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain); 2939 #endif 2902 2940 if (FAILED(hr)) 2903 2941 { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/wined3d.h
r31868 r32461 7302 7302 ) = 0; 7303 7303 7304 #ifdef VBOXWDDM 7305 virtual HRESULT STDMETHODCALLTYPE Flush( 7306 ) = 0; 7307 7308 virtual HRESULT STDMETHODCALLTYPE AddSwapChain( 7309 IWineD3DSwapChain *swapchain) = 0; 7310 #endif 7304 7311 }; 7305 7312 #else … … 8065 8072 HRESULT (STDMETHODCALLTYPE *Flush)( 8066 8073 IWineD3DDevice* This); 8074 8075 HRESULT (STDMETHODCALLTYPE *AddSwapChain)( 8076 IWineD3DDevice* This, 8077 IWineD3DSwapChain *swapchain); 8067 8078 #endif 8068 8079 … … 8224 8235 #ifdef VBOXWDDM 8225 8236 #define IWineD3DDevice_Flush(This) (This)->lpVtbl->Flush(This) 8237 #define IWineD3DDevice_AddSwapChain(This,swapchain) (This)->lpVtbl->AddSwapChain(This,swapchain) 8226 8238 #endif 8227 8239 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/arb_program_shader.c
r28475 r32461 586 586 static void shader_arb_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader) 587 587 { 588 #ifdef VBOXWDDM 589 IWineD3DDeviceImpl *device = context->device; 590 #else 588 591 IWineD3DDeviceImpl *device = context->swapchain->device; 592 #endif 589 593 IWineD3DStateBlockImpl* stateBlock = device->stateBlock; 590 594 const struct wined3d_gl_info *gl_info = context->gl_info; … … 616 620 /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active 617 621 * context. On a context switch the old context will be fully dirtified */ 622 #ifdef VBOXWDDM 623 if (!context || context->device != This) return; 624 #else 618 625 if (!context || context->swapchain->device != This) return; 626 #endif 619 627 620 628 memset(context->vshader_const_dirty + start, 1, sizeof(*context->vshader_const_dirty) * count); … … 629 637 /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active 630 638 * context. On a context switch the old context will be fully dirtified */ 639 #ifdef VBOXWDDM 640 if (!context || context->device != This) return; 641 #else 631 642 if (!context || context->swapchain->device != This) return; 643 #endif 632 644 633 645 memset(context->pshader_const_dirty + start, 1, sizeof(*context->pshader_const_dirty) * count); … … 4349 4361 static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) 4350 4362 { 4363 #ifdef VBOXWDDM 4364 IWineD3DDeviceImpl *This = context->device; 4365 #else 4351 4366 IWineD3DDeviceImpl *This = context->swapchain->device; 4367 #endif 4352 4368 struct shader_arb_priv *priv = This->shader_priv; 4353 4369 const struct wined3d_gl_info *gl_info = context->gl_info; -
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; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r31868 r32461 6857 6857 } 6858 6858 6859 static HRESULT WINAPI IWineD3DDeviceImpl_AddSwapChain(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain) 6860 { 6861 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 6862 VOID *pvNewBuf = HeapReAlloc(GetProcessHeap(), 0, This->swapchains, (This->NumberOfSwapChains + 1) * sizeof(IWineD3DSwapChain *)); 6863 if(!pvNewBuf) { 6864 ERR("Out of memory!\n"); 6865 return E_OUTOFMEMORY; 6866 } 6867 IUnknown_AddRef(swapchain); 6868 This->swapchains = (IWineD3DSwapChain *)pvNewBuf; 6869 This->swapchains[This->NumberOfSwapChains] = swapchain; 6870 ++This->NumberOfSwapChains; 6871 return WINED3D_OK; 6872 } 6859 6873 #endif 6860 6874 … … 7014 7028 /* VBox WDDM extensions */ 7015 7029 IWineD3DDeviceImpl_Flush, 7030 IWineD3DDeviceImpl_AddSwapChain, 7016 7031 #endif 7017 7032 }; … … 7121 7136 void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height) 7122 7137 { 7138 #ifdef VBOXWDDM 7139 IWineD3DSwapChainImpl *swapchain = context->currentSwapchain; 7140 #else 7123 7141 IWineD3DSwapChainImpl *swapchain = context->swapchain; 7142 #endif 7124 7143 /* The drawable size of a backbuffer / aux buffer offscreen target is the size of the 7125 7144 * current context's drawable, which is the size of the back buffer of the swapchain -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c
r30885 r32461 773 773 { 774 774 const struct wined3d_gl_info *gl_info = context->gl_info; 775 #ifdef VBOXWDDM 776 IWineD3DDeviceImpl *device = context->device; 777 #else 775 778 IWineD3DDeviceImpl *device = context->swapchain->device; 779 #endif 776 780 IWineD3DStateBlockImpl* stateBlock = device->stateBlock; 777 781 struct shader_glsl_priv *priv = device->shader_priv; … … 4616 4620 { 4617 4621 const struct wined3d_gl_info *gl_info = context->gl_info; 4622 #ifdef VBOXWDDM 4623 IWineD3DDeviceImpl *device = context->device; 4624 #else 4618 4625 IWineD3DDeviceImpl *device = context->swapchain->device; 4626 #endif 4619 4627 struct shader_glsl_priv *priv = device->shader_priv; 4620 4628 GLhandleARB program_id = 0; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r31868 r32461 842 842 } 843 843 swapchain->ds_format = getFormatDescEntry(WINED3DFMT_D24_UNORM_S8_UINT, gl_info); 844 845 #ifdef VBOXWDDM 846 swapchain->context[0] = context_find_create(device, swapchain, (IWineD3DSurfaceImpl *)swapchain->frontBuffer, 847 swapchain->ds_format); 848 #else 844 849 swapchain->context[0] = context_create(swapchain, (IWineD3DSurfaceImpl *)swapchain->frontBuffer, 845 850 swapchain->ds_format); 851 #endif 846 852 if (!swapchain->context[0]) 847 853 { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r31828 r32461 1074 1074 DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ 1075 1075 1076 #ifdef VBOXWDDM 1077 IWineD3DDeviceImpl *device; 1078 IWineD3DSwapChainImpl *currentSwapchain; 1079 #else 1076 1080 IWineD3DSwapChainImpl *swapchain; 1081 #endif 1082 1077 1083 IWineD3DSurface *current_rt; 1078 1084 DWORD tid; /* Thread ID which owns this context at the moment */ … … 1240 1246 struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1241 1247 const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN; 1248 #ifdef VBOXWDDM 1249 struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1250 const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN; 1251 #endif 1242 1252 void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN; 1243 1253 void context_free_event_query(struct wined3d_event_query *query) DECLSPEC_HIDDEN;
Note:
See TracChangeset
for help on using the changeset viewer.