Changeset 32577 in vbox
- Timestamp:
- Sep 16, 2010 6:11:27 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 65970
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
r32562 r32577 1747 1747 if (!pSwapchain) 1748 1748 { 1749 // Assert(0); 1749 #ifdef DEBUG_misha 1750 Assert(0); 1751 #endif 1750 1752 /* first search for the swapchain the alloc might be added to */ 1751 1753 PVBOXWDDMDISP_SWAPCHAIN pCur = RTListNodeGetFirst(&pDevice->SwapchainList, VBOXWDDMDISP_SWAPCHAIN, ListEntry); … … 1768 1770 || (pBbRc->fFlags == pRtRc->fFlags 1769 1771 && pBbRc->RcDesc.enmPool == pRtRc->RcDesc.enmPool 1770 && pBbRc->RcDesc.fFlags.Value == pRtRc->RcDesc.fFlags.Value1772 // && pBbRc->RcDesc.fFlags.Value == pRtRc->RcDesc.fFlags.Value 1771 1773 ) 1772 1774 )) … … 2349 2351 { 2350 2352 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i]; 2351 pAlloc->SurfDesc.width = 0x4 00;2352 pAlloc->SurfDesc.height = 0x 300;2353 pAlloc->SurfDesc.width = 0x4; 2354 pAlloc->SurfDesc.height = 0x4; 2353 2355 pAlloc->SurfDesc.format = D3DDDIFMT_A8R8G8B8; 2354 2356 } … … 3614 3616 Assert(pSrcRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 3615 3617 Assert(pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM); 3616 IDirect3DTexture9 *pD3DIfSrcTex = (IDirect3DTexture9*)pSrcRc->aAllocations[0].pD3DIf;3617 IDirect3DTexture9 *pD3DIfDstTex = (IDirect3DTexture9*)pDstRc->aAllocations[0].pD3DIf;3618 Assert(pD3DIfSrcTex);3619 Assert(pD3DIfDstTex);3620 3618 HRESULT hr = S_OK; 3621 3619 3622 3620 if (pSrcRc->aAllocations[0].SurfDesc.width == pDstRc->aAllocations[0].SurfDesc.width 3623 3621 && pSrcRc->aAllocations[0].SurfDesc.height == pDstRc->aAllocations[0].SurfDesc.height 3624 && pSrcRc->RcDesc.enmFormat == pDstRc->RcDesc.enmFormat) 3625 { 3626 /* first check if we can do IDirect3DDevice9::UpdateTexture */ 3627 if (pData->DstPoint.x == 0 && pData->DstPoint.y == 0 3622 && pSrcRc->RcDesc.enmFormat == pDstRc->RcDesc.enmFormat 3623 &&pData->DstPoint.x == 0 && pData->DstPoint.y == 0 3628 3624 && pData->SrcRect.left == 0 && pData->SrcRect.top == 0 3629 3625 && pData->SrcRect.right - pData->SrcRect.left == pSrcRc->aAllocations[0].SurfDesc.width 3630 3626 && pData->SrcRect.bottom - pData->SrcRect.top == pSrcRc->aAllocations[0].SurfDesc.height) 3631 { 3632 hr = pDevice9If->UpdateTexture(pD3DIfSrcTex, pD3DIfDstTex); 3627 { 3628 IDirect3DTexture9 *pD3DIfSrcTex = (IDirect3DTexture9*)pSrcRc->aAllocations[0].pD3DIf; 3629 IDirect3DTexture9 *pD3DIfDstTex = (IDirect3DTexture9*)pDstRc->aAllocations[0].pD3DIf; 3630 Assert(pD3DIfSrcTex); 3631 Assert(pD3DIfDstTex); 3632 hr = pDevice9If->UpdateTexture(pD3DIfSrcTex, pD3DIfDstTex); 3633 Assert(hr == S_OK); 3634 } 3635 else 3636 { 3637 IDirect3DSurface9 *pSrcSurfIf = NULL; 3638 IDirect3DSurface9 *pDstSurfIf = NULL; 3639 hr = vboxWddmSurfGet(pDstRc, 0, &pDstSurfIf); 3640 Assert(hr == S_OK); 3641 if (hr == S_OK) 3642 { 3643 hr = vboxWddmSurfGet(pSrcRc, 0, &pSrcSurfIf); 3633 3644 Assert(hr == S_OK); 3634 } 3635 else 3636 { 3637 Assert(0); 3638 /* @todo: impl */ 3639 } 3640 } 3641 else 3642 { 3643 Assert(0); 3644 /* @todo: impl */ 3645 if (hr == S_OK) 3646 { 3647 RECT DstRect; 3648 vboxWddmRectMoved(&DstRect, &pData->SrcRect, pData->DstPoint.x, pData->DstPoint.y); 3649 #ifdef DEBUG 3650 RECT tstRect = {0,0, pDstRc->aAllocations[0].SurfDesc.width, pDstRc->aAllocations[0].SurfDesc.height}; 3651 Assert(vboxWddmRectIsCoveres(&tstRect, &DstRect)); 3652 #endif 3653 hr = pDevice9If->StretchRect(pSrcSurfIf, &pData->SrcRect, pDstSurfIf, &DstRect, D3DTEXF_NONE); 3654 Assert(hr == S_OK); 3655 pSrcSurfIf->Release(); 3656 } 3657 pDstSurfIf->Release(); 3658 } 3645 3659 } 3646 3660 … … 4761 4775 if (hr == S_OK) 4762 4776 { 4777 #if 0 4763 4778 if(pResource->Flags.Primary) 4764 4779 { … … 4769 4784 Assert(bIssueCreateResource); 4770 4785 } 4786 #endif 4771 4787 continue; 4772 4788 } … … 6752 6768 } 6753 6769 #else 6754 # define VBOXDISP_TEST_SWAPCHAIN6770 //# define VBOXDISP_TEST_SWAPCHAIN 6755 6771 # ifdef VBOXDISP_TEST_SWAPCHAIN 6756 6772 VBOXDISP_D3DEV(pDevice); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h
r32496 r32577 419 419 } 420 420 421 DECLINLINE(bool) vboxWddmRectIsEmpty( RECT * pRect)421 DECLINLINE(bool) vboxWddmRectIsEmpty(const RECT * pRect) 422 422 { 423 423 return pRect->left == pRect->right-1 && pRect->top == pRect->bottom-1; 424 424 } 425 425 426 DECLINLINE(bool) vboxWddmRectIsIntersect( RECT * pRect1,RECT * pRect2)426 DECLINLINE(bool) vboxWddmRectIsIntersect(const RECT * pRect1, const RECT * pRect2) 427 427 { 428 428 return !((pRect1->left < pRect2->left && pRect1->right < pRect2->left) … … 432 432 } 433 433 434 DECLINLINE(bool) vboxWddmRectIsInclude(RECT * pRect1, RECT * pRect2)435 {436 return ((pRect1->left <= pRect2->left && pRect1->right >= pRect2->right)437 && (pRect1->top <= pRect2->top && pRect1->bottom >= pRect2->bottom));438 }439 440 434 DECLINLINE(void) vboxWddmRectUnited(RECT * pDst, const RECT * pRect1, const RECT * pRect2) 441 435 { … … 452 446 pRect->right += x; 453 447 pRect->bottom += y; 448 } 449 450 DECLINLINE(void) vboxWddmRectMove(RECT * pRect, int x, int y) 451 { 452 LONG w = pRect->right - pRect->left; 453 LONG h = pRect->bottom - pRect->top; 454 pRect->left = x; 455 pRect->top = y; 456 pRect->right = w + x; 457 pRect->bottom = h + y; 458 } 459 460 DECLINLINE(void) vboxWddmRectTranslated(RECT *pDst, const RECT * pRect, int x, int y) 461 { 462 *pDst = *pRect; 463 vboxWddmRectTranslate(pDst, x, y); 464 } 465 466 DECLINLINE(void) vboxWddmRectMoved(RECT *pDst, const RECT * pRect, int x, int y) 467 { 468 *pDst = *pRect; 469 vboxWddmRectMove(pDst, x, y); 454 470 } 455 471 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r32546 r32577 855 855 context_validate(context 856 856 #ifdef VBOXWDDM/* tmp work-around */ 857 , context->device->swapchains[context->device->NumberOfSwapChains-1]857 , (IWineD3DSwapChainImpl*)context->device->swapchains[context->device->NumberOfSwapChains-1] 858 858 #endif 859 859 ); … … 1293 1293 HDC hdc; 1294 1294 1295 #if defined(VBOXWDDM) && defined(DEBUG_misha) 1296 Assert(0); 1297 #endif 1298 1295 1299 TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle); 1296 1300 … … 1592 1596 #ifdef VBOXWDDM 1593 1597 static void context_setup_target(IWineD3DDeviceImpl *device, struct wined3d_context *context, IWineD3DSurface *target); 1598 static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceImpl *device, enum ContextUsage usage); 1599 1600 BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate) 1601 { 1602 IWineD3DDeviceImpl *device = context->device; 1603 struct wined3d_context *current_context = context_get_current(); 1604 if (bReValidate) 1605 { 1606 IWineD3DSwapChain *swapchain = NULL; 1607 if (target && SUCCEEDED(IWineD3DSurface_GetContainer(target, &IID_IWineD3DSwapChain, (void **)&swapchain))) { 1608 context_validate(current_context, (IWineD3DSwapChainImpl*)swapchain); 1609 IWineD3DSwapChain_Release(swapchain); 1610 } 1611 else { 1612 /* tmp work-around */ 1613 context_validate(current_context, (IWineD3DSwapChainImpl*)current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]); 1614 } 1615 } 1616 context_setup_target(device, context, target); 1617 context_enter(context); 1618 Assert(context->valid); 1619 if (!context->valid) return FALSE; 1620 1621 if (context != current_context) 1622 { 1623 if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); 1624 else device->frag_pipe->enable_extension((IWineD3DDevice *)device, !context->last_was_blit); 1625 1626 if (context->vshader_const_dirty) 1627 { 1628 memset(context->vshader_const_dirty, 1, 1629 sizeof(*context->vshader_const_dirty) * device->d3d_vshader_constantF); 1630 device->highest_dirty_vs_const = device->d3d_vshader_constantF; 1631 } 1632 if (context->pshader_const_dirty) 1633 { 1634 memset(context->pshader_const_dirty, 1, 1635 sizeof(*context->pshader_const_dirty) * device->d3d_pshader_constantF); 1636 device->highest_dirty_ps_const = device->d3d_pshader_constantF; 1637 } 1638 } 1639 else if (context->restore_ctx) 1640 { 1641 if (!pwglMakeCurrent(context->hdc, context->glCtx)) 1642 { 1643 DWORD err = GetLastError(); 1644 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 1645 context->hdc, context->glCtx, err); 1646 } 1647 } 1648 1649 context_apply_state(context, device, usage); 1650 1651 return TRUE; 1652 } 1594 1653 1595 1654 struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1596 1655 const struct wined3d_format_desc *ds_format_desc) 1597 1656 { 1598 inti;1657 UINT i; 1599 1658 DWORD tid = GetCurrentThreadId(); 1600 1659 struct wined3d_context *context = NULL; … … 1619 1678 else 1620 1679 { 1621 context_validate(context, swapchain); 1622 context_setup_target(device, context, target); 1623 context_enter(context); 1624 Assert(context->valid); 1680 if(!context_acquire_context(context, (IWineD3DSurface*)target, CTXUSAGE_RESOURCELOAD, TRUE)) 1681 { 1682 ERR("Failed to acquire the context.\n"); 1683 Assert(0); 1684 Assert(!context->valid); 1685 context = NULL; 1686 } 1687 else 1688 { 1689 Assert(context->valid); 1690 } 1625 1691 } 1626 1692 … … 1970 2036 { 1971 2037 #ifdef VBOXWDDM 1972 IWineD3DSwapChain Impl*swapchain = NULL;2038 IWineD3DSwapChain *swapchain = NULL; 1973 2039 if (SUCCEEDED(IWineD3DSurface_GetContainer(target, &IID_IWineD3DSwapChain, (void **)&swapchain))) { 1974 context_validate(current_context, swapchain);2040 context_validate(current_context, (IWineD3DSwapChainImpl*)swapchain); 1975 2041 IWineD3DSwapChain_Release(swapchain); 1976 2042 } 1977 2043 else { 1978 2044 /* tmp work-around */ 1979 context_validate(current_context, current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]);2045 context_validate(current_context, (IWineD3DSwapChainImpl*)current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]); 1980 2046 } 1981 2047 #else … … 1990 2056 context = findThreadContextForSwapChain(swapchain, tid); 1991 2057 #ifdef VBOXWDDM 1992 context_validate(context, swapchain);2058 context_validate(context, (IWineD3DSwapChainImpl*)swapchain); 1993 2059 #endif 1994 2060 IWineD3DSwapChain_Release(swapchain); … … 2025 2091 #ifdef VBOXWDDM 2026 2092 context_validate(context, 2027 This->swapchains[This->NumberOfSwapChains-1] /* tmp work-around */2093 (IWineD3DSwapChainImpl*)This->swapchains[This->NumberOfSwapChains-1] /* tmp work-around */ 2028 2094 ); 2029 2095 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r32545 r32577 6863 6863 static HRESULT WINAPI IWineD3DDeviceImpl_Flush(IWineD3DDevice *iface) 6864 6864 { 6865 IWineD3DSwapChain *swapChain = NULL; 6865 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 6866 struct wined3d_context *context; 6866 6867 int i; 6867 int swapchains = IWineD3DDeviceImpl_GetNumberOfSwapChains(iface); 6868 6869 TRACE("iface %p.\n", iface); 6870 6871 for(i = 0 ; i < swapchains ; i ++) { 6872 6873 IWineD3DDeviceImpl_GetSwapChain(iface, i, &swapChain); 6874 TRACE("presentinng chain %d, %p\n", i, swapChain); 6875 IWineD3DSwapChain_Flush(swapChain); 6876 IWineD3DSwapChain_Release(swapChain); 6877 } 6878 6868 for (i = 0; i < This->numContexts; ++i) 6869 { 6870 context = This->contexts[i]; 6871 if (context_acquire_context(context, NULL, CTXUSAGE_RESOURCELOAD, TRUE)) 6872 { 6873 Assert(context->valid); 6874 wglFlush(); 6875 context_release(context); 6876 } 6877 else 6878 { 6879 WARN("Invalid context, skipping flush.\n"); 6880 } 6881 } 6879 6882 return WINED3D_OK; 6880 6883 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r32545 r32577 555 555 } 556 556 557 #ifdef VBOXWDDM558 static HRESULT WINAPI IWineD3DSwapChainImpl_Flush(IWineD3DSwapChain *iface)559 {560 IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;561 struct wined3d_context *context;562 RECT src_rect, dst_rect;563 BOOL render_to_fbo;564 unsigned int sync;565 int retval;566 567 context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);568 569 if (context->valid) wglFlush();570 else WARN("Invalid context, skipping flush.\n");571 572 context_release(context);573 574 return WINED3D_OK;575 }576 #endif577 578 557 static const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl = 579 558 { … … 595 574 IWineD3DBaseSwapChainImpl_SetGammaRamp, 596 575 IWineD3DBaseSwapChainImpl_GetGammaRamp, 597 #ifdef VBOXWDDM598 IWineD3DSwapChainImpl_Flush,599 #endif600 576 }; 601 577 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain_gdi.c
r32545 r32577 254 254 return WINED3D_OK; 255 255 } 256 257 #ifdef VBOXWDDM258 static HRESULT WINAPI IWineGDISwapChainImpl_Flush(IWineD3DSwapChain *iface) {259 IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;260 261 WARN("GDI Swapchain doesn't implement flush, returning WINED3DERR_INVALIDCALL\n");262 return WINED3DERR_INVALIDCALL;263 }264 #endif265 256 266 257 const IWineD3DSwapChainVtbl IWineGDISwapChain_Vtbl = … … 283 274 IWineD3DBaseSwapChainImpl_SetGammaRamp, 284 275 IWineD3DBaseSwapChainImpl_GetGammaRamp, 285 #ifdef VBOXWDM286 IWineGDISwapChainImpl_Flush,287 #endif288 276 }; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r32545 r32577 1249 1249 struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1250 1250 const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN; 1251 BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate) DECLSPEC_HIDDEN; 1251 1252 #endif 1252 1253 void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
Note:
See TracChangeset
for help on using the changeset viewer.