Changeset 43334 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Sep 14, 2012 5:34:33 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoTools.h
r39992 r43334 229 229 } 230 230 231 typedef struct VBOXPOINT3D 232 { 233 UINT x; 234 UINT y; 235 UINT z; 236 } VBOXPOINT3D, *PVBOXPOINT3D; 237 238 typedef struct VBOXBOX3D 239 { 240 UINT Left; 241 UINT Top; 242 UINT Right; 243 UINT Bottom; 244 UINT Front; 245 UINT Back; 246 } VBOXBOX3D, *PVBOXBOX3D; 247 248 DECLINLINE(void) vboxWddmBoxTranslate(VBOXBOX3D * pBox, int x, int y, int z) 249 { 250 pBox->Left += x; 251 pBox->Top += y; 252 pBox->Right += x; 253 pBox->Bottom += y; 254 pBox->Front += z; 255 pBox->Back += z; 256 } 257 258 DECLINLINE(void) vboxWddmBoxMove(VBOXBOX3D * pBox, int x, int y, int z) 259 { 260 LONG w = pBox->Right - pBox->Left; 261 LONG h = pBox->Bottom - pBox->Top; 262 LONG d = pBox->Back - pBox->Front; 263 pBox->Left = x; 264 pBox->Top = y; 265 pBox->Right = w + x; 266 pBox->Bottom = h + y; 267 pBox->Front = z; 268 pBox->Back = d + z; 269 } 270 271 #define VBOXWDDM_BOXDIV_U(_v, _d, _nz) do { \ 272 UINT tmp = (_v) / (_d); \ 273 if (!tmp && (_v) && (_nz)) \ 274 (_v) = 1; \ 275 else \ 276 (_v) = tmp; \ 277 } while (0) 278 279 DECLINLINE(void) vboxWddmBoxDivide(VBOXBOX3D * pBox, int div, bool fDontReachZero) 280 { 281 VBOXWDDM_BOXDIV_U(pBox->Left, div, fDontReachZero); 282 VBOXWDDM_BOXDIV_U(pBox->Top, div, fDontReachZero); 283 VBOXWDDM_BOXDIV_U(pBox->Right, div, fDontReachZero); 284 VBOXWDDM_BOXDIV_U(pBox->Bottom, div, fDontReachZero); 285 VBOXWDDM_BOXDIV_U(pBox->Front, div, fDontReachZero); 286 VBOXWDDM_BOXDIV_U(pBox->Back, div, fDontReachZero); 287 } 288 289 DECLINLINE(void) vboxWddmPoint3DDivide(VBOXPOINT3D * pPoint, int div, bool fDontReachZero) 290 { 291 VBOXWDDM_BOXDIV_U(pPoint->x, div, fDontReachZero); 292 VBOXWDDM_BOXDIV_U(pPoint->y, div, fDontReachZero); 293 VBOXWDDM_BOXDIV_U(pPoint->y, div, fDontReachZero); 294 } 295 296 DECLINLINE(void) vboxWddmBoxTranslated(VBOXBOX3D * pDst, const VBOXBOX3D * pBox, int x, int y, int z) 297 { 298 *pDst = *pBox; 299 vboxWddmBoxTranslate(pDst, x, y, z); 300 } 301 302 DECLINLINE(void) vboxWddmBoxMoved(VBOXBOX3D * pDst, const VBOXBOX3D * pBox, int x, int y, int z) 303 { 304 *pDst = *pBox; 305 vboxWddmBoxMove(pDst, x, y, z); 306 } 307 308 DECLINLINE(void) vboxWddmBoxDivided(VBOXBOX3D * pDst, const VBOXBOX3D * pBox, int div, bool fDontReachZero) 309 { 310 *pDst = *pBox; 311 vboxWddmBoxDivide(pDst, div, fDontReachZero); 312 } 313 314 DECLINLINE(void) vboxWddmPoint3DDivided(VBOXPOINT3D * pDst, const VBOXPOINT3D * pPoint, int div, bool fDontReachZero) 315 { 316 *pDst = *pPoint; 317 vboxWddmPoint3DDivide(pDst, div, fDontReachZero); 318 } 319 231 320 /* the dirty rect info is valid */ 232 321 #define VBOXWDDM_DIRTYREGION_F_VALID 0x00000001 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h
r43236 r43334 537 537 case D3DDDIFMT_L8: 538 538 return 8; 539 case D3DDDIFMT_L16: 539 540 case D3DDDIFMT_A8L8: 540 541 return 16; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxD3DIf.cpp
r43236 r43334 543 543 else if (VBOXWDDMDISP_IS_TEXTURE(pRc->RcDesc.fFlags)) 544 544 { 545 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 546 IDirect3DBaseTexture9 *pD3DIfTex; 547 HANDLE hSharedHandle = pAllocation->hSharedHandle; 548 void **pavClientMem = NULL; 549 VBOXDISP_D3DIFTYPE enmD3DIfType = VBOXDISP_D3DIFTYPE_UNDEFINED; 550 hr = S_OK; 551 if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM) 552 { 553 pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pRc->cAllocations); 554 Assert(pavClientMem); 555 if (pavClientMem) 556 { 557 for (UINT i = 0; i < pRc->cAllocations; ++i) 558 { 559 Assert(pRc->aAllocations[i].pvMem); 560 pavClientMem[i] = pRc->aAllocations[i].pvMem; 561 } 562 } 563 else 564 hr = E_FAIL; 565 } 566 567 #ifdef DEBUG 545 568 if (!pRc->RcDesc.fFlags.CubeMap) 546 569 { 547 #ifdef DEBUG 548 { 549 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[0]; 550 uint32_t tstW = pAlloc->SurfDesc.width; 551 uint32_t tstH = pAlloc->SurfDesc.height; 552 for (UINT i = 1; i < pRc->cAllocations; ++i) 553 { 554 tstW /= 2; 555 tstH /= 2; 556 pAlloc = &pRc->aAllocations[i]; 557 Assert((pAlloc->SurfDesc.width == tstW) || (!tstW && (pAlloc->SurfDesc.width==1))); 558 Assert((pAlloc->SurfDesc.height == tstH) || (!tstH && (pAlloc->SurfDesc.height==1))); 559 } 560 } 570 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[0]; 571 uint32_t tstW = pAlloc->SurfDesc.width; 572 uint32_t tstH = pAlloc->SurfDesc.height; 573 for (UINT i = 1; i < pRc->cAllocations; ++i) 574 { 575 tstW /= 2; 576 tstH /= 2; 577 pAlloc = &pRc->aAllocations[i]; 578 Assert((pAlloc->SurfDesc.width == tstW) || (!tstW && (pAlloc->SurfDesc.width==1))); 579 Assert((pAlloc->SurfDesc.height == tstH) || (!tstH && (pAlloc->SurfDesc.height==1))); 580 } 581 } 561 582 #endif 562 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 563 IDirect3DTexture9 *pD3DIfTex; 564 HANDLE hSharedHandle = pAllocation->hSharedHandle; 565 void **pavClientMem = NULL; 566 hr = S_OK; 567 if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM) 568 { 569 Assert(pAllocation->pvMem); 570 Assert(pAllocation->SurfDesc.pitch); 571 UINT minPitch = vboxWddmCalcPitch(pAllocation->SurfDesc.width, pAllocation->SurfDesc.format); 572 Assert(minPitch); 573 if (minPitch) 574 { 575 if (pAllocation->SurfDesc.pitch != minPitch) 576 { 577 Assert(pAllocation->SurfDesc.pitch > minPitch); 578 pAllocation->D3DWidth = vboxWddmCalcWidthForPitch(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.format); 579 } 580 Assert(pAllocation->D3DWidth >= pAllocation->SurfDesc.width); 583 584 if (SUCCEEDED(hr)) 585 { 586 if (pRc->RcDesc.fFlags.CubeMap) 587 { 588 if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height) 589 || (pRc->cAllocations%6!=0)) 590 { 591 WARN(("unexpected cubemap texture config: (%d ; %d), allocs: %d", 592 pAllocation->SurfDesc.width, pAllocation->SurfDesc.height, pRc->cAllocations)); 593 hr = E_INVALIDARG; 581 594 } 582 595 else 583 596 { 584 Assert(pAllocation->D3DWidth == pAllocation->SurfDesc.width); 585 } 586 } 587 if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM) 588 { 589 pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pRc->cAllocations); 590 Assert(pavClientMem); 591 if (pavClientMem) 592 { 593 for (UINT i = 0; i < pRc->cAllocations; ++i) 594 { 595 Assert(pRc->aAllocations[i].pvMem); 596 pavClientMem[i] = pRc->aAllocations[i].pvMem; 597 } 598 } 599 else 600 hr = E_FAIL; 601 } 602 if (hr == S_OK) 597 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If, 598 pAllocation->D3DWidth, 599 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc), 600 vboxDDI2D3DUsage(pRc->RcDesc.fFlags), 601 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 602 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 603 (IDirect3DCubeTexture9**)&pD3DIfTex, 604 #ifdef VBOXWDDMDISP_DEBUG_NOSHARED 605 NULL, 606 #else 607 pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL, 608 #endif 609 pavClientMem); 610 Assert(hr == S_OK); 611 Assert(pD3DIfTex); 612 enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE; 613 } 614 } 615 else if (pRc->RcDesc.fFlags.Volume) 616 { 617 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateVolumeTexture((IDirect3DDevice9Ex *)pDevice9If, 618 pAllocation->D3DWidth, 619 pAllocation->SurfDesc.height, 620 pAllocation->SurfDesc.depth, 621 pRc->cAllocations, 622 vboxDDI2D3DUsage(pRc->RcDesc.fFlags), 623 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 624 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 625 (IDirect3DVolumeTexture9**)&pD3DIfTex, 626 #ifdef VBOXWDDMDISP_DEBUG_NOSHARED 627 NULL, 628 #else 629 pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL, 630 #endif 631 pavClientMem); 632 Assert(hr == S_OK); 633 Assert(pD3DIfTex); 634 enmD3DIfType = VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE; 635 } 636 else 603 637 { 604 638 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If, … … 609 643 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 610 644 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 611 &pD3DIfTex,645 (IDirect3DTexture9**)&pD3DIfTex, 612 646 #ifdef VBOXWDDMDISP_DEBUG_NOSHARED 613 647 NULL, … … 617 651 pavClientMem); 618 652 Assert(hr == S_OK); 619 if (hr == S_OK) 620 { 621 Assert(pD3DIfTex); 653 Assert(pD3DIfTex); 654 enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 655 } 656 657 if (SUCCEEDED(hr)) 658 { 659 Assert(pD3DIfTex); 660 Assert(enmD3DIfType != VBOXDISP_D3DIFTYPE_UNDEFINED); 622 661 #ifndef VBOXWDDMDISP_DEBUG_NOSHARED 623 662 Assert(!!(pRc->RcDesc.fFlags.SharedResource) == !!(hSharedHandle)); 624 663 #endif 625 for (UINT i = 0; i < pRc->cAllocations; ++i) 626 { 627 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i]; 628 pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE; 629 pAlloc->pD3DIf = pD3DIfTex; 630 pAlloc->hSharedHandle = hSharedHandle; 631 if (i > 0) 632 pD3DIfTex->AddRef(); 633 } 634 } 635 636 if (pavClientMem) 637 RTMemFree(pavClientMem); 638 } 639 } 640 else /*pRc->RcDesc.fFlags.CubeMap*/ 641 { 642 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0]; 643 IDirect3DCubeTexture9 *pD3DIfCubeTex; 644 HANDLE hSharedHandle = pAllocation->hSharedHandle; 645 void **pavClientMem = NULL; 646 647 if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height) 648 || (pRc->cAllocations%6!=0)) 649 { 650 Assert(0); 651 hr = E_INVALIDARG; 652 } 653 else 654 { 655 hr = S_OK; 656 if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM) 657 { 658 pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pRc->cAllocations); 659 Assert(pavClientMem); 660 if (pavClientMem) 661 { 662 for (UINT i = 0; i < pRc->cAllocations; ++i) 663 { 664 pavClientMem[i] = pRc->aAllocations[i].pvMem; 665 } 666 } 667 else 668 hr = E_FAIL; 669 } 670 671 if (hr == S_OK) 672 { 673 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If, 674 pAllocation->SurfDesc.width, 675 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc), 676 vboxDDI2D3DUsage(pRc->RcDesc.fFlags), 677 vboxDDI2D3DFormat(pRc->RcDesc.enmFormat), 678 vboxDDI2D3DPool(pRc->RcDesc.enmPool), 679 &pD3DIfCubeTex, 680 #ifdef VBOXWDDMDISP_DEBUG_NOSHARED 681 NULL, 682 #else 683 pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL, 684 #endif 685 pavClientMem); 686 Assert(hr == S_OK); 687 if (hr == S_OK) 688 { 689 Assert(pD3DIfCubeTex); 690 #ifndef VBOXWDDMDISP_DEBUG_NOSHARED 691 Assert(!!(pRc->RcDesc.fFlags.SharedResource) == !!(hSharedHandle)); 692 #endif 693 694 for (UINT i = 0; i < pRc->cAllocations; ++i) 695 { 696 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i]; 697 pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE; 698 pAlloc->pD3DIf = pD3DIfCubeTex; 699 pAlloc->hSharedHandle = hSharedHandle; 700 if (i > 0) 701 pD3DIfCubeTex->AddRef(); 702 } 703 } 704 705 if (pavClientMem) 706 RTMemFree(pavClientMem); 707 } 708 } 709 } 664 for (UINT i = 0; i < pRc->cAllocations; ++i) 665 { 666 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i]; 667 pAlloc->enmD3DIfType = enmD3DIfType; 668 pAlloc->pD3DIf = pD3DIfTex; 669 pAlloc->hSharedHandle = hSharedHandle; 670 if (i > 0) 671 pD3DIfTex->AddRef(); 672 } 673 } 674 } 675 676 if (pavClientMem) 677 RTMemFree(pavClientMem); 710 678 } 711 679 else if (pRc->RcDesc.fFlags.RenderTarget || pRc->RcDesc.fFlags.Primary) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r43314 r43334 2209 2209 VBOXVDBG_DUMP_SETTEXTURE(pRc); 2210 2210 } 2211 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE) 2212 { 2213 pD3DIfTex = (IDirect3DVolumeTexture9*)pRc->aAllocations[0].pD3DIf; 2214 2215 VBOXVDBG_BREAK_SHARED(pRc); 2216 VBOXVDBG_DUMP_SETTEXTURE(pRc); 2217 } 2211 2218 else 2212 2219 { … … 2701 2708 } 2702 2709 2710 AssertCompile(sizeof (D3DDDIBOX) == sizeof (VBOXBOX3D)); 2711 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Left) == RT_SIZEOFMEMB(VBOXBOX3D, Left)); 2712 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Top) == RT_SIZEOFMEMB(VBOXBOX3D, Top)); 2713 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Right) == RT_SIZEOFMEMB(VBOXBOX3D, Right)); 2714 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Bottom) == RT_SIZEOFMEMB(VBOXBOX3D, Bottom)); 2715 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Front) == RT_SIZEOFMEMB(VBOXBOX3D, Front)); 2716 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Back) == RT_SIZEOFMEMB(VBOXBOX3D, Back)); 2717 2718 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Left) == RT_OFFSETOF(VBOXBOX3D, Left)); 2719 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Top) == RT_OFFSETOF(VBOXBOX3D, Top)); 2720 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Right) == RT_OFFSETOF(VBOXBOX3D, Right)); 2721 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Bottom) == RT_OFFSETOF(VBOXBOX3D, Bottom)); 2722 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Front) == RT_OFFSETOF(VBOXBOX3D, Front)); 2723 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Back) == RT_OFFSETOF(VBOXBOX3D, Back)); 2724 2703 2725 static HRESULT APIENTRY vboxWddmDDevVolBlt(HANDLE hDevice, CONST D3DDDIARG_VOLUMEBLT* pData) 2704 2726 { 2705 2727 VBOXDISP_DDI_PROLOGUE_DEV(hDevice); 2728 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 2729 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 2730 Assert(pDevice); 2731 VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice); 2732 IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice); 2733 PVBOXWDDMDISP_RESOURCE pDstRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource; 2734 PVBOXWDDMDISP_RESOURCE pSrcRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource; 2735 /* requirements for D3DDevice9::UpdateTexture */ 2736 Assert(pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE); 2737 Assert(pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE); 2738 IDirect3DVolumeTexture9 * pSrcTex = (IDirect3DVolumeTexture9*)pSrcRc->aAllocations[0].pD3DIf; 2739 IDirect3DVolumeTexture9 * pDstTex = (IDirect3DVolumeTexture9*)pDstRc->aAllocations[0].pD3DIf; 2740 VBOXPOINT3D Point; 2741 Point.x = pData->DstX; 2742 Point.y = pData->DstY; 2743 Point.z = pData->DstZ; 2744 2745 HRESULT hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9VolTexBlt((IDirect3DDevice9Ex*)pDevice9If, pSrcTex, pDstTex, 2746 (VBOXBOX3D*)&pData->SrcBox, &Point); 2747 if (FAILED(hr)) 2748 WARN(("pfnVBoxWineExD3DDev9VolTexBlt failed hr 0x%x", hr)); 2749 else 2750 hr = S_OK; 2706 2751 vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 2707 PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice; 2708 Assert(pDevice); 2709 VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice); 2710 Assert(0); 2711 // @todo: vboxWddmDalCheckAdd(pDevice); 2712 vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice)); 2713 return E_FAIL; 2752 return hr;; 2714 2753 } 2715 2754 … … 2739 2778 /* requirements for D3DDevice9::UpdateTexture */ 2740 2779 Assert(pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE 2741 || pDstRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_CUBE_TEXTURE); 2780 || pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE 2781 || pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE); 2742 2782 Assert(pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE 2743 || pSrcRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_CUBE_TEXTURE); 2783 || pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE 2784 || pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE); 2785 Assert(pSrcRc->aAllocations[0].enmD3DIfType == pDstRc->aAllocations[0].enmD3DIfType); 2744 2786 Assert(pSrcRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 2745 2787 Assert(pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM); … … 2769 2811 else 2770 2812 { 2813 Assert(pDstRc->aAllocations[0].enmD3DIfType != VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE); 2814 Assert(pSrcRc->aAllocations[0].enmD3DIfType != VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE); 2815 2771 2816 IDirect3DSurface9 *pSrcSurfIf = NULL; 2772 2817 IDirect3DSurface9 *pDstSurfIf = NULL; … … 3040 3085 } 3041 3086 3087 AssertCompile(sizeof (D3DDDIBOX) == sizeof (D3DBOX)); 3088 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Left) == RT_SIZEOFMEMB(D3DBOX, Left)); 3089 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Top) == RT_SIZEOFMEMB(D3DBOX, Top)); 3090 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Right) == RT_SIZEOFMEMB(D3DBOX, Right)); 3091 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Bottom) == RT_SIZEOFMEMB(D3DBOX, Bottom)); 3092 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Front) == RT_SIZEOFMEMB(D3DBOX, Front)); 3093 AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Back) == RT_SIZEOFMEMB(D3DBOX, Back)); 3094 3095 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Left) == RT_OFFSETOF(D3DBOX, Left)); 3096 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Top) == RT_OFFSETOF(D3DBOX, Top)); 3097 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Right) == RT_OFFSETOF(D3DBOX, Right)); 3098 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Bottom) == RT_OFFSETOF(D3DBOX, Bottom)); 3099 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Front) == RT_OFFSETOF(D3DBOX, Front)); 3100 AssertCompile(RT_OFFSETOF(D3DDDIBOX, Back) == RT_OFFSETOF(D3DBOX, Back)); 3101 3042 3102 static HRESULT APIENTRY vboxWddmDDevLock(HANDLE hDevice, D3DDDIARG_LOCK* pData) 3043 3103 { … … 3070 3130 Assert(pTexAlloc->pD3DIf); 3071 3131 RECT *pRect = NULL; 3072 bool bNeedResynch = false;3132 BOOL fNeedLock = TRUE; 3073 3133 Assert(!pData->Flags.RangeValid); 3074 3134 Assert(!pData->Flags.BoxValid); … … 3080 3140 /* else - we lock the entire texture, pRect == NULL */ 3081 3141 3082 if (!pLockAlloc->LockInfo.cLocks) 3142 if (pLockAlloc->LockInfo.cLocks) 3143 { 3144 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == pData->Flags.AreaValid); 3145 if (pLockAlloc->LockInfo.fFlags.AreaValid && pData->Flags.AreaValid) 3146 { 3147 Assert(pLockAlloc->LockInfo.Area.left == pData->Area.left); 3148 Assert(pLockAlloc->LockInfo.Area.top == pData->Area.top); 3149 Assert(pLockAlloc->LockInfo.Area.right == pData->Area.right); 3150 Assert(pLockAlloc->LockInfo.Area.bottom == pData->Area.bottom); 3151 } 3152 Assert(pLockAlloc->LockInfo.LockedRect.pBits); 3153 Assert((pLockAlloc->LockInfo.fFlags.Value & ~1) == (pData->Flags.Value & ~1)); /* <- 1 is "ReadOnly" flag */ 3154 3155 if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly) 3156 { 3157 switch (pTexAlloc->enmD3DIfType) 3158 { 3159 case VBOXDISP_D3DIFTYPE_TEXTURE: 3160 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 3161 break; 3162 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 3163 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 3164 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 3165 break; 3166 case VBOXDISP_D3DIFTYPE_SURFACE: 3167 hr = pD3DIfSurface->UnlockRect(); 3168 break; 3169 default: 3170 Assert(0); 3171 break; 3172 } 3173 Assert(hr == S_OK); 3174 } 3175 else 3176 { 3177 fNeedLock = FALSE; 3178 } 3179 } 3180 3181 if (fNeedLock && SUCCEEDED(hr)) 3083 3182 { 3084 3183 VBOXVDBG_CHECK_SMSYNC(pRc); 3184 3185 pLockAlloc->LockInfo.fFlags = pData->Flags; 3186 if (pRect) 3187 { 3188 pLockAlloc->LockInfo.Area = *pRect; 3189 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 1); 3190 } 3191 else 3192 { 3193 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 0); 3194 } 3195 3085 3196 switch (pTexAlloc->enmD3DIfType) 3086 3197 { … … 3107 3218 break; 3108 3219 } 3109 Assert(hr == S_OK); 3110 if (hr == S_OK) 3111 { 3112 pLockAlloc->LockInfo.fFlags = pData->Flags; 3113 if (pRect) 3114 { 3115 pLockAlloc->LockInfo.Area = *pRect; 3116 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 1); 3117 } 3118 else 3119 { 3120 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 0); 3121 } 3122 3123 bNeedResynch = !pData->Flags.Discard; 3124 } 3125 } 3126 else 3127 { 3128 Assert(pLockAlloc->LockInfo.fFlags.AreaValid == pData->Flags.AreaValid); 3129 if (pLockAlloc->LockInfo.fFlags.AreaValid && pData->Flags.AreaValid) 3130 { 3131 Assert(pLockAlloc->LockInfo.Area.left == pData->Area.left); 3132 Assert(pLockAlloc->LockInfo.Area.top == pData->Area.top); 3133 Assert(pLockAlloc->LockInfo.Area.right == pData->Area.right); 3134 Assert(pLockAlloc->LockInfo.Area.bottom == pData->Area.bottom); 3135 } 3136 Assert(pLockAlloc->LockInfo.LockedRect.pBits); 3137 3138 bNeedResynch = pLockAlloc->LockInfo.fFlags.Discard && !pData->Flags.Discard; 3139 3140 Assert(!bNeedResynch); 3141 3142 if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly) 3143 { 3144 switch (pTexAlloc->enmD3DIfType) 3145 { 3146 case VBOXDISP_D3DIFTYPE_TEXTURE: 3147 hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex); 3148 break; 3149 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 3150 hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 3151 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex)); 3152 break; 3153 case VBOXDISP_D3DIFTYPE_SURFACE: 3154 hr = pD3DIfSurface->UnlockRect(); 3155 break; 3156 default: 3157 Assert(0); 3158 break; 3159 } 3160 Assert(hr == S_OK); 3161 if (hr == S_OK) 3162 { 3163 switch (pTexAlloc->enmD3DIfType) 3164 { 3165 case VBOXDISP_D3DIFTYPE_TEXTURE: 3166 hr = pD3DIfTex->LockRect(pData->SubResourceIndex, 3167 &pLockAlloc->LockInfo.LockedRect, 3168 pRect, 3169 vboxDDI2D3DLockFlags(pData->Flags)); 3170 break; 3171 case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE: 3172 hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex), 3173 VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex), 3174 &pLockAlloc->LockInfo.LockedRect, 3175 pRect, 3176 vboxDDI2D3DLockFlags(pData->Flags)); 3177 break; 3178 case VBOXDISP_D3DIFTYPE_SURFACE: 3179 hr = pD3DIfSurface->LockRect(&pLockAlloc->LockInfo.LockedRect, 3180 pRect, 3181 vboxDDI2D3DLockFlags(pData->Flags)); 3182 break; 3183 default: 3184 Assert(0); 3185 break; 3186 } 3187 Assert(hr == S_OK); 3188 pLockAlloc->LockInfo.fFlags.ReadOnly = 0; 3189 } 3190 } 3191 } 3192 3193 if (hr == S_OK) 3220 3221 if (FAILED(hr)) 3222 { 3223 WARN(("LockRect failed, hr", hr)); 3224 } 3225 } 3226 3227 if (SUCCEEDED(hr)) 3194 3228 { 3195 3229 ++pLockAlloc->LockInfo.cLocks; … … 3210 3244 3211 3245 VBOXVDBG_DUMP_LOCK_ST(pData); 3246 3247 hr = S_OK; 3248 } 3249 } 3250 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE) 3251 { 3252 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; 3253 Assert(pData->SubResourceIndex < pRc->cAllocations); 3254 PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 3255 IDirect3DVolumeTexture9 *pD3DIfTex = (IDirect3DVolumeTexture9*)pTexAlloc->pD3DIf; 3256 Assert(pTexAlloc->pD3DIf); 3257 D3DDDIBOX *pBox = NULL; 3258 BOOL fNeedLock = TRUE; 3259 Assert(!pData->Flags.AreaValid); 3260 Assert(!pData->Flags.BoxValid); 3261 if (pData->Flags.BoxValid) 3262 { 3263 pBox = &pData->Box; 3264 } 3265 3266 /* else - we lock the entire texture, pBox == NULL */ 3267 3268 if (pLockAlloc->LockInfo.cLocks) 3269 { 3270 Assert(pLockAlloc->LockInfo.fFlags.BoxValid == pData->Flags.BoxValid); 3271 if (pLockAlloc->LockInfo.fFlags.BoxValid && pData->Flags.BoxValid) 3272 { 3273 Assert(pLockAlloc->LockInfo.Box.Left == pData->Box.Left); 3274 Assert(pLockAlloc->LockInfo.Box.Top == pData->Box.Top); 3275 Assert(pLockAlloc->LockInfo.Box.Right == pData->Box.Right); 3276 Assert(pLockAlloc->LockInfo.Box.Bottom == pData->Box.Bottom); 3277 Assert(pLockAlloc->LockInfo.Box.Front == pData->Box.Front); 3278 Assert(pLockAlloc->LockInfo.Box.Back == pData->Box.Back); 3279 } 3280 Assert(pLockAlloc->LockInfo.LockedBox.pBits); 3281 Assert((pLockAlloc->LockInfo.fFlags.Value & ~1) == (pData->Flags.Value & ~1)); /* <- 1 is "ReadOnly" flag */ 3282 3283 if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly) 3284 { 3285 hr = pD3DIfTex->UnlockBox(pData->SubResourceIndex); 3286 Assert(hr == S_OK); 3287 } 3288 else 3289 { 3290 fNeedLock = FALSE; 3291 } 3292 } 3293 3294 if (fNeedLock && SUCCEEDED(hr)) 3295 { 3296 VBOXVDBG_CHECK_SMSYNC(pRc); 3297 3298 pLockAlloc->LockInfo.fFlags = pData->Flags; 3299 if (pBox) 3300 { 3301 pLockAlloc->LockInfo.Box = *pBox; 3302 Assert(pLockAlloc->LockInfo.fFlags.BoxValid == 1); 3303 } 3304 else 3305 { 3306 Assert(pLockAlloc->LockInfo.fFlags.BoxValid == 0); 3307 } 3308 3309 hr = pD3DIfTex->LockBox(pData->SubResourceIndex, 3310 &pLockAlloc->LockInfo.LockedBox, 3311 (D3DBOX*)pBox, 3312 vboxDDI2D3DLockFlags(pData->Flags)); 3313 if (FAILED(hr)) 3314 { 3315 WARN(("LockRect failed, hr", hr)); 3316 } 3317 } 3318 3319 if (SUCCEEDED(hr)) 3320 { 3321 ++pLockAlloc->LockInfo.cLocks; 3322 3323 if (!pData->Flags.NotifyOnly) 3324 { 3325 pData->pSurfData = pLockAlloc->LockInfo.LockedBox.pBits; 3326 pData->Pitch = pLockAlloc->LockInfo.LockedBox.RowPitch; 3327 pData->SlicePitch = pLockAlloc->LockInfo.LockedBox.SlicePitch; 3328 Assert(!pLockAlloc->pvMem); 3329 } 3330 else 3331 { 3332 Assert(pLockAlloc->pvMem); 3333 Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM); 3334 } 3335 3336 VBOXVDBG_DUMP_LOCK_ST(pData); 3337 3338 hr = S_OK; 3212 3339 } 3213 3340 } … … 3546 3673 break; 3547 3674 } 3548 Assert(hr == S_OK); 3675 if (FAILED(hr)) 3676 WARN(("UnlockRect failed, hr 0x%x", hr)); 3549 3677 VBOXVDBG_CHECK_SMSYNC(pRc); 3550 3678 } 3551 else 3552 { 3553 Assert(pLockAlloc->LockInfo.cLocks < UINT32_MAX); 3679 } 3680 else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE) 3681 { 3682 Assert(pData->SubResourceIndex < pRc->cAllocations); 3683 PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex]; 3684 3685 VBOXVDBG_DUMP_UNLOCK_ST(pData); 3686 3687 --pLockAlloc->LockInfo.cLocks; 3688 Assert(pLockAlloc->LockInfo.cLocks < UINT32_MAX); 3689 if (!pLockAlloc->LockInfo.cLocks) 3690 { 3691 PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0]; 3692 Assert(pTexAlloc->pD3DIf); 3693 IDirect3DVolumeTexture9 *pD3DIfTex = (IDirect3DVolumeTexture9*)pTexAlloc->pD3DIf; 3694 hr = pD3DIfTex->UnlockBox(pData->SubResourceIndex); 3695 if (FAILED(hr)) 3696 WARN(("UnlockBox failed, hr 0x%x", hr)); 3697 VBOXVDBG_CHECK_SMSYNC(pRc); 3554 3698 } 3555 3699 } … … 3858 4002 3859 4003 pAllocation->SurfDesc.VidPnSourceId = pResource->VidPnSourceId; 4004 4005 if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM) 4006 { 4007 Assert(pAllocation->pvMem); 4008 Assert(pAllocation->SurfDesc.pitch); 4009 UINT minPitch = vboxWddmCalcPitch(pAllocation->SurfDesc.width, pAllocation->SurfDesc.format); 4010 Assert(minPitch); 4011 if (minPitch) 4012 { 4013 if (pAllocation->SurfDesc.pitch != minPitch) 4014 { 4015 Assert(pAllocation->SurfDesc.pitch > minPitch); 4016 pAllocation->D3DWidth = vboxWddmCalcWidthForPitch(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.format); 4017 Assert(VBOXWDDMDISP_IS_TEXTURE(pRc->RcDesc.fFlags) && !pRc->RcDesc.fFlags.CubeMap); /* <- tested for textures only! */ 4018 } 4019 Assert(pAllocation->D3DWidth >= pAllocation->SurfDesc.width); 4020 } 4021 else 4022 { 4023 Assert(pAllocation->D3DWidth == pAllocation->SurfDesc.width); 4024 } 4025 } 4026 3860 4027 } 3861 4028 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
r43236 r43334 234 234 }; 235 235 D3DDDI_LOCKFLAGS fFlags; 236 D3DLOCKED_RECT LockedRect; 236 union { 237 D3DLOCKED_RECT LockedRect; 238 D3DLOCKED_BOX LockedBox; 239 }; 237 240 #ifdef VBOXWDDMDISP_DEBUG 238 241 PVOID pvData; … … 246 249 VBOXDISP_D3DIFTYPE_TEXTURE, 247 250 VBOXDISP_D3DIFTYPE_CUBE_TEXTURE, 251 VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE, 248 252 VBOXDISP_D3DIFTYPE_VERTEXBUFFER, 249 253 VBOXDISP_D3DIFTYPE_INDEXBUFFER -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp
r42557 r43334 66 66 } 67 67 68 pD3D->pfnVBoxWineExD3DDev9CreateVolumeTexture = (PFNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateVolumeTexture"); 69 if (!pD3D->pfnVBoxWineExD3DDev9CreateVolumeTexture) 70 { 71 WARN(("no VBoxWineExD3DDev9CreateVolumeTexture")); 72 break; 73 } 74 68 75 pD3D->pfnVBoxWineExD3DDev9Flush = (PFNVBOXWINEEXD3DDEV9_FLUSH)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Flush"); 69 76 if (!pD3D->pfnVBoxWineExD3DDev9Flush) 70 77 { 71 78 WARN(("no VBoxWineExD3DDev9Flush")); 79 break; 80 } 81 82 pD3D->pfnVBoxWineExD3DDev9VolBlt = (PFNVBOXWINEEXD3DDEV9_VOLBLT)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9VolBlt"); 83 if (!pD3D->pfnVBoxWineExD3DDev9VolBlt) 84 { 85 WARN(("no VBoxWineExD3DDev9VolBlt")); 86 break; 87 } 88 89 pD3D->pfnVBoxWineExD3DDev9VolTexBlt = (PFNVBOXWINEEXD3DDEV9_VOLTEXBLT)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9VolTexBlt"); 90 if (!pD3D->pfnVBoxWineExD3DDev9VolTexBlt) 91 { 92 WARN(("no VBoxWineExD3DDev9VolTexBlt")); 72 93 break; 73 94 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h
r42557 r43334 59 59 PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE pfnVBoxWineExD3DDev9CreateCubeTexture; 60 60 61 PFNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE pfnVBoxWineExD3DDev9CreateVolumeTexture; 62 61 63 PFNVBOXWINEEXD3DDEV9_FLUSH pfnVBoxWineExD3DDev9Flush; 64 65 PFNVBOXWINEEXD3DDEV9_VOLBLT pfnVBoxWineExD3DDev9VolBlt; 66 67 PFNVBOXWINEEXD3DDEV9_VOLTEXBLT pfnVBoxWineExD3DDev9VolTexBlt; 62 68 63 69 PFNVBOXWINEEXD3DDEV9_UPDATE pfnVBoxWineExD3DDev9Update; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxScreen.cpp
r38112 r43334 17 17 */ 18 18 19 #include "VBoxDispD3DCmn.h" 19 20 #include "VBoxScreen.h" 20 21 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.h
r42499 r43334 20 20 #define ___VBoxUhgsmiKmt_h__ 21 21 22 #include "VBoxUhgsmiBase.h"23 22 #include "VBoxDispD3DCmn.h" 24 23 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9_private.h
r42499 r43334 265 265 266 266 HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height, 267 UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool) DECLSPEC_HIDDEN; 267 UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool 268 #ifdef VBOX_WITH_WDDM 269 , HANDLE *shared_handle 270 , void *pvClientMem 271 #endif 272 ) DECLSPEC_HIDDEN; 268 273 269 274 /* ------------------- */ … … 473 478 474 479 HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice9Impl *device, 475 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; 480 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool 481 #ifdef VBOX_WITH_WDDM 482 , HANDLE *shared_handle 483 , void **pavClientMem 484 #endif 485 ) DECLSPEC_HIDDEN; 476 486 477 487 /* ----------------------- */ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9wddm.def
r42518 r43334 15 15 VBoxWineExD3DDev9CreateTexture 16 16 VBoxWineExD3DDev9CreateCubeTexture 17 VBoxWineExD3DDev9CreateVolumeTexture 17 18 VBoxWineExD3DDev9Update 18 19 VBoxWineExD3DDev9Term 19 20 VBoxWineExD3DSwapchain9Present 21 VBoxWineExD3DDev9VolBlt 22 VBoxWineExD3DDev9VolTexBlt 20 23 VBoxWineExD3DRc9SetShRcState -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c
r42518 r43334 32 32 #include "config.h" 33 33 #include "d3d9_private.h" 34 35 #ifdef VBOX_WITH_WDDM 36 #include <iprt/assert.h> 37 # include "../../common/VBoxVideoTools.h" 38 #endif 34 39 35 40 WINE_DEFAULT_DEBUG_CHANNEL(d3d9); … … 825 830 } 826 831 832 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9CreateVolumeTexture(IDirect3DDevice9Ex *iface, 833 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, 834 D3DPOOL pool, IDirect3DVolumeTexture9 **texture, HANDLE *shared_handle, 835 void **pavClientMem) 836 { 837 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 838 IDirect3DVolumeTexture9Impl *object; 839 HRESULT hr; 840 841 TRACE("iface %p, width %u, height %u, depth %u, levels %u\n", 842 iface, width, height, depth, levels); 843 TRACE("usage %#x, format %#x, pool %#x, texture %p, shared_handle %p.\n", 844 usage, format, pool, texture, shared_handle); 845 846 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 847 if (!object) 848 { 849 ERR("Failed to allocate volume texture memory.\n"); 850 ERR_D3D(); 851 return D3DERR_OUTOFVIDEOMEMORY; 852 } 853 854 hr = volumetexture_init(object, This, width, height, depth, levels, usage, format, pool, shared_handle, pavClientMem); 855 if (FAILED(hr)) 856 { 857 ERR_D3D(); 858 WARN("Failed to initialize volume texture, hr %#x.\n", hr); 859 HeapFree(GetProcessHeap(), 0, object); 860 return hr; 861 } 862 863 TRACE("Created volume texture %p.\n", object); 864 *texture = (IDirect3DVolumeTexture9 *)object; 865 866 return D3D_OK; 867 } 868 869 #ifdef VBOX_WITH_WDDM 870 871 AssertCompile(sizeof (WINED3DBOX) == sizeof (VBOXBOX3D)); 872 AssertCompile(RT_SIZEOFMEMB(WINED3DBOX, Left) == RT_SIZEOFMEMB(VBOXBOX3D, Left)); 873 AssertCompile(RT_SIZEOFMEMB(WINED3DBOX, Top) == RT_SIZEOFMEMB(VBOXBOX3D, Top)); 874 AssertCompile(RT_SIZEOFMEMB(WINED3DBOX, Right) == RT_SIZEOFMEMB(VBOXBOX3D, Right)); 875 AssertCompile(RT_SIZEOFMEMB(WINED3DBOX, Bottom) == RT_SIZEOFMEMB(VBOXBOX3D, Bottom)); 876 AssertCompile(RT_SIZEOFMEMB(WINED3DBOX, Front) == RT_SIZEOFMEMB(VBOXBOX3D, Front)); 877 AssertCompile(RT_SIZEOFMEMB(WINED3DBOX, Back) == RT_SIZEOFMEMB(VBOXBOX3D, Back)); 878 879 AssertCompile(RT_OFFSETOF(WINED3DBOX, Left) == RT_OFFSETOF(VBOXBOX3D, Left)); 880 AssertCompile(RT_OFFSETOF(WINED3DBOX, Top) == RT_OFFSETOF(VBOXBOX3D, Top)); 881 AssertCompile(RT_OFFSETOF(WINED3DBOX, Right) == RT_OFFSETOF(VBOXBOX3D, Right)); 882 AssertCompile(RT_OFFSETOF(WINED3DBOX, Bottom) == RT_OFFSETOF(VBOXBOX3D, Bottom)); 883 AssertCompile(RT_OFFSETOF(WINED3DBOX, Front) == RT_OFFSETOF(VBOXBOX3D, Front)); 884 AssertCompile(RT_OFFSETOF(WINED3DBOX, Back) == RT_OFFSETOF(VBOXBOX3D, Back)); 885 886 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9VolBlt(IDirect3DDevice9Ex *iface, 887 IDirect3DVolume9 *pSourceVolume, IDirect3DVolume9 *pDestinationVolume, 888 const VBOXBOX3D *pSrcBoxArg, 889 const VBOXPOINT3D *pDstPoin3D) 890 { 891 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 892 IDirect3DVolume9Impl *src = (IDirect3DVolume9Impl *)pSourceVolume; 893 IDirect3DVolume9Impl *dst = (IDirect3DVolume9Impl *)pDestinationVolume; 894 HRESULT hr; 895 896 wined3d_mutex_lock(); 897 hr = IWineD3DDevice_VolBlt(This->WineD3DDevice, src->wineD3DVolume, dst->wineD3DVolume, (WINED3DBOX*)pSrcBoxArg, pDstPoin3D); 898 wined3d_mutex_unlock(); 899 900 return hr; 901 } 902 903 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9VolTexBlt(IDirect3DDevice9Ex *iface, 904 IDirect3DVolumeTexture9 *pSourceTexture, IDirect3DVolumeTexture9 *pDestinationTexture, 905 const VBOXBOX3D *pSrcBoxArg, 906 const VBOXPOINT3D *pDstPoin3D) 907 { 908 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 909 IDirect3DVolumeTexture9Impl *src = (IDirect3DVolumeTexture9Impl *)pSourceTexture; 910 IDirect3DVolumeTexture9Impl *dst = (IDirect3DVolumeTexture9Impl *)pDestinationTexture; 911 HRESULT hr; 912 913 wined3d_mutex_lock(); 914 hr = IWineD3DDevice_VolTexBlt(This->WineD3DDevice, src->wineD3DVolumeTexture, dst->wineD3DVolumeTexture, (WINED3DBOX*)pSrcBoxArg, pDstPoin3D); 915 wined3d_mutex_unlock(); 916 917 return hr; 918 } 919 #endif 920 827 921 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Update(IDirect3DDevice9Ex *iface, D3DPRESENT_PARAMETERS * pParams, IDirect3DDevice9Ex **outIface) 828 922 { … … 929 1023 D3DPOOL pool, IDirect3DVolumeTexture9 **texture, HANDLE *shared_handle) 930 1024 { 1025 #ifdef VBOX_WITH_WDDM 1026 return VBoxWineExD3DDev9CreateVolumeTexture(iface, width, height, depth, levels, usage, format, 1027 pool, texture, shared_handle, NULL); 1028 #else 931 1029 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 932 1030 IDirect3DVolumeTexture9Impl *object; … … 959 1057 960 1058 return D3D_OK; 1059 #endif 961 1060 } 962 1061 … … 3066 3165 static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface, 3067 3166 IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format, 3068 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume) 3167 WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume 3168 #ifdef VBOX_WITH_WDDM 3169 , HANDLE *shared_handle 3170 , void *pvClientMem 3171 #endif 3172 ) 3069 3173 { 3070 3174 struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); … … 3084 3188 } 3085 3189 3086 hr = volume_init(object, This, width, height, depth, usage, format, pool); 3190 hr = volume_init(object, This, width, height, depth, usage, format, pool 3191 #ifdef VBOX_WITH_WDDM 3192 , shared_handle, pvClientMem 3193 #endif 3194 ); 3087 3195 if (FAILED(hr)) 3088 3196 { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/volume.c
r33656 r43334 277 277 278 278 HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height, 279 UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool) 279 UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool 280 #ifdef VBOX_WITH_WDDM 281 , HANDLE *shared_handle 282 , void *pvClientMem 283 #endif 284 ) 280 285 { 281 286 HRESULT hr; … … 284 289 volume->ref = 1; 285 290 291 #ifdef VBOX_WITH_WDDM 292 hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, 293 format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d9_volume_wined3d_parent_ops, 294 shared_handle, pvClientMem); 295 #else 286 296 hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, 287 297 format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d9_volume_wined3d_parent_ops); 298 #endif 288 299 if (FAILED(hr)) 289 300 { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/volumetexture.c
r33656 r43334 434 434 435 435 HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice9Impl *device, 436 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) 436 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool 437 #ifdef VBOX_WITH_WDDM 438 , HANDLE *shared_handle 439 , void **pavClientMem 440 #endif 441 ) 437 442 { 438 443 HRESULT hr; … … 442 447 443 448 wined3d_mutex_lock(); 449 #ifdef VBOX_WITH_WDDM 450 hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, 451 usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, 452 &texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d9_volumetexture_wined3d_parent_ops 453 , shared_handle, pavClientMem); 454 #else 444 455 hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, 445 456 usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, 446 457 &texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d9_volumetexture_wined3d_parent_ops); 458 #endif 447 459 wined3d_mutex_unlock(); 448 460 if (FAILED(hr)) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h
r42518 r43334 25 25 } VBOXWINEEX_SHRC_STATE; 26 26 27 27 28 #ifndef IN_VBOXLIBWINE 28 29 … … 46 47 void **pavClientMem); 47 48 typedef FNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE *PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE; 49 50 typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE(IDirect3DDevice9Ex *iface, 51 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT Format, D3DPOOL Pool, 52 IDirect3DVolumeTexture9 **ppVolumeTexture, HANDLE *pSharedHandle, 53 void **pavClientMem); 54 typedef FNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE *PFNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE; 55 56 typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_VOLBLT(IDirect3DDevice9Ex *iface, 57 IDirect3DVolume9 *pSourceVolume, IDirect3DVolume9 *pDestinationVolume, 58 const struct VBOXBOX3D *pSrcBoxArg, 59 const struct VBOXPOINT3D *pDstPoin3D); 60 typedef FNVBOXWINEEXD3DDEV9_VOLBLT *PFNVBOXWINEEXD3DDEV9_VOLBLT; 61 62 typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_VOLTEXBLT(IDirect3DDevice9Ex *iface, 63 IDirect3DVolumeTexture9 *pSourceTexture, IDirect3DVolumeTexture9 *pDestinationTexture, 64 const struct VBOXBOX3D *pSrcBoxArg, 65 const struct VBOXPOINT3D *pDstPoin3D); 66 typedef FNVBOXWINEEXD3DDEV9_VOLTEXBLT *PFNVBOXWINEEXD3DDEV9_VOLTEXBLT; 48 67 49 68 typedef VBOXWINEEX_DECL(HRESULT) FNVBOXWINEEXD3DDEV9_FLUSH(IDirect3DDevice9Ex *iface); … … 78 97 * applicable ONLY for SYSMEM textures */ 79 98 99 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9CreateVolumeTexture(IDirect3DDevice9Ex *iface, 100 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT Format, D3DPOOL Pool, 101 IDirect3DVolumeTexture9 **ppVolumeTexture, HANDLE *pSharedHandle, 102 void **pavClientMem); 103 104 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9VolBlt(IDirect3DDevice9Ex *iface, 105 IDirect3DVolume9 *pSourceVolume, IDirect3DVolume9 *pDestinationVolume, 106 const struct VBOXBOX3D *pSrcBoxArg, 107 const struct VBOXPOINT3D *pDstPoin3D); 108 109 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9VolTexBlt(IDirect3DDevice9Ex *iface, 110 IDirect3DVolumeTexture9 *pSourceTexture, IDirect3DVolumeTexture9 *pDestinationTexture, 111 const struct VBOXBOX3D *pSrcBoxArg, 112 const struct VBOXPOINT3D *pDstPoin3D); 113 80 114 VBOXWINEEX_DECL(HRESULT) VBoxWineExD3DDev9Flush(IDirect3DDevice9Ex *iface); /* perform glFlush */ 81 115 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h
r42499 r43334 2679 2679 WINED3DPOOL pool, 2680 2680 DWORD usage, 2681 IWineD3DVolume **volume) = 0; 2681 IWineD3DVolume **volume 2682 #ifdef VBOX_WITH_WDDM 2683 , HANDLE *shared_handle 2684 , void *pvClientMem 2685 #endif 2686 ) = 0; 2682 2687 2683 2688 virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( … … 2755 2760 WINED3DPOOL pool, 2756 2761 DWORD usage, 2757 IWineD3DVolume **volume); 2762 IWineD3DVolume **volume 2763 #ifdef VBOX_WITH_WDDM 2764 , HANDLE *shared_handle 2765 , void *pvClientMem 2766 #endif 2767 ); 2758 2768 2759 2769 HRESULT (STDMETHODCALLTYPE *CreateSwapChain)( … … 2782 2792 #define IWineD3DDeviceParent_CreateRenderTarget(This,superior,width,height,format,multisample_type,multisample_quality,lockable,surface) (This)->lpVtbl->CreateRenderTarget(This,superior,width,height,format,multisample_type,multisample_quality,lockable,surface) 2783 2793 #define IWineD3DDeviceParent_CreateDepthStencilSurface(This,superior,width,height,format,multisample_type,multisample_quality,discard,surface) (This)->lpVtbl->CreateDepthStencilSurface(This,superior,width,height,format,multisample_type,multisample_quality,discard,surface) 2794 #ifdef VBOX_WITH_WDDM 2795 #define IWineD3DDeviceParent_CreateVolume(This,superior,width,height,depth,format,pool,usage,volume,shared_handle,pvClientMem) (This)->lpVtbl->CreateVolume(This,superior,width,height,depth,format,pool,usage,volume,shared_handle,pvClientMem) 2796 #else 2784 2797 #define IWineD3DDeviceParent_CreateVolume(This,superior,width,height,depth,format,pool,usage,volume) (This)->lpVtbl->CreateVolume(This,superior,width,height,depth,format,pool,usage,volume) 2798 #endif 2785 2799 #define IWineD3DDeviceParent_CreateSwapChain(This,present_parameters,swapchain) (This)->lpVtbl->CreateSwapChain(This,present_parameters,swapchain) 2786 2800 #endif … … 6874 6888 IWineD3DVolumeTexture **texture, 6875 6889 IUnknown *parent, 6876 const struct wined3d_parent_ops *parent_ops) = 0; 6890 const struct wined3d_parent_ops *parent_ops 6891 #ifdef VBOX_WITH_WDDM 6892 , HANDLE *shared_handle 6893 , void *pavClientMem 6894 #endif 6895 ) = 0; 6877 6896 6878 6897 virtual HRESULT STDMETHODCALLTYPE CreateVolume( … … 6885 6904 IWineD3DVolume **volume, 6886 6905 IUnknown *parent, 6887 const struct wined3d_parent_ops *parent_ops) = 0; 6906 const struct wined3d_parent_ops *parent_ops 6907 #ifdef VBOX_WITH_WDDM 6908 , HANDLE *shared_handle 6909 , void *pvClientMem 6910 #endif 6911 ) = 0; 6888 6912 6889 6913 virtual HRESULT STDMETHODCALLTYPE CreateCubeTexture( … … 7417 7441 virtual HRESULT STDMETHODCALLTYPE Flush( 7418 7442 ) = 0; 7443 7444 virtual HRESULT STDMETHODCALLTYPE VolBlt(IWineD3DDevice *iface, 7445 IWineD3DVolume *pSourceVolume, IWineD3DVolume *pDestinationVolume, 7446 const WINED3DBOX *pSrcBoxArg, 7447 const VBOXPOINT3D *pDstPoin3D 7448 ) = 0; 7449 7450 virtual HRESULT STDMETHODCALLTYPE VolTexBlt(IWineD3DDevice *iface, 7451 IWineD3DVolumeTexture *pSourceTexture, IWineD3DVolumeTexture *pDestinationTexture, 7452 const WINED3DBOX *pSrcBoxArg, 7453 const VBOXPOINT3D *pDstPoin3D 7454 ) = 0; 7419 7455 #endif 7420 7456 }; … … 7529 7565 IWineD3DVolumeTexture **texture, 7530 7566 IUnknown *parent, 7531 const struct wined3d_parent_ops *parent_ops); 7567 const struct wined3d_parent_ops *parent_ops 7568 #ifdef VBOX_WITH_WDDM 7569 , HANDLE *shared_handle 7570 , void **pavClientMem 7571 #endif 7572 ); 7532 7573 7533 7574 HRESULT (STDMETHODCALLTYPE *CreateVolume)( … … 7541 7582 IWineD3DVolume **volume, 7542 7583 IUnknown *parent, 7543 const struct wined3d_parent_ops *parent_ops); 7584 const struct wined3d_parent_ops *parent_ops 7585 #ifdef VBOX_WITH_WDDM 7586 , HANDLE *shared_handle 7587 , void *pvClientMem 7588 #endif 7589 ); 7544 7590 7545 7591 HRESULT (STDMETHODCALLTYPE *CreateCubeTexture)( … … 8194 8240 HRESULT (STDMETHODCALLTYPE *Flush)( 8195 8241 IWineD3DDevice* This); 8242 8243 HRESULT (STDMETHODCALLTYPE *VolBlt)(IWineD3DDevice *iface, 8244 IWineD3DVolume *pSourceVolume, IWineD3DVolume *pDestinationVolume, 8245 const WINED3DBOX *pSrcBoxArg, 8246 const struct VBOXPOINT3D *pDstPoin3D 8247 ); 8248 8249 HRESULT (STDMETHODCALLTYPE *VolTexBlt)(IWineD3DDevice *iface, 8250 IWineD3DVolumeTexture *pSourceTexture, IWineD3DVolumeTexture *pDestinationTexture, 8251 const WINED3DBOX *pSrcBoxArg, 8252 const struct VBOXPOINT3D *pDstPoin3D 8253 ); 8196 8254 #endif 8197 8255 … … 8225 8283 #define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops) 8226 8284 #endif 8285 #ifdef VBOX_WITH_WDDM 8286 #define IWineD3DDevice_CreateVolumeTexture(This,width,height,depth,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem) (This)->lpVtbl->CreateVolumeTexture(This,width,height,depth,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem) 8287 #else 8227 8288 #define IWineD3DDevice_CreateVolumeTexture(This,width,height,depth,levels,usage,format,pool,texture,parent,parent_ops) (This)->lpVtbl->CreateVolumeTexture(This,width,height,depth,levels,usage,format,pool,texture,parent,parent_ops) 8289 #endif 8290 #ifdef VBOX_WITH_WDDM 8291 #define IWineD3DDevice_CreateVolume(This,width,height,depth,usage,format,pool,volume,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateVolume(This,width,height,depth,usage,format,pool,volume,parent,parent_ops,shared_handle,pvClientMem) 8292 #else 8228 8293 #define IWineD3DDevice_CreateVolume(This,width,height,depth,usage,format,pool,volume,parent,parent_ops) (This)->lpVtbl->CreateVolume(This,width,height,depth,usage,format,pool,volume,parent,parent_ops) 8294 #endif 8229 8295 #ifdef VBOX_WITH_WDDM 8230 8296 #define IWineD3DDevice_CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem) (This)->lpVtbl->CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem) … … 8359 8425 #ifdef VBOX_WITH_WDDM 8360 8426 #define IWineD3DDevice_Flush(This) (This)->lpVtbl->Flush(This) 8427 #define IWineD3DDevice_VolBlt(This, pSourceVolume, pDestinationVolume, pSrcBoxArg, pDstPoin3D) (This)->lpVtbl->VolBlt(This, pSourceVolume, pDestinationVolume, pSrcBoxArg, pDstPoin3D) 8428 #define IWineD3DDevice_VolTexBlt(This, pSourceTexture, pDestinationTexture, pSrcBoxArg, pDstPoin3D) (This)->lpVtbl->VolTexBlt(This, pSourceTexture, pDestinationTexture, pSrcBoxArg, pDstPoin3D) 8361 8429 #endif 8362 8430 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r42971 r43334 42 42 #endif 43 43 #include "wined3d_private.h" 44 #ifdef VBOX_WITH_WDDM 45 /* a hacky way to treat WINED3DBOX as D3DBOX */ 46 # define D3DBOX WINED3DBOX 47 # include "../../common/VBoxVideoTools.h" 48 # undef D3DBOX 49 #endif 44 50 45 51 WINE_DEFAULT_DEBUG_CHANNEL(d3d); … … 924 930 static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface, 925 931 UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool, 926 IWineD3DVolumeTexture **ppVolumeTexture, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) 932 IWineD3DVolumeTexture **ppVolumeTexture, IUnknown *parent, const struct wined3d_parent_ops *parent_ops 933 #ifdef VBOX_WITH_WDDM 934 , HANDLE *shared_handle 935 , void **pavClientMem 936 #endif 937 ) 927 938 { 928 939 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; … … 941 952 } 942 953 943 hr = volumetexture_init(object, Width, Height, Depth, Levels, This, Usage, Format, Pool, parent, parent_ops); 954 hr = volumetexture_init(object, Width, Height, Depth, Levels, This, Usage, Format, Pool, parent, parent_ops 955 #ifdef VBOX_WITH_WDDM 956 , shared_handle 957 , pavClientMem 958 #endif 959 ); 944 960 if (FAILED(hr)) 945 961 { … … 958 974 static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height, 959 975 UINT Depth, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool, IWineD3DVolume **ppVolume, 960 IUnknown *parent, const struct wined3d_parent_ops *parent_ops) 976 IUnknown *parent, const struct wined3d_parent_ops *parent_ops 977 #ifdef VBOX_WITH_WDDM 978 , HANDLE *shared_handle 979 , void *pvClientMem 980 #endif 981 ) 961 982 { 962 983 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; … … 975 996 } 976 997 977 hr = volume_init(object, This, Width, Height, Depth, Usage, Format, Pool, parent, parent_ops); 998 hr = volume_init(object, This, Width, Height, Depth, Usage, Format, Pool, parent, parent_ops 999 #ifdef VBOX_WITH_WDDM 1000 , shared_handle 1001 , pvClientMem 1002 #endif 1003 ); 978 1004 if (FAILED(hr)) 979 1005 { … … 4938 4964 return hr; 4939 4965 } 4966 4967 #ifdef VBOX_WITH_WDDM 4968 static HRESULT WINAPI IWineD3DDeviceImpl_VolBlt(IWineD3DDevice *iface, 4969 IWineD3DVolume *pSourceVolume, IWineD3DVolume *pDestinationVolume, 4970 const WINED3DBOX *pSrcBoxArg, 4971 const VBOXPOINT3D *pDstPoin3D 4972 ) 4973 { 4974 WINED3DLOCKED_BOX src; 4975 WINED3DLOCKED_BOX dst; 4976 HRESULT hr; 4977 WINED3DBOX DstBox, SrcBox; 4978 const WINED3DBOX *pDstBox; 4979 const WINED3DBOX *pSrcBox; 4980 int dstW, dstH, dstD, srcW, srcH, srcD; 4981 int j, k; 4982 uint8_t * pDstBits; 4983 uint8_t * pSrcBits; 4984 4985 4986 TRACE("iface %p, src_volume %p, dst_volume %p.\n", 4987 iface, pSourceVolume, pDestinationVolume); 4988 4989 pSrcBox = pSrcBoxArg; 4990 if (!pSrcBox) 4991 { 4992 IWineD3DVolumeImpl *pSrvVolImpl = (IWineD3DVolumeImpl*)pSourceVolume; 4993 SrcBox.Left = 0; 4994 SrcBox.Top = 0; 4995 SrcBox.Front = 0; 4996 SrcBox.Right = pSrvVolImpl->currentDesc.Width; 4997 SrcBox.Bottom = pSrvVolImpl->currentDesc.Height; 4998 SrcBox.Back = pSrvVolImpl->currentDesc.Depth; 4999 pSrcBox = &SrcBox; 5000 } 5001 5002 if (!pDstPoin3D) 5003 pDstBox = pSrcBox; 5004 else 5005 { 5006 vboxWddmBoxTranslated(&DstBox, pSrcBox, pDstPoin3D->x, pDstPoin3D->y, pDstPoin3D->z); 5007 pDstBox = &DstBox; 5008 } 5009 5010 dstW = pDstBox->Right - pDstBox->Left; 5011 dstH = pDstBox->Bottom - pDstBox->Top; 5012 dstD = pDstBox->Back - pDstBox->Front; 5013 5014 srcW = pSrcBox->Right - pSrcBox->Left; 5015 srcH = pSrcBox->Bottom - pSrcBox->Top; 5016 srcD = pSrcBox->Back - pSrcBox->Front; 5017 5018 if (srcW != dstW || srcH != dstH || srcD != dstD) 5019 { 5020 ERR("dimensions do not match, stretching not supported for volumes!"); 5021 return WINED3DERR_INVALIDCALL; 5022 } 5023 5024 /* TODO: Implement direct loading into the gl volume instead of using memcpy and 5025 * dirtification to improve loading performance. 5026 */ 5027 hr = IWineD3DVolume_LockBox(pSourceVolume, &src, pSrcBox, WINED3DLOCK_READONLY); 5028 if(FAILED(hr)) return hr; 5029 hr = IWineD3DVolume_LockBox(pDestinationVolume, &dst, pDstBox, WINED3DLOCK_DISCARD); 5030 if(FAILED(hr)) { 5031 IWineD3DVolume_UnlockBox(pSourceVolume); 5032 return hr; 5033 } 5034 5035 pDstBits = dst.pBits; 5036 pSrcBits = src.pBits; 5037 for (k = 0; k < srcD; ++k) 5038 { 5039 uint8_t * pRowDstBits = pDstBits; 5040 uint8_t * pRowSrcBits = pSrcBits; 5041 5042 for (j = 0; j < srcH; ++j) 5043 { 5044 memcpy(pRowDstBits, pRowSrcBits, srcW * ((IWineD3DVolumeImpl *) pDestinationVolume)->resource.format_desc->byte_count); 5045 pRowDstBits += dst.RowPitch; 5046 pRowSrcBits += src.RowPitch; 5047 } 5048 pDstBits += dst.SlicePitch; 5049 pSrcBits += src.SlicePitch; 5050 } 5051 5052 hr = IWineD3DVolume_UnlockBox(pDestinationVolume); 5053 if(FAILED(hr)) { 5054 IWineD3DVolume_UnlockBox(pSourceVolume); 5055 } else { 5056 hr = IWineD3DVolume_UnlockBox(pSourceVolume); 5057 } 5058 return hr; 5059 } 5060 5061 static HRESULT WINAPI IWineD3DDeviceImpl_VolTexBlt(IWineD3DDevice *iface, 5062 IWineD3DVolumeTexture *pSourceTexture, IWineD3DVolumeTexture *pDestinationTexture, 5063 const WINED3DBOX *pSrcBoxArg, 5064 const VBOXPOINT3D *pDstPoin3D 5065 ) 5066 { 5067 unsigned int level_count, i; 5068 IWineD3DVolume *src_volume; 5069 IWineD3DVolume *dst_volume; 5070 HRESULT hr = S_OK; 5071 5072 level_count = IWineD3DBaseTexture_GetLevelCount(pSourceTexture); 5073 if (IWineD3DBaseTexture_GetLevelCount(pDestinationTexture) != level_count) 5074 { 5075 ERR("Source and destination have different level counts, returning WINED3DERR_INVALIDCALL.\n"); 5076 return WINED3DERR_INVALIDCALL; 5077 } 5078 5079 for (i = 0; i < level_count; ++i) 5080 { 5081 WINED3DBOX SrcBox, *pSrcBox; 5082 VBOXPOINT3D DstPoint, *pDstPoint; 5083 5084 if (pSrcBoxArg) 5085 { 5086 vboxWddmBoxDivided(&SrcBox, pSrcBoxArg, i + 1, true); 5087 pSrcBox = &SrcBox; 5088 } 5089 else 5090 { 5091 pSrcBox = NULL; 5092 } 5093 5094 if (pDstPoin3D) 5095 { 5096 vboxWddmPoint3DDivided(&DstPoint, pDstPoin3D, i + 1, true); 5097 pDstPoint = &DstPoint; 5098 } 5099 else 5100 { 5101 pDstPoint = NULL; 5102 } 5103 5104 IWineD3DVolumeTexture_GetVolumeLevel(pSourceTexture, i, &src_volume); 5105 IWineD3DVolumeTexture_GetVolumeLevel(pDestinationTexture, i, &dst_volume); 5106 hr = IWineD3DDeviceImpl_VolBlt(iface, src_volume, dst_volume, pSrcBox, pDstPoint); 5107 IWineD3DVolume_Release(dst_volume); 5108 IWineD3DVolume_Release(src_volume); 5109 if (FAILED(hr)) 5110 { 5111 ERR("IWineD3DDeviceImpl_UpdateVolume failed, hr %#x.\n", hr); 5112 return hr; 5113 } 5114 } 5115 5116 return hr; 5117 } 5118 #endif 4940 5119 4941 5120 static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, … … 7293 7472 /* VBox WDDM extensions */ 7294 7473 IWineD3DDeviceImpl_Flush, 7474 IWineD3DDeviceImpl_VolBlt, 7475 IWineD3DDeviceImpl_VolTexBlt, 7295 7476 #endif 7296 7477 }; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/volume.c
r40388 r43334 251 251 This->lockedBox.Back = This->currentDesc.Depth; 252 252 } else { 253 #ifdef VBOX_WITH_WDDM 254 if (pBox->Right <= pBox->Left 255 || pBox->Right > This->currentDesc.Width 256 || pBox->Bottom <= pBox->Top 257 || pBox->Bottom > This->currentDesc.Height 258 || pBox->Back <= pBox->Front 259 || pBox->Back > This->currentDesc.Depth 260 ) 261 { 262 ERR("invalid dimensions!"); 263 return WINED3DERR_INVALIDCALL; 264 } 265 #endif 253 266 TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back); 254 267 pLockedVolume->pBits = This->resource.allocatedMemory … … 396 409 HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, 397 410 UINT height, UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, 398 IUnknown *parent, const struct wined3d_parent_ops *parent_ops) 411 IUnknown *parent, const struct wined3d_parent_ops *parent_ops 412 #ifdef VBOX_WITH_WDDM 413 , HANDLE *shared_handle 414 , void *pvClientMem 415 #endif 416 ) 399 417 { 400 418 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; … … 413 431 width * height * depth * format_desc->byte_count, usage, format_desc, pool, parent, parent_ops 414 432 #ifdef VBOX_WITH_WDDM 415 , NULL, NULL433 , shared_handle, pvClientMem 416 434 #endif 417 435 ); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/volumetexture.c
r40388 r43334 365 365 HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, 366 366 UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format, 367 WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) 367 WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops 368 #ifdef VBOX_WITH_WDDM 369 , HANDLE *shared_handle 370 , void **pavClientMem 371 #endif 372 ) 368 373 { 369 374 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; … … 373 378 HRESULT hr; 374 379 380 #ifdef VBOX_WITH_WDDM 381 if (shared_handle) 382 { 383 ERR("shared handle support for volume textures not impemented yet, ignoring!"); 384 } 385 #endif 386 375 387 /* TODO: It should only be possible to create textures for formats 376 388 * that are reported as supported. */ … … 415 427 device, 0, usage, format_desc, pool, parent, parent_ops 416 428 #ifdef VBOX_WITH_WDDM 417 , NULL, NULL429 , shared_handle, pavClientMem 418 430 #endif 419 431 ); … … 438 450 { 439 451 /* Create the volume. */ 452 #ifdef VBOX_WITH_WDDM 453 hr = IWineD3DDeviceParent_CreateVolume(device->device_parent, parent, 454 tmp_w, tmp_h, tmp_d, format, pool, usage, &texture->volumes[i] 455 , shared_handle, pavClientMem ? pavClientMem[i] : NULL); 456 #else 440 457 hr = IWineD3DDeviceParent_CreateVolume(device->device_parent, parent, 441 458 tmp_w, tmp_h, tmp_d, format, pool, usage, &texture->volumes[i]); 459 #endif 442 460 if (FAILED(hr)) 443 461 { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r42499 r43334 2119 2119 HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, 2120 2120 UINT height, UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool, 2121 IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; 2121 IUnknown *parent, const struct wined3d_parent_ops *parent_ops 2122 #ifdef VBOX_WITH_WDDM 2123 , HANDLE *shared_handle 2124 , void *pvClientMem 2125 #endif 2126 ) DECLSPEC_HIDDEN; 2122 2127 2123 2128 /***************************************************************************** … … 2137 2142 HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, 2138 2143 UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, WINED3DFORMAT format, 2139 WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; 2144 WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops 2145 #ifdef VBOX_WITH_WDDM 2146 , HANDLE *shared_handle 2147 , void **pavClientMem 2148 #endif 2149 ) DECLSPEC_HIDDEN; 2140 2150 2141 2151 typedef struct _WINED3DSURFACET_DESC
Note:
See TracChangeset
for help on using the changeset viewer.