VirtualBox

Ignore:
Timestamp:
Jan 20, 2011 2:07:59 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: cube texture support fixes + some cleanup & refactoring

Location:
trunk/src/VBox/Additions/WINNT/Graphics
Files:
4 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/Makefile.kmk

    r35501 r35650  
    9898        wddm/VBoxScreen.cpp \
    9999        wddm/VBoxDispMpTst.cpp \
     100        wddm/VBoxDispKmt.cpp \
     101        wddm/VBoxDispDbg.cpp \
    100102        wddm/VBoxDispD3D.rc \
    101103        wddm/VBoxDispD3D.def
     
    132134VBoxCrHgsmi_SOURCES     = \
    133135        wddm/VBoxCrHgsmi.cpp \
     136        wddm/VBoxDispKmt.cpp \
     137        wddm/VBoxDispDbg.cpp \
    134138        wddm/VBoxUhgsmiKmt.cpp
    135139VBoxCrHgsmi_SDKS        = WINDDKWLH
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxCrHgsmi.cpp

    r35127 r35650  
    230230VBOXCRHGSMI_DECL(void) VBoxCrHgsmiLog(char * szString)
    231231{
    232     VBOXDISPKMT_ADAPTER Adapter;
    233     HRESULT hr = vboxDispKmtOpenAdapter(&g_VBoxCrHgsmiKmtCallbacks, &Adapter);
    234     Assert(hr == S_OK);
    235     if (hr == S_OK)
    236     {
    237         uint32_t cbString = (uint32_t)strlen(szString) + 1;
    238         uint32_t cbCmd = RT_OFFSETOF(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[cbString]);
    239         PVBOXDISPIFESCAPE_DBGPRINT pCmd = (PVBOXDISPIFESCAPE_DBGPRINT)RTMemAllocZ(cbCmd);
    240         Assert(pCmd);
    241         if (pCmd)
    242         {
    243             pCmd->EscapeHdr.escapeCode = VBOXESC_DBGPRINT;
    244             memcpy(pCmd->aStringBuf, szString, cbString);
    245 
    246             D3DKMT_ESCAPE EscapeData = {0};
    247             EscapeData.hAdapter = Adapter.hAdapter;
    248             //EscapeData.hDevice = NULL;
    249             EscapeData.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;
    250     //        EscapeData.Flags.HardwareAccess = 1;
    251             EscapeData.pPrivateDriverData = pCmd;
    252             EscapeData.PrivateDriverDataSize = cbCmd;
    253             //EscapeData.hContext = NULL;
    254 
    255             int Status = g_VBoxCrHgsmiKmtCallbacks.pfnD3DKMTEscape(&EscapeData);
    256             Assert(!Status);
    257 
    258             RTMemFree(pCmd);
    259         }
    260         hr = vboxDispKmtCloseAdapter(&Adapter);
    261         Assert(hr == S_OK);
    262     }
    263 }
    264 
    265 ///* to be used by injection thread and by ogl ICD driver for hgsmi initialization*/
    266 //VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCustomCreate(PVBOXUHGSMI *ppHgsmi)
    267 //{
    268 //    PVBOXUHGSMI_PRIVATE_KMT pHgsmi = RTMemAllocZ(sizeof (*pHgsmi));
    269 //    if (pHgsmi)
    270 //    {
    271 //        HRESULT hr = vboxUhgsmiKmtCreate(pHgsmi, FALSE);
    272 //        Assert(hr == S_OK);
    273 //        if (hr == S_OK)
    274 //        {
    275 //            *ppHgsmi = &pHgsmi->BasePrivate.Base;
    276 //            return VINF_SUCCESS;
    277 //        }
    278 //        RTMemFree(pHgsmi);
    279 //        return VERR_GENERAL_FAILURE;
    280 //    }
    281 //    return VERR_NO_MEMORY;
    282 //}
    283 //
    284 //VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCustomDestroy(PVBOXUHGSMI pHgsmi)
    285 //{
    286 //    PVBOXUHGSMI_PRIVATE_KMT pHgsmiKmt = VBOXUHGSMIKMT_GET(pHgsmi);
    287 //    HRESULT hr = vboxUhgsmiKmtDestroy(pHgsmiKmt, FALSE);
    288 //    Assert(hr == S_OK);
    289 //    if (hr == S_OK)
    290 //    {
    291 //        RTMemFree(pHgsmiKmt);
    292 //        return VINF_SUCCESS;
    293 //    }
    294 //    return VERR_GENERAL_FAILURE;
    295 //}
    296 
     232    vboxVDbgPrint(("%s", szString));
     233}
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp

    r35319 r35650  
    7070            double cps = g_VBoxDispFpsDDI.GetCps(); \
    7171            double tup = g_VBoxDispFpsDDI.GetTimeProcPercent(); \
    72             VBOXDISPPROFILE_DUMP((_pDev, "fps: %f, cps: %.1f, host %.1f%%\n", fps, cps, tup)); \
     72            VBOXDISPPROFILE_DUMP(("fps: %f, cps: %.1f, host %.1f%%\n", fps, cps, tup)); \
    7373        } \
    7474    } while (0)
     
    104104HRESULT vboxDispMpTstStop();
    105105#endif
    106 
    107 #ifdef VBOXWDDMDISP_DEBUG_PRINT
    108 # include <stdio.h>
    109 #endif
    110 
    111 #define VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc) (((pRc)->cAllocations)/6)
    112 #define VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, idx) ((D3DCUBEMAP_FACES)(D3DCUBEMAP_FACE_POSITIVE_X+(idx)/VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc)))
    113 #define VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, idx) ((idx)%VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc))
    114106
    115107#define VBOXDISP_WITH_WINE_BB_WORKAROUND
     
    15961588}
    15971589
    1598 /* on success increments the surface ref counter,
    1599  * i.e. one must call pSurf->Release() once the surface is not needed*/
    1600 static HRESULT vboxWddmSurfGet(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, IDirect3DSurface9 **ppSurf)
    1601 {
    1602     HRESULT hr = S_OK;
    1603     Assert(pRc->cAllocations > iAlloc);
    1604     switch (pRc->aAllocations[0].enmD3DIfType)
    1605     {
    1606         case VBOXDISP_D3DIFTYPE_SURFACE:
    1607         {
    1608             IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pRc->aAllocations[iAlloc].pD3DIf;
    1609             Assert(pD3DIfSurf);
    1610             pD3DIfSurf->AddRef();
    1611             *ppSurf = pD3DIfSurf;
    1612             break;
    1613         }
    1614         case VBOXDISP_D3DIFTYPE_TEXTURE:
    1615         {
    1616             Assert(pRc->cAllocations == 1); /* <- vboxWddmSurfGet is typically used in Blt & ColorFill functions
    1617                                              * in this case, if texture is used as a destination,
    1618                                              * we should update sub-layers as well which is not done currently
    1619                                              * so for now check vboxWddmSurfGet is used for one-level textures */
    1620             IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf;
    1621             IDirect3DSurface9 *pSurfaceLevel;
    1622             Assert(pD3DIfTex);
    1623             hr = pD3DIfTex->GetSurfaceLevel(iAlloc, &pSurfaceLevel);
    1624             Assert(hr == S_OK);
    1625             if (hr == S_OK)
    1626             {
    1627                 *ppSurf = pSurfaceLevel;
    1628             }
    1629             break;
    1630         }
    1631         case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE:
    1632         {
    1633             Assert(0);
    1634             IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf;
    1635             IDirect3DSurface9 *pSurfaceLevel;
    1636             Assert(pD3DIfCubeTex);
    1637             hr = pD3DIfCubeTex->GetCubeMapSurface(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, iAlloc),
    1638                                                   VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, iAlloc), &pSurfaceLevel);
    1639             Assert(hr == S_OK);
    1640             if (hr == S_OK)
    1641             {
    1642                 *ppSurf = pSurfaceLevel;
    1643             }
    1644             break;
    1645         }
    1646         default:
    1647             Assert(0);
    1648             hr = E_FAIL;
    1649             break;
    1650     }
    1651     return hr;
    1652 }
    16531590
    16541591/******/
     
    18251762}
    18261763
    1827 DECLINLINE(UINT) vboxWddmSwapchainIdxFb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
    1828 {
    1829     return (pSwapchain->iBB + pSwapchain->cRTs - 1) % pSwapchain->cRTs;
    1830 }
    1831 
    1832 /* if swapchain contains only one surface returns this surface */
    1833 DECLINLINE(PVBOXWDDMDISP_RENDERTGT) vboxWddmSwapchainGetBb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
    1834 {
    1835     if (pSwapchain->cRTs)
    1836     {
    1837         Assert(pSwapchain->iBB < pSwapchain->cRTs);
    1838         return &pSwapchain->aRTs[pSwapchain->iBB];
    1839     }
    1840     return NULL;
    1841 }
    1842 
    1843 DECLINLINE(PVBOXWDDMDISP_RENDERTGT) vboxWddmSwapchainGetFb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
    1844 {
    1845     if (pSwapchain->cRTs)
    1846     {
    1847         UINT iFb = vboxWddmSwapchainIdxFb(pSwapchain);
    1848         return &pSwapchain->aRTs[iFb];
    1849     }
    1850     return NULL;
    1851 }
    1852 
    18531764DECLINLINE(VOID) vboxWddmSwapchainFlip(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
    18541765{
     
    18891800    Assert(iRt < pSwapchain->cRTs);
    18901801    return iRt;
    1891 }
    1892 
    1893 DECLINLINE(PVBOXWDDMDISP_SWAPCHAIN) vboxWddmSwapchainForAlloc(PVBOXWDDMDISP_ALLOCATION pAlloc)
    1894 {
    1895     return pAlloc->pSwapchain;
    18961802}
    18971803
     
    34133319        {
    34143320            pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf;
    3415 #ifdef DEBUG_misha
    3416             /* this proved to be the easiest way of detecting blit issues with WinDbg
    3417              * this is why I'd keep this test here to be able to switch it on at runtime any time needed */
    3418             static bool bDo = false;
    3419 
    3420             if (bDo)
    3421             {
    3422                 vboxVDbgDoDumpSurfData("SetTexture:\n", pRc, 0 /* alloc index*/, NULL, NULL, "\n");
    3423             }
    3424 #endif
     3321
     3322            VBOXVDBG_DUMP_SETTEXTURE(pRc);
    34253323        }
    34263324        else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE)
    34273325        {
    34283326            pD3DIfTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf;
     3327
     3328            VBOXVDBG_DUMP_SETTEXTURE(pRc);
    34293329        }
    34303330        else
     
    35543454    HRESULT hr = S_OK;
    35553455
    3556 //#ifdef DEBUG_misha
    3557 //    uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    3558 //    vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    3559 //            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    3560 //#endif
     3456    VBOXVDBG_DUMP_DRAWPRIM_ENTER(pDevice9If);
    35613457
    35623458    if (!pDevice->cStreamSources)
     
    38213717    }
    38223718
    3823 //#ifdef DEBUG_misha
    3824 //    iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    3825 //    vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    3826 //            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    3827 //#endif
     3719    VBOXVDBG_DUMP_DRAWPRIM_LEAVE(pDevice9If);
    38283720
    38293721    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
     
    38403732
    38413733    IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice);
    3842 //#ifdef DEBUG_misha
    3843 //    uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    3844 //    vboxVDbgDumpSurfData((pDevice, ">>>DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    3845 //            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    3846 //#endif
     3734    VBOXVDBG_DUMP_DRAWPRIM_ENTER(pDevice9If);
    38473735
    38483736#ifdef DEBUG
     
    38783766    Assert(hr == S_OK);
    38793767
    3880 //#ifdef DEBUG_misha
    3881 //    iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    3882 //    vboxVDbgDumpSurfData((pDevice, "<<<DrawIndexedPrimitive:\n", pDevice->pRenderTargetRc, iBackBuf,
    3883 //            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    3884 //#endif
    3885 
     3768    VBOXVDBG_DUMP_DRAWPRIM_LEAVE(pDevice9If);
    38863769
    38873770    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
     
    39533836    hr = pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount);
    39543837#else
    3955 //#ifdef DEBUG_misha
    3956 //    uint32_t iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    3957 //    vboxVDbgDumpSurfData((pDevice, ">>>DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,
    3958 //            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    3959 //#endif
     3838    VBOXVDBG_DUMP_DRAWPRIM_ENTER(pDevice9If);
    39603839
    39613840#ifdef DEBUG
     
    40033882#endif
    40043883
    4005 //#ifdef DEBUG_misha
    4006 //    iBackBuf = (pDevice->iRenderTargetFrontBuf + 1) % pDevice->pRenderTargetRc->cAllocations;
    4007 //    vboxVDbgDumpSurfData((pDevice, "<<<DrawPrimitive2:\n", pDevice->pRenderTargetRc, iBackBuf,
    4008 //            NULL, (IDirect3DSurface9*)pDevice->pRenderTargetRc->aAllocations[iBackBuf].pD3DIf, "\n"));
    4009 //#endif
     3884    VBOXVDBG_DUMP_DRAWPRIM_LEAVE(pDevice9If);
    40103885
    40113886    Assert(hr == S_OK);
     
    40653940    HRESULT hr = S_OK;
    40663941
    4067 #ifdef DEBUG_misha
    4068     /* this proved to be the easiest way of detecting blit issues with WinDbg
    4069      * this is why I'd keep this test here to be able to switch it on at runtime any time needed */
    4070     static bool bDo = false;
    4071     IDirect3DSurface9 *pTstSrcSurfIf = NULL;
    4072     IDirect3DSurface9 *pTstDstSurfIf = NULL;
    4073 
    4074     if (bDo)
    4075     {
    4076         RECT DstRect;
    4077         hr = vboxWddmSurfGet(pSrcRc, 0, &pTstSrcSurfIf);
    4078         Assert(hr == S_OK);
    4079         hr = vboxWddmSurfGet(pDstRc, 0, &pTstDstSurfIf);
    4080         Assert(hr == S_OK);
    4081 
    4082         vboxWddmRectMoved(&DstRect, &pData->SrcRect, pData->DstPoint.x, pData->DstPoint.y);
    4083         vboxVDbgDoDumpSurfData("TexBlt-pre Src:\n", pSrcRc, 0, &pData->SrcRect, pTstSrcSurfIf, "\n");
    4084         vboxVDbgDoDumpSurfData("TexBlt-pre Dst:\n", pDstRc, 0, &DstRect, pTstDstSurfIf, "\n");
    4085     }
    4086 #endif
     3942    VBOXVDBG_DUMP_TEXBLT_ENTER(pSrcRc, &pData->SrcRect, pDstRc, &pData->DstPoint);
    40873943
    40883944    if (pSrcRc->aAllocations[0].D3DWidth == pDstRc->aAllocations[0].D3DWidth
     
    41313987    }
    41323988
    4133 #ifdef DEBUG_misha
    4134     /* this proved to be the easiest way of detecting blit issues with WinDbg
    4135      * this is why I'd keep this test here to be able to switch it on at runtime any time needed */
    4136 
    4137     if (bDo)
    4138     {
    4139         RECT DstRect;
    4140         vboxWddmRectMoved(&DstRect, &pData->SrcRect, pData->DstPoint.x, pData->DstPoint.y);
    4141         vboxVDbgDoDumpSurfData("TexBlt-post Src:\n", pSrcRc, 0, &pData->SrcRect, pTstSrcSurfIf, "\n");
    4142         vboxVDbgDoDumpSurfData("TexBlt-post Dst:\n", pDstRc, 0, &DstRect, pTstDstSurfIf, "\n");
    4143     }
    4144 
    4145     if (pTstDstSurfIf)
    4146         pTstDstSurfIf->Release();
    4147     if (pTstSrcSurfIf)
    4148         pTstSrcSurfIf->Release();
    4149 #endif
     3989    VBOXVDBG_DUMP_TEXBLT_LEAVE(pSrcRc, &pData->SrcRect, pDstRc, &pData->DstPoint);
     3990
    41503991    vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
    41513992    return hr;
     
    52815122                    }
    52825123#endif
    5283 
    5284 //                if (pResource->Flags.RenderTarget)
    5285 //                    bIssueCreateResource = true;
    5286 
    52875124                    PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];
    52885125                    CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0];
    52895126                    IDirect3DTexture9 *pD3DIfTex;
    52905127                    HANDLE hSharedHandle = NULL;
     5128                    void **pavClientMem = NULL;
    52915129                    if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
    52925130                    {
     
    53065144                        }
    53075145                    }
    5308 #if 0
    5309                     hr = pDevice9If->CreateTexture(pSurf->Width,
    5310                                                 pAllocation->D3DWidth,
    5311                                                 pResource->SurfCount,
    5312                                                 vboxDDI2D3DUsage(pResource->Flags),
    5313                                                 vboxDDI2D3DFormat(pResource->Format),
    5314                                                 vboxDDI2D3DPool(pResource->Pool),
    5315                                                 &pD3DIfTex,
    5316                                                 NULL /* HANDLE* pSharedHandle */
    5317                                                 );
    5318 #else
    5319                     hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If,
    5320                                                 pAllocation->D3DWidth,
    5321                                                 pSurf->Height,
    5322                                                 pResource->SurfCount,
    5323                                                 vboxDDI2D3DUsage(pResource->Flags),
    5324                                                 vboxDDI2D3DFormat(pResource->Format),
    5325                                                 vboxDDI2D3DPool(pResource->Pool),
    5326                                                 &pD3DIfTex,
    5327                                                 pResource->Flags.SharedResource ? &hSharedHandle : NULL,
    5328                                                 pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL);
    5329 #endif
    5330                     Assert(hr == S_OK);
    5331                     if (hr == S_OK)
     5146                    if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
    53325147                    {
    5333                         Assert(pD3DIfTex);
    5334                         pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
    5335                         pAllocation->pD3DIf = pD3DIfTex;
    5336                         Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle));
    5337                         pAllocation->hSharedHandle = hSharedHandle;
    5338 #if 0
    5339                         if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
     5148                        pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pResource->SurfCount);
     5149                        Assert(pavClientMem);
     5150                        if (pavClientMem)
    53405151                        {
    53415152                            for (UINT i = 0; i < pResource->SurfCount; ++i)
    53425153                            {
    5343                                 D3DLOCKED_RECT lockInfo;
    5344                                 PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];
    5345                                 Assert(pAllocation->pvMem);
    5346                                 hr = pD3DIfTex->LockRect(i, &lockInfo, NULL, D3DLOCK_DISCARD);
    5347                                 Assert(hr == S_OK);
    5348                                 if (hr == S_OK)
    5349                                 {
    5350                                     vboxWddmLockUnlockMemSynch(pAllocation, &lockInfo, NULL, true /*bool bToLockInfo*/);
    5351                                     HRESULT tmpHr = pD3DIfTex->UnlockRect(i);
    5352                                     Assert(tmpHr == S_OK);
    5353                                 }
    5354                                 else
    5355                                 {
    5356                                     pD3DIfTex->Release();
    5357                                     break;
    5358                                 }
     5154                                pavClientMem[i] = pRc->aAllocations[i].pvMem;
    53595155                            }
    53605156                        }
    5361 #endif
     5157                        else
     5158                            hr = E_FAIL;
    53625159                    }
    5363 #ifdef DEBUG
    5364                     else
     5160                    if (hr == S_OK)
    53655161                    {
    5366                         for (UINT i = 0; i < pResource->SurfCount; ++i)
     5162                        hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If,
     5163                                                    pAllocation->D3DWidth,
     5164                                                    pSurf->Height,
     5165                                                    pResource->SurfCount,
     5166                                                    vboxDDI2D3DUsage(pResource->Flags),
     5167                                                    vboxDDI2D3DFormat(pResource->Format),
     5168                                                    vboxDDI2D3DPool(pResource->Pool),
     5169                                                    &pD3DIfTex,
     5170                                                    pResource->Flags.SharedResource ? &hSharedHandle : NULL,
     5171                                                    pavClientMem);
     5172                        Assert(hr == S_OK);
     5173                        if (hr == S_OK)
    53675174                        {
    5368                             PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];
    5369                             Assert(!pAllocation->pvMem);
     5175                            Assert(pD3DIfTex);
     5176                            pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
     5177                            pAllocation->pD3DIf = pD3DIfTex;
     5178                            Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle));
     5179                            pAllocation->hSharedHandle = hSharedHandle;
    53705180                        }
     5181
     5182                        if (pavClientMem)
     5183                            RTMemFree(pavClientMem);
    53715184                    }
    5372 #endif
    53735185                }
    53745186                else /*pResource->Flags.CubeMap*/
    53755187                {
    53765188                    IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice);
    5377 
    53785189                    PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];
    53795190                    CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0];
    53805191                    IDirect3DCubeTexture9 *pD3DIfCubeTex;
    53815192                    HANDLE hSharedHandle = NULL;
     5193                    void **pavClientMem = NULL;
    53825194
    53835195                    if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height)
     
    53895201                    else
    53905202                    {
    5391                         hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
    5392                                                 pAllocation->SurfDesc.width,
    5393                                                 VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc),
    5394                                                 vboxDDI2D3DUsage(pResource->Flags),
    5395                                                 vboxDDI2D3DFormat(pResource->Format),
    5396                                                 vboxDDI2D3DPool(pResource->Pool),
    5397                                                 &pD3DIfCubeTex,
    5398                                                 pResource->Flags.SharedResource ? &hSharedHandle : NULL,
    5399                                                 pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL);
    5400                     }
    5401 
    5402                     Assert(hr == S_OK);
    5403                     if (hr == S_OK)
    5404                     {
    5405                         Assert(pD3DIfCubeTex);
    5406                         pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE;
    5407                         pAllocation->pD3DIf = pD3DIfCubeTex;
    5408                         Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle));
    5409                         pAllocation->hSharedHandle = hSharedHandle;
     5203                        if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
     5204                        {
     5205                            pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pResource->SurfCount);
     5206                            Assert(pavClientMem);
     5207                            if (pavClientMem)
     5208                            {
     5209                                for (UINT i = 0; i < pResource->SurfCount; ++i)
     5210                                {
     5211                                    pavClientMem[i] = pRc->aAllocations[i].pvMem;
     5212                                }
     5213                            }
     5214                            else
     5215                                hr = E_FAIL;
     5216                        }
     5217
     5218                        if (hr == S_OK)
     5219                        {
     5220                            hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
     5221                                                    pAllocation->SurfDesc.width,
     5222                                                    VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc),
     5223                                                    vboxDDI2D3DUsage(pResource->Flags),
     5224                                                    vboxDDI2D3DFormat(pResource->Format),
     5225                                                    vboxDDI2D3DPool(pResource->Pool),
     5226                                                    &pD3DIfCubeTex,
     5227                                                    pResource->Flags.SharedResource ? &hSharedHandle : NULL,
     5228                                                    pavClientMem);
     5229                            Assert(hr == S_OK);
     5230                            if (hr == S_OK)
     5231                            {
     5232                                Assert(pD3DIfCubeTex);
     5233                                pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE;
     5234                                pAllocation->pD3DIf = pD3DIfCubeTex;
     5235                                Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle));
     5236                                pAllocation->hSharedHandle = hSharedHandle;
     5237                            }
     5238
     5239                            if (pavClientMem)
     5240                                RTMemFree(pavClientMem);
     5241                        }
    54105242                    }
    54115243                }
     
    54475279                            if (hr == S_OK)
    54485280                            {
    5449 #if 0
    5450                                 if(pResource->Flags.Primary)
    5451                                 {
    5452                                     for (UINT i = 0; i < pResource->SurfCount; ++i)
    5453                                     {
    5454                                         vboxWddmSwapchainFindCreate(pDevice, &pRc->aAllocations[i]);
    5455                                     }
    5456                                     Assert(bIssueCreateResource);
    5457                                 }
    5458 #endif
    54595281                                continue;
    54605282                            }
     
    54745296            else
    54755297            {
    5476 //                PVBOXWDDMDISP_SCREEN pScreen = &pDevice->aScreens[pDevice->iPrimaryScreen];
    5477 //                Assert(pScreen->hWnd);
    5478 //                Assert(pScreen->pDevice9If);
    54795298                hr = E_FAIL;
    54805299                Assert(0);
     
    64716290                    )
    64726291            {
    6473 //                Assert(pSrcAlloc->SurfDesc.width == pDstAlloc->SurfDesc.width);
    6474 //                Assert(pSrcAlloc->SurfDesc.height == pDstAlloc->SurfDesc.height);
    6475 //                Assert(pSrcAlloc->SurfDesc.format == pDstAlloc->SurfDesc.format);
    6476 //                Assert(pSrcAlloc->SurfDesc.bpp == pDstAlloc->SurfDesc.bpp);
    6477 //                Assert(pSrcAlloc->SurfDesc.pitch == pDstAlloc->SurfDesc.pitch);
    6478 //                Assert(pSrcAlloc->SurfDesc.depth == pDstAlloc->SurfDesc.depth);
    6479 //                Assert(pSrcAlloc->SurfDesc.slicePitch == pDstAlloc->SurfDesc.slicePitch);
    6480 //                Assert(pSrcAlloc->SurfDesc.cbSize == pDstAlloc->SurfDesc.cbSize);
    6481 //                Assert(pData->DstRect.left == 0);
    6482 //                Assert(pData->DstRect.top == 0);
    6483 //                Assert(pData->DstRect.right == pDstAlloc->SurfDesc.width);
    6484 //                Assert(pData->DstRect.bottom == pDstAlloc->SurfDesc.height);
    6485 //                Assert(pData->SrcRect.left == 0);
    6486 //                Assert(pData->SrcRect.top == 0);
    6487 //                Assert(pData->SrcRect.right == pSrcAlloc->SurfDesc.width);
    6488 //                Assert(pData->SrcRect.bottom == pSrcAlloc->SurfDesc.height);
    64896292# if 0
    64906293                if (pData->DstRect.left == 0 && pData->DstRect.top == 0
     
    65346337            {
    65356338                Assert(pSrcSurfIf);
    6536 #ifdef DEBUG_misha
    6537                 /* this proved to be the easiest way of detecting blit issues with WinDbg
    6538                  * this is why I'd keep this test here to be able to switch it on at runtime any time needed */
    6539                 static bool bDo = false;
    6540 
    6541                 if (bDo)
    6542                 {
    6543                     vboxVDbgDoDumpSurfData("Blt-pre Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n");
    6544                     vboxVDbgDoDumpSurfData("Blt-pre Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n");
    6545                 }
    6546 #endif
     6339
     6340                VBOXVDBG_DUMP_BLT_ENTER(pSrcSurfIf, &pData->SrcRect, pDstSurfIf, &pData->DstRect);
     6341
    65476342                /* we support only Point & Linear, we ignore [Begin|Continue|End]PresentToDwm */
    65486343                Assert((pData->Flags.Value & (~(0x00000100 | 0x00000200 | 0x00000400 | 0x00000001  | 0x00000002))) == 0);
     
    65546349                Assert(hr == S_OK);
    65556350
    6556 #ifdef DEBUG_misha
    6557                 /* this proved to be the easiest way of detecting blit issues with WinDbg
    6558                  * this is why I'd keep this test here to be able to switch it on at runtime any time needed */
    6559                 if (bDo)
    6560                 {
    6561                     vboxVDbgDoDumpSurfData("Blt-post Src:\n", pSrcRc, pData->SrcSubResourceIndex, &pData->SrcRect, pSrcSurfIf, "\n");
    6562                     vboxVDbgDoDumpSurfData("Blt-post Dst:\n", pDstRc, pData->DstSubResourceIndex, &pData->DstRect, pDstSurfIf, "\n");
    6563                 }
    6564 #endif
     6351                VBOXVDBG_DUMP_BLT_LEAVE(pSrcSurfIf, &pData->SrcRect, pDstSurfIf, &pData->DstRect);
     6352
    65656353                pSrcSurfIf->Release();
    65666354            }
     
    80157803    return hr;
    80167804}
    8017 
    8018 #ifdef VBOXWDDMDISP_DEBUG_PRINT
    8019 VOID vboxVDbgDoMpPrint(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString)
    8020 {
    8021     uint32_t cbString = (uint32_t)strlen(szString) + 1;
    8022     uint32_t cbCmd = RT_OFFSETOF(VBOXDISPIFESCAPE_DBGPRINT, aStringBuf[cbString]);
    8023     PVBOXDISPIFESCAPE_DBGPRINT pCmd = (PVBOXDISPIFESCAPE_DBGPRINT)RTMemAllocZ(cbCmd);
    8024     Assert(pCmd);
    8025     if (pCmd)
    8026     {
    8027         pCmd->EscapeHdr.escapeCode = VBOXESC_DBGPRINT;
    8028         memcpy(pCmd->aStringBuf, szString, cbString);
    8029 
    8030         D3DDDICB_ESCAPE DdiEscape = {0};
    8031         DdiEscape.hContext = NULL;
    8032         DdiEscape.hDevice = NULL;
    8033         DdiEscape.Flags.Value = 0;
    8034         DdiEscape.pPrivateDriverData = pCmd;
    8035         DdiEscape.PrivateDriverDataSize = cbCmd;
    8036 
    8037         HRESULT hr = pDevice->RtCallbacks.pfnEscapeCb(pDevice->pAdapter->hAdapter, &DdiEscape);
    8038         Assert(hr == S_OK);
    8039 
    8040         RTMemFree(pCmd);
    8041     }
    8042 }
    8043 VOID vboxVDbgDoMpPrintF(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString, ...)
    8044 {
    8045     char szBuffer[4096] = {0};
    8046     va_list pArgList;
    8047     va_start(pArgList, szString);
    8048     _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList);
    8049     va_end(pArgList);
    8050 
    8051     if (pDevice)
    8052     {
    8053         vboxVDbgDoMpPrint(pDevice, szBuffer);
    8054     }
    8055     else
    8056     {
    8057         OutputDebugStringA(szBuffer);
    8058     }
    8059 }
    8060 VOID vboxVDbgDoPrint(LPCSTR szString, ...)
    8061 {
    8062     char szBuffer[1024] = {0};
    8063     va_list pArgList;
    8064     va_start(pArgList, szString);
    8065     _vsnprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), szString, pArgList);
    8066     va_end(pArgList);
    8067 
    8068     OutputDebugStringA(szBuffer);
    8069 }
    8070 #endif
    8071 
    8072 #ifdef VBOXWDDMDISP_DEBUG
    8073 
    8074 VOID vboxVDbgDoDumpAllocSurfData(const PVBOXWDDMDISP_DEVICE pDevice, const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, IDirect3DSurface9 *pSurf, const RECT *pRect, const char* pSuffix)
    8075 {
    8076     if (pPrefix)
    8077     {
    8078         vboxVDbgPrint(("%s", pPrefix));
    8079     }
    8080 
    8081     D3DLOCKED_RECT Lr;
    8082     if (pRect)
    8083     {
    8084         Assert(pRect->right > pRect->left);
    8085         Assert(pRect->bottom > pRect->top);
    8086         vboxVDbgDoPrintRect("rect: ", pRect, "\n");
    8087     }
    8088 
    8089     HRESULT srcHr = pSurf->LockRect(&Lr, NULL, D3DLOCK_READONLY);
    8090     Assert(srcHr == S_OK);
    8091     if (srcHr == S_OK)
    8092     {
    8093         UINT bpp = vboxWddmCalcBitsPerPixel(pAlloc->SurfDesc.format);
    8094 //        Assert(bpp == pAlloc->SurfDesc.bpp);
    8095 //        Assert(pAlloc->SurfDesc.pitch == Lr.Pitch);
    8096         vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    8097                 Lr.pBits, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, Lr.Pitch));
    8098         if (pRect)
    8099         {
    8100             vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
    8101                     ((uint8_t*)Lr.pBits) + (pRect->top * Lr.Pitch) + ((pRect->left * bpp) >> 3),
    8102                     pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, Lr.Pitch));
    8103         }
    8104         Assert(0);
    8105 
    8106         srcHr = pSurf->UnlockRect();
    8107         Assert(srcHr == S_OK);
    8108     }
    8109     if (pSuffix)
    8110     {
    8111         vboxVDbgPrint(("%s\n", pSuffix));
    8112     }
    8113 }
    8114 
    8115 VOID vboxVDbgDoDumpAllocData(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, const RECT *pRect, const char* pSuffix)
    8116 {
    8117     if (pPrefix)
    8118     {
    8119         vboxVDbgPrint(("%s", pPrefix));
    8120     }
    8121 
    8122     if (pRect)
    8123     {
    8124         Assert(pRect->right > pRect->left);
    8125         Assert(pRect->bottom > pRect->top);
    8126         vboxVDbgDoPrintRect("rect: ", pRect, "\n");
    8127     }
    8128 
    8129     Assert(pAlloc->hAllocation);
    8130 
    8131     D3DDDICB_LOCK LockData;
    8132     LockData.hAllocation = pAlloc->hAllocation;
    8133     LockData.PrivateDriverData = 0;
    8134     LockData.NumPages = 0;
    8135     LockData.pPages = NULL;
    8136     LockData.pData = NULL; /* out */
    8137     LockData.Flags.Value = 0;
    8138     LockData.Flags.LockEntire =1;
    8139     LockData.Flags.ReadOnly = 1;
    8140 
    8141     PVBOXWDDMDISP_DEVICE pDevice = pAlloc->pRc->pDevice;
    8142 
    8143     HRESULT hr = pDevice->RtCallbacks.pfnLockCb(pDevice->hDevice, &LockData);
    8144     Assert(hr == S_OK);
    8145     if (hr == S_OK)
    8146     {
    8147         UINT bpp = vboxWddmCalcBitsPerPixel(pAlloc->SurfDesc.format);
    8148 //        Assert(bpp == pAlloc->SurfDesc.bpp);
    8149 //        Assert(pAlloc->SurfDesc.pitch == Lr.Pitch);
    8150         vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    8151                 LockData.pData, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, pAlloc->SurfDesc.pitch));
    8152         if (pRect)
    8153         {
    8154             vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
    8155                     ((uint8_t*)LockData.pData) + (pRect->top * pAlloc->SurfDesc.pitch) + ((pRect->left * bpp) >> 3),
    8156                     pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, pAlloc->SurfDesc.pitch));
    8157         }
    8158         Assert(0);
    8159 
    8160         D3DDDICB_UNLOCK DdiUnlock;
    8161 
    8162         DdiUnlock.NumAllocations = 1;
    8163         DdiUnlock.phAllocations = &pAlloc->hAllocation;
    8164 
    8165         hr = pDevice->RtCallbacks.pfnUnlockCb(pDevice->hDevice, &DdiUnlock);
    8166         Assert(hr == S_OK);
    8167     }
    8168     if (pSuffix)
    8169     {
    8170         vboxVDbgPrint(("%s\n", pSuffix));
    8171     }
    8172 }
    8173 
    8174 
    8175 VOID vboxVDbgDoDumpSurfData(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix)
    8176 {
    8177     if (pPrefix)
    8178     {
    8179         vboxVDbgPrint(("%s", pPrefix));
    8180     }
    8181 
    8182     Assert(pRc->cAllocations > iAlloc);
    8183     PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[iAlloc];
    8184 
    8185     vboxVDbgDoPrintAlloc("allocation info:\n", pRc, iAlloc, "\n");
    8186 
    8187     D3DLOCKED_RECT Lr;
    8188     if (pRect)
    8189     {
    8190         Assert(pRect->right > pRect->left);
    8191         Assert(pRect->bottom > pRect->top);
    8192         vboxVDbgDoPrintRect("rect: ", pRect, "\n");
    8193     }
    8194 
    8195     BOOL bReleaseSurf = false;
    8196     if (!pSurf)
    8197     {
    8198         HRESULT tmpHr = vboxWddmSurfGet(pRc, iAlloc, &pSurf);
    8199         Assert(tmpHr == S_OK);
    8200         bReleaseSurf = TRUE;
    8201     }
    8202     HRESULT srcHr = pSurf->LockRect(&Lr, NULL, D3DLOCK_READONLY);
    8203     Assert(srcHr == S_OK);
    8204     if (srcHr == S_OK)
    8205     {
    8206         UINT bpp = vboxWddmCalcBitsPerPixel(pAlloc->SurfDesc.format);
    8207 //        Assert(bpp == pAlloc->SurfDesc.bpp);
    8208 //        Assert(pAlloc->SurfDesc.pitch == Lr.Pitch);
    8209         vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    8210                 Lr.pBits, pAlloc->D3DWidth, pAlloc->SurfDesc.height, bpp, Lr.Pitch));
    8211         if (pRect)
    8212         {
    8213             vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">rect info</exec>\n",
    8214                     ((uint8_t*)Lr.pBits) + (pRect->top * Lr.Pitch) + ((pRect->left * bpp) >> 3),
    8215                     pRect->right - pRect->left, pRect->bottom - pRect->top, bpp, Lr.Pitch));
    8216         }
    8217         Assert(0);
    8218 
    8219         srcHr = pSurf->UnlockRect();
    8220         Assert(srcHr == S_OK);
    8221     }
    8222     if (pSuffix)
    8223     {
    8224         vboxVDbgPrint(("%s\n", pSuffix));
    8225     }
    8226 
    8227     if (bReleaseSurf)
    8228         pSurf->Release();
    8229 }
    8230 
    8231 VOID vboxVDbgDoDumpSurfDataBySurf(IDirect3DSurface9 *pSurf)
    8232 {
    8233     D3DSURFACE_DESC Desc;
    8234     HRESULT hr = pSurf->GetDesc(&Desc);
    8235     Assert(hr == S_OK);
    8236     if (hr == S_OK)
    8237     {
    8238         D3DLOCKED_RECT Lr;
    8239         hr = pSurf->LockRect(&Lr, NULL, D3DLOCK_READONLY);
    8240         Assert(hr == S_OK);
    8241         if (hr == S_OK)
    8242         {
    8243             UINT bpp = vboxWddmCalcBitsPerPixel((D3DDDIFORMAT)Desc.Format);
    8244             vboxVDbgPrint(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d 0n%d 0n%d\">surface info</exec>\n",
    8245                     Lr.pBits, Desc.Width, Desc.Height, bpp, Lr.Pitch));
    8246 
    8247             Assert(0);
    8248 
    8249             hr = pSurf->UnlockRect();
    8250             Assert(hr == S_OK);
    8251         }
    8252     }
    8253 }
    8254 
    8255 void vboxVDbgDoPrintAlloc(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const char * pSuffix)
    8256 {
    8257     Assert(pRc->cAllocations > iAlloc);
    8258     PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[iAlloc];
    8259     BOOL bPrimary = pRc->RcDesc.fFlags.Primary;
    8260     BOOL bFrontBuf = FALSE;
    8261     if (bPrimary)
    8262     {
    8263         PVBOXWDDMDISP_SWAPCHAIN pSwapchain = vboxWddmSwapchainForAlloc(pAlloc);
    8264         Assert(pSwapchain);
    8265         bFrontBuf = (vboxWddmSwapchainGetFb(pSwapchain)->pAlloc == pAlloc);
    8266     }
    8267     vboxVDbgPrint(("%s D3DWidth(%d), width(%d), height(%d), format(%d), usage(%s), %s", pPrefix,
    8268             pAlloc->D3DWidth, pAlloc->SurfDesc.width, pAlloc->SurfDesc.height, pAlloc->SurfDesc.format,
    8269             bPrimary ?
    8270                     (bFrontBuf ? "Front Buffer" : "Back Buffer")
    8271                     : "?Everage? Alloc",
    8272             pSuffix));
    8273 }
    8274 
    8275 void vboxVDbgDoPrintRect(const char * pPrefix, const RECT *pRect, const char * pSuffix)
    8276 {
    8277     vboxVDbgPrint(("%s left(%d), top(%d), right(%d), bottom(%d) %s", pPrefix, pRect->left, pRect->top, pRect->right, pRect->bottom, pSuffix));
    8278 }
    8279 #endif
    8280 
    8281 #ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
    8282 
    8283 static PVOID g_VBoxWDbgVEHandler = NULL;
    8284 LONG WINAPI vboxVDbgVectoredHandler(struct _EXCEPTION_POINTERS *pExceptionInfo)
    8285 {
    8286     PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;
    8287     PCONTEXT pContextRecord = pExceptionInfo->ContextRecord;
    8288     switch (pExceptionRecord->ExceptionCode)
    8289     {
    8290         case 0x40010006: /* <- OutputDebugString exception, ignore */
    8291         case 0xe06d7363: /* <- ms compiler - generated exception related to C++ exception */
    8292         case 0x000006d9: /* <- RPC exception, ignore */
    8293             break;
    8294         default:
    8295             AssertRelease(0);
    8296             break;
    8297     }
    8298     return EXCEPTION_CONTINUE_SEARCH;
    8299 }
    8300 
    8301 void vboxVDbgVEHandlerRegister()
    8302 {
    8303     Assert(!g_VBoxWDbgVEHandler);
    8304     g_VBoxWDbgVEHandler = AddVectoredExceptionHandler(1,vboxVDbgVectoredHandler);
    8305     Assert(g_VBoxWDbgVEHandler);
    8306 }
    8307 
    8308 void vboxVDbgVEHandlerUnregister()
    8309 {
    8310     Assert(g_VBoxWDbgVEHandler);
    8311     ULONG uResult = RemoveVectoredExceptionHandler(g_VBoxWDbgVEHandler);
    8312     Assert(uResult);
    8313     g_VBoxWDbgVEHandler = NULL;
    8314 }
    8315 
    8316 #endif
    8317 
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h

    r33836 r35650  
    268268} VBOXWDDMDISP_OVERLAY, *PVBOXWDDMDISP_OVERLAY;
    269269
     270#define VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc) (((pRc)->cAllocations)/6)
     271#define VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, idx) ((D3DCUBEMAP_FACES)(D3DCUBEMAP_FACE_POSITIVE_X+(idx)%VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc)))
     272#define VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, idx) ((idx)%VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc))
     273
    270274#ifdef VBOX_WITH_CRHGSMI
    271275HRESULT vboxUhgsmiGlobalSetCurrent();
    272276HRESULT vboxUhgsmiGlobalClearCurrent();
    273277#endif
     278
     279DECLINLINE(PVBOXWDDMDISP_SWAPCHAIN) vboxWddmSwapchainForAlloc(PVBOXWDDMDISP_ALLOCATION pAlloc)
     280{
     281    return pAlloc->pSwapchain;
     282}
     283
     284DECLINLINE(UINT) vboxWddmSwapchainIdxFb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
     285{
     286    return (pSwapchain->iBB + pSwapchain->cRTs - 1) % pSwapchain->cRTs;
     287}
     288
     289/* if swapchain contains only one surface returns this surface */
     290DECLINLINE(PVBOXWDDMDISP_RENDERTGT) vboxWddmSwapchainGetBb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
     291{
     292    if (pSwapchain->cRTs)
     293    {
     294        Assert(pSwapchain->iBB < pSwapchain->cRTs);
     295        return &pSwapchain->aRTs[pSwapchain->iBB];
     296    }
     297    return NULL;
     298}
     299
     300DECLINLINE(PVBOXWDDMDISP_RENDERTGT) vboxWddmSwapchainGetFb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
     301{
     302    if (pSwapchain->cRTs)
     303    {
     304        UINT iFb = vboxWddmSwapchainIdxFb(pSwapchain);
     305        return &pSwapchain->aRTs[iFb];
     306    }
     307    return NULL;
     308}
     309
     310/* on success increments the surface ref counter,
     311 * i.e. one must call pSurf->Release() once the surface is not needed*/
     312DECLINLINE(HRESULT) vboxWddmSurfGet(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, IDirect3DSurface9 **ppSurf)
     313{
     314    HRESULT hr = S_OK;
     315    Assert(pRc->cAllocations > iAlloc);
     316    switch (pRc->aAllocations[0].enmD3DIfType)
     317    {
     318        case VBOXDISP_D3DIFTYPE_SURFACE:
     319        {
     320            IDirect3DSurface9 *pD3DIfSurf = (IDirect3DSurface9*)pRc->aAllocations[iAlloc].pD3DIf;
     321            Assert(pD3DIfSurf);
     322            pD3DIfSurf->AddRef();
     323            *ppSurf = pD3DIfSurf;
     324            break;
     325        }
     326        case VBOXDISP_D3DIFTYPE_TEXTURE:
     327        {
     328            Assert(pRc->cAllocations == 1); /* <- vboxWddmSurfGet is typically used in Blt & ColorFill functions
     329                                             * in this case, if texture is used as a destination,
     330                                             * we should update sub-layers as well which is not done currently
     331                                             * so for now check vboxWddmSurfGet is used for one-level textures */
     332            IDirect3DTexture9 *pD3DIfTex = (IDirect3DTexture9*)pRc->aAllocations[0].pD3DIf;
     333            IDirect3DSurface9 *pSurfaceLevel;
     334            Assert(pD3DIfTex);
     335            hr = pD3DIfTex->GetSurfaceLevel(iAlloc, &pSurfaceLevel);
     336            Assert(hr == S_OK);
     337            if (hr == S_OK)
     338            {
     339                *ppSurf = pSurfaceLevel;
     340            }
     341            break;
     342        }
     343        case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE:
     344        {
     345            Assert(0);
     346            IDirect3DCubeTexture9 *pD3DIfCubeTex = (IDirect3DCubeTexture9*)pRc->aAllocations[0].pD3DIf;
     347            IDirect3DSurface9 *pSurfaceLevel;
     348            Assert(pD3DIfCubeTex);
     349            hr = pD3DIfCubeTex->GetCubeMapSurface(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, iAlloc),
     350                                                  VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, iAlloc), &pSurfaceLevel);
     351            Assert(hr == S_OK);
     352            if (hr == S_OK)
     353            {
     354                *ppSurf = pSurfaceLevel;
     355            }
     356            break;
     357        }
     358        default:
     359            Assert(0);
     360            hr = E_FAIL;
     361            break;
     362    }
     363    return hr;
     364}
    274365
    275366#define VBOXDISPMODE_IS_3D(_p) (!!((_p)->pD3D9If))
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3DCmn.h

    r34848 r35650  
    3030#include <VBox/VBoxGuestLib.h>
    3131
     32#include "VBoxDispDbg.h"
    3233#include "VBoxDispD3DIf.h"
    3334#include "../../Miniport/wddm/VBoxVideoIf.h"
    3435#include "VBoxDispCm.h"
     36#include "VBoxDispKmt.h"
    3537#ifdef VBOX_WITH_CRHGSMI
    3638#include "VBoxUhgsmiBase.h"
     
    4042#include "VBoxDispD3D.h"
    4143
    42 #ifdef DEBUG
    43 # define VBOXWDDMDISP_DEBUG
    44 # define VBOXWDDMDISP_DEBUG_FLOW
    45 # define VBOXWDDMDISP_DEBUG_DUMPSURFDATA
    46 # ifdef DEBUG_misha
    47 //#  define VBOXWDDMDISP_DEBUG_VEHANDLER
    48 # endif
    49 #endif
    50 
    51 #if defined(VBOXWDDMDISP_DEBUG) || defined(VBOX_WDDMDISP_WITH_PROFILE) || defined(VBOXWDDM_TEST_UHGSMI)
    52 # define VBOXWDDMDISP_DEBUG_PRINT
    53 #endif
    54 
    55 #if 0
    56 # ifdef Assert
    57 #  undef Assert
    58 #  define Assert(_a) do{}while(0)
    59 # endif
    60 # ifdef AssertBreakpoint
    61 #  undef AssertBreakpoint
    62 #  define AssertBreakpoint() do{}while(0)
    63 # endif
    64 # ifdef AssertFailed
    65 #  undef AssertFailed
    66 #  define AssertFailed() do{}while(0)
    67 # endif
    68 #endif
    69 
    70 #ifdef VBOXWDDMDISP_DEBUG_PRINT
    71 VOID vboxVDbgDoMpPrintF(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString, ...);
    72 VOID vboxVDbgDoMpPrint(const PVBOXWDDMDISP_DEVICE pDevice, LPCSTR szString);
    73 VOID vboxVDbgDoPrint(LPCSTR szString, ...);
    74 #endif
    75 
    76 #ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
    77 void vboxVDbgVEHandlerRegister();
    78 void vboxVDbgVEHandlerUnregister();
    79 #endif
    80 
    81 #define vboxVDbgPrint Log
    82 #define vboxVDbgPrintF LogFlow
    83 #define vboxVDbgPrintR LogRel
    84 
    85 #ifdef VBOXWDDMDISP_DEBUG
    86 VOID vboxVDbgDoDumpAllocData(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, const RECT *pRect, const char* pSuffix);
    87 VOID vboxVDbgDoDumpAllocSurfData(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, IDirect3DSurface9 *pSurf, const RECT *pRect, const char* pSuffix);
    88 VOID vboxVDbgDoDumpSurfData(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix);
    89 void vboxVDbgDoPrintRect(const char * pPrefix, const RECT *pRect, const char * pSuffix);
    90 void vboxVDbgDoPrintAlloc(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const char * pSuffix);
    91 #endif
    92 
    93 #if 0
    94 #ifdef VBOXWDDMDISP_DEBUG
    95 extern bool g_VDbgTstDumpEnable;
    96 extern bool g_VDbgTstDumpOnSys2VidSameSizeEnable;
    97 
    98 VOID vboxVDbgDoDumpAllocData(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, const RECT *pRect, const char* pSuffix);
    99 VOID vboxVDbgDoDumpAllocSurfData(const char * pPrefix, PVBOXWDDMDISP_ALLOCATION pAlloc, IDirect3DSurface9 *pSurf, const RECT *pRect, const char* pSuffix);
    100 VOID vboxVDbgDoDumpSurfData(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const RECT *pRect, IDirect3DSurface9 *pSurf, const char* pSuffix);
    101 void vboxVDbgDoMpPrintRect(const char * pPrefix, const RECT *pRect, const char * pSuffix);
    102 void vboxVDbgDoMpPrintAlloc(const char * pPrefix, const PVBOXWDDMDISP_RESOURCE pRc, uint32_t iAlloc, const char * pSuffix);
    103 
    104 #define vboxVDbgBreak() AssertBreakpoint()
    105 #define vboxVDbgPrint(_m) \
    106     do { \
    107         vboxVDbgDoPrint _m ; \
    108     } while (0)
    109 #define vboxVDbgPrintR vboxVDbgPrint
    110 #define vboxVDbgMpPrint(_m) \
    111     do { \
    112         vboxVDbgDoMpPrint _m ; \
    113     } while (0)
    114 #define vboxVDbgMpPrintF(_m) \
    115     do { \
    116         vboxVDbgDoMpPrintF _m ; \
    117     } while (0)
    118 #define vboxVDbgMpPrintRect(_m) \
    119     do { \
    120         vboxVDbgDoMpPrintRect _m ; \
    121     } while (0)
    122 #define vboxVDbgMpPrintAlloc(_m) \
    123     do { \
    124         vboxVDbgDoMpPrintAlloc _m ; \
    125     } while (0)
    126 #ifdef VBOXWDDMDISP_DEBUG_DUMPSURFDATA
    127 #define vboxVDbgDumpSurfData(_m) \
    128     do { \
    129         vboxVDbgDoDumpSurfData _m ; \
    130     } while (0)
    131 #define vboxVDbgDumpAllocSurfData(_m) \
    132     do { \
    133         vboxVDbgDoDumpAllocSurfData _m ; \
    134     } while (0)
    135 #define vboxVDbgDumpAllocData(_m) \
    136     do { \
    137         vboxVDbgDoDumpAllocData _m ; \
    138     } while (0)
    139 #else
    140 #define vboxVDbgDumpSurfData(_m) do {} while (0)
    141 #endif
    142 #ifdef VBOXWDDMDISP_DEBUG_FLOW
    143 # define vboxVDbgPrintF  vboxVDbgPrint
    144 #else
    145 # define vboxVDbgPrintF(_m)  do {} while (0)
    146 #endif
    147 #else
    148 #define vboxVDbgMpPrint(_m) do {} while (0)
    149 #define vboxVDbgMpPrintF(_m) do {} while (0)
    150 #define vboxVDbgMpPrintRect(_m) do {} while (0)
    151 #define vboxVDbgMpPrintAlloc(_m) do {} while (0)
    152 #define vboxVDbgDumpSurfData(_m) do {} while (0)
    153 #define vboxVDbgDumpAllocSurfData(_m) do {} while (0)
    154 #define vboxVDbgDumpAllocData(_m) do {} while (0)
    155 #define vboxVDbgBreak() do {} while (0)
    156 #define vboxVDbgPrint(_m)  do {} while (0)
    157 #define vboxVDbgPrintR vboxVDbgPrint
    158 #define vboxVDbgPrintF vboxVDbgPrint
    159 #endif
    160 #endif
    16144
    16245# ifdef VBOXWDDMDISP
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispProfile.h

    r32962 r35650  
    2424#define VBOXDISPPROFILE_GET_TIME_MILLI() RTTimeMilliTS()
    2525#define VBOXDISPPROFILE_DUMP(_m) do {\
    26         vboxVDbgDoMpPrintF _m; \
     26        LogRel (_m); \
    2727    } while (0)
    2828
     
    5959//                m_pName, m_cCalls,
    6060//                m_cTime, m_cTime/1000, m_cTime/1000000));
    61         VBOXDISPPROFILE_DUMP((pDevice, "%s\t%d\t%I64u\t%I64u\t%I64u\n",
     61        VBOXDISPPROFILE_DUMP(("%s\t%d\t%I64u\t%I64u\t%I64u\n",
    6262                m_pName, m_cCalls,
    6363                m_cTime, m_cTime/1000, m_cTime/1000000));
     
    9999    void dump(const PVBOXWDDMDISP_DEVICE pDevice)
    100100    {
    101         VBOXDISPPROFILE_DUMP((pDevice, ">>>> Start of VBox Disp Dump '%s': num entries(%d) >>>>>\n", m_pName, m_cEntries));
    102         VBOXDISPPROFILE_DUMP((pDevice, "Name\tCalls\tNanos\tMicros\tMillis\n"));
     101        VBOXDISPPROFILE_DUMP((">>>> Start of VBox Disp Dump '%s': num entries(%d) >>>>>\n", m_pName, m_cEntries));
     102        VBOXDISPPROFILE_DUMP(("Name\tCalls\tNanos\tMicros\tMillis\n"));
    103103        for (uint32_t i = 0; i < m_cEntries; ++i)
    104104        {
    105105            m_Entries[i].dump(pDevice);
    106106        }
    107         VBOXDISPPROFILE_DUMP((pDevice, "<<<< Endi of VBox Disp Dump '%s' <<<<<\n", m_pName));
     107        VBOXDISPPROFILE_DUMP(("<<<< Endi of VBox Disp Dump '%s' <<<<<\n", m_pName));
    108108    }
    109109
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.cpp

    r35319 r35650  
    481481    return hr;
    482482}
    483 
    484 HRESULT vboxDispKmtCallbacksInit(PVBOXDISPKMT_CALLBACKS pCallbacks)
    485 {
    486     HRESULT hr = S_OK;
    487 
    488     memset(pCallbacks, 0, sizeof (*pCallbacks));
    489 
    490     pCallbacks->hGdi32 = LoadLibraryW(L"gdi32.dll");
    491     if (pCallbacks->hGdi32 != NULL)
    492     {
    493         bool bSupported = true;
    494         pCallbacks->pfnD3DKMTOpenAdapterFromHdc = (PFND3DKMT_OPENADAPTERFROMHDC)GetProcAddress(pCallbacks->hGdi32, "D3DKMTOpenAdapterFromHdc");
    495         Log((__FUNCTION__"pfnD3DKMTOpenAdapterFromHdc = %p\n", pCallbacks->pfnD3DKMTOpenAdapterFromHdc));
    496         bSupported &= !!(pCallbacks->pfnD3DKMTOpenAdapterFromHdc);
    497 
    498         pCallbacks->pfnD3DKMTOpenAdapterFromGdiDisplayName = (PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME)GetProcAddress(pCallbacks->hGdi32, "D3DKMTOpenAdapterFromGdiDisplayName");
    499         Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName = %p\n", pCallbacks->pfnD3DKMTOpenAdapterFromGdiDisplayName));
    500         bSupported &= !!(pCallbacks->pfnD3DKMTOpenAdapterFromGdiDisplayName);
    501 
    502         pCallbacks->pfnD3DKMTCloseAdapter = (PFND3DKMT_CLOSEADAPTER)GetProcAddress(pCallbacks->hGdi32, "D3DKMTCloseAdapter");
    503         Log((__FUNCTION__": pfnD3DKMTCloseAdapter = %p\n", pCallbacks->pfnD3DKMTCloseAdapter));
    504         bSupported &= !!(pCallbacks->pfnD3DKMTCloseAdapter);
    505 
    506         pCallbacks->pfnD3DKMTEscape = (PFND3DKMT_ESCAPE)GetProcAddress(pCallbacks->hGdi32, "D3DKMTEscape");
    507         Log((__FUNCTION__": pfnD3DKMTEscape = %p\n", pCallbacks->pfnD3DKMTEscape));
    508         bSupported &= !!(pCallbacks->pfnD3DKMTEscape);
    509 
    510         pCallbacks->pfnD3DKMTCreateDevice = (PFND3DKMT_CREATEDEVICE)GetProcAddress(pCallbacks->hGdi32, "D3DKMTCreateDevice");
    511         Log((__FUNCTION__": pfnD3DKMTCreateDevice = %p\n", pCallbacks->pfnD3DKMTCreateDevice));
    512         bSupported &= !!(pCallbacks->pfnD3DKMTCreateDevice);
    513 
    514         pCallbacks->pfnD3DKMTDestroyDevice = (PFND3DKMT_DESTROYDEVICE)GetProcAddress(pCallbacks->hGdi32, "D3DKMTDestroyDevice");
    515         Log((__FUNCTION__": pfnD3DKMTDestroyDevice = %p\n", pCallbacks->pfnD3DKMTDestroyDevice));
    516         bSupported &= !!(pCallbacks->pfnD3DKMTDestroyDevice);
    517 
    518         pCallbacks->pfnD3DKMTCreateContext = (PFND3DKMT_CREATECONTEXT)GetProcAddress(pCallbacks->hGdi32, "D3DKMTCreateContext");
    519         Log((__FUNCTION__": pfnD3DKMTCreateContext = %p\n", pCallbacks->pfnD3DKMTCreateContext));
    520         bSupported &= !!(pCallbacks->pfnD3DKMTCreateContext);
    521 
    522         pCallbacks->pfnD3DKMTDestroyContext = (PFND3DKMT_DESTROYCONTEXT)GetProcAddress(pCallbacks->hGdi32, "D3DKMTDestroyContext");
    523         Log((__FUNCTION__": pfnD3DKMTDestroyContext = %p\n", pCallbacks->pfnD3DKMTDestroyContext));
    524         bSupported &= !!(pCallbacks->pfnD3DKMTDestroyContext);
    525 
    526         pCallbacks->pfnD3DKMTRender = (PFND3DKMT_RENDER)GetProcAddress(pCallbacks->hGdi32, "D3DKMTRender");
    527         Log((__FUNCTION__": pfnD3DKMTRender = %p\n", pCallbacks->pfnD3DKMTRender));
    528         bSupported &= !!(pCallbacks->pfnD3DKMTRender);
    529 
    530         pCallbacks->pfnD3DKMTCreateAllocation = (PFND3DKMT_CREATEALLOCATION)GetProcAddress(pCallbacks->hGdi32, "D3DKMTCreateAllocation");
    531         Log((__FUNCTION__": pfnD3DKMTCreateAllocation = %p\n", pCallbacks->pfnD3DKMTCreateAllocation));
    532         bSupported &= !!(pCallbacks->pfnD3DKMTCreateAllocation);
    533 
    534         pCallbacks->pfnD3DKMTDestroyAllocation = (PFND3DKMT_DESTROYALLOCATION)GetProcAddress(pCallbacks->hGdi32, "D3DKMTDestroyAllocation");
    535         Log((__FUNCTION__": pfnD3DKMTDestroyAllocation = %p\n", pCallbacks->pfnD3DKMTDestroyAllocation));
    536         bSupported &= !!(pCallbacks->pfnD3DKMTDestroyAllocation);
    537 
    538         pCallbacks->pfnD3DKMTLock = (PFND3DKMT_LOCK)GetProcAddress(pCallbacks->hGdi32, "D3DKMTLock");
    539         Log((__FUNCTION__": pfnD3DKMTLock = %p\n", pCallbacks->pfnD3DKMTLock));
    540         bSupported &= !!(pCallbacks->pfnD3DKMTLock);
    541 
    542         pCallbacks->pfnD3DKMTUnlock = (PFND3DKMT_UNLOCK)GetProcAddress(pCallbacks->hGdi32, "D3DKMTUnlock");
    543         Log((__FUNCTION__": pfnD3DKMTUnlock = %p\n", pCallbacks->pfnD3DKMTUnlock));
    544         bSupported &= !!(pCallbacks->pfnD3DKMTUnlock);
    545 
    546         /*Assert(bSupported);*/
    547         if (bSupported)
    548         {
    549             return S_OK;
    550         }
    551         else
    552         {
    553             Log((__FUNCTION__": one of pfnD3DKMT function pointers failed to initialize\n"));
    554             hr = E_NOINTERFACE;
    555         }
    556 
    557         FreeLibrary(pCallbacks->hGdi32);
    558     }
    559     else
    560     {
    561         DWORD winEr = GetLastError();
    562         hr = HRESULT_FROM_WIN32(winEr);
    563         Assert(0);
    564         Assert(hr != S_OK);
    565         Assert(hr != S_FALSE);
    566         if (hr == S_OK || hr == S_FALSE)
    567             hr = E_FAIL;
    568     }
    569 
    570     return hr;
    571 }
    572 
    573 HRESULT vboxDispKmtCallbacksTerm(PVBOXDISPKMT_CALLBACKS pCallbacks)
    574 {
    575     FreeLibrary(pCallbacks->hGdi32);
    576     return S_OK;
    577 }
    578 
    579 HRESULT vboxDispKmtAdpHdcCreate(HDC *phDc)
    580 {
    581     HRESULT hr = E_FAIL;
    582     DISPLAY_DEVICE DDev;
    583     memset(&DDev, 0, sizeof (DDev));
    584     DDev.cb = sizeof (DDev);
    585 
    586     *phDc = NULL;
    587 
    588     for (int i = 0; ; ++i)
    589     {
    590         if (EnumDisplayDevices(NULL, /* LPCTSTR lpDevice */ i, /* DWORD iDevNum */
    591                 &DDev, 0 /* DWORD dwFlags*/))
    592         {
    593             if (DDev.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
    594             {
    595                 HDC hDc = CreateDC(NULL, DDev.DeviceName, NULL, NULL);
    596                 if (hDc)
    597                 {
    598                     *phDc = hDc;
    599                     return S_OK;
    600                 }
    601                 else
    602                 {
    603                     DWORD winEr = GetLastError();
    604                     Assert(0);
    605                     hr = HRESULT_FROM_WIN32(winEr);
    606                     Assert(FAILED(hr));
    607                     break;
    608                 }
    609             }
    610         }
    611         else
    612         {
    613             DWORD winEr = GetLastError();
    614 #ifdef DEBUG_misha
    615             Assert(0);
    616 #endif
    617             Log((__FUNCTION__": EnumDisplayDevices failed, winEr (%d)\n", winEr));
    618             hr = HRESULT_FROM_WIN32(winEr);
    619             Assert(FAILED(hr));
    620             break;
    621         }
    622     }
    623 
    624     return hr;
    625 }
    626 
    627 HRESULT vboxDispKmtOpenAdapter(PVBOXDISPKMT_CALLBACKS pCallbacks, PVBOXDISPKMT_ADAPTER pAdapter)
    628 {
    629     D3DKMT_OPENADAPTERFROMHDC OpenAdapterData = {0};
    630     HRESULT hr = vboxDispKmtAdpHdcCreate(&OpenAdapterData.hDc);
    631     if (hr == S_OK)
    632     {
    633         Assert(OpenAdapterData.hDc);
    634         NTSTATUS Status = pCallbacks->pfnD3DKMTOpenAdapterFromHdc(&OpenAdapterData);
    635 #ifdef DEBUG_misha
    636         /* may fail with xpdm driver */
    637         Assert(!Status);
    638 #endif
    639         if (!Status)
    640         {
    641             pAdapter->hAdapter = OpenAdapterData.hAdapter;
    642             pAdapter->hDc = OpenAdapterData.hDc;
    643             pAdapter->pCallbacks = pCallbacks;
    644             return S_OK;
    645         }
    646         else
    647         {
    648             Log((__FUNCTION__": pfnD3DKMTOpenAdapterFromGdiDisplayName failed, Status (0x%x)\n", Status));
    649             hr = E_FAIL;
    650         }
    651 
    652         DeleteDC(OpenAdapterData.hDc);
    653     }
    654 
    655     return hr;
    656 }
    657 
    658 HRESULT vboxDispKmtCloseAdapter(PVBOXDISPKMT_ADAPTER pAdapter)
    659 {
    660     D3DKMT_CLOSEADAPTER ClosaAdapterData = {0};
    661     ClosaAdapterData.hAdapter = pAdapter->hAdapter;
    662     NTSTATUS Status = pAdapter->pCallbacks->pfnD3DKMTCloseAdapter(&ClosaAdapterData);
    663     Assert(!Status);
    664     if (!Status)
    665     {
    666         DeleteDC(pAdapter->hDc);
    667         return S_OK;
    668     }
    669 
    670     Log((__FUNCTION__": pfnD3DKMTCloseAdapter failed, Status (0x%x)\n", Status));
    671 
    672     return E_FAIL;
    673 }
    674 
    675 HRESULT vboxDispKmtCreateDevice(PVBOXDISPKMT_ADAPTER pAdapter, PVBOXDISPKMT_DEVICE pDevice)
    676 {
    677     D3DKMT_CREATEDEVICE CreateDeviceData = {0};
    678     CreateDeviceData.hAdapter = pAdapter->hAdapter;
    679     NTSTATUS Status = pAdapter->pCallbacks->pfnD3DKMTCreateDevice(&CreateDeviceData);
    680     Assert(!Status);
    681     if (!Status)
    682     {
    683         pDevice->pAdapter = pAdapter;
    684         pDevice->hDevice = CreateDeviceData.hDevice;
    685         pDevice->pCommandBuffer = CreateDeviceData.pCommandBuffer;
    686         pDevice->CommandBufferSize = CreateDeviceData.CommandBufferSize;
    687         pDevice->pAllocationList = CreateDeviceData.pAllocationList;
    688         pDevice->AllocationListSize = CreateDeviceData.AllocationListSize;
    689         pDevice->pPatchLocationList = CreateDeviceData.pPatchLocationList;
    690         pDevice->PatchLocationListSize = CreateDeviceData.PatchLocationListSize;
    691 
    692         return S_OK;
    693     }
    694 
    695     return E_FAIL;
    696 }
    697 
    698 HRESULT vboxDispKmtDestroyDevice(PVBOXDISPKMT_DEVICE pDevice)
    699 {
    700     D3DKMT_DESTROYDEVICE DestroyDeviceData = {0};
    701     DestroyDeviceData.hDevice = pDevice->hDevice;
    702     NTSTATUS Status = pDevice->pAdapter->pCallbacks->pfnD3DKMTDestroyDevice(&DestroyDeviceData);
    703     Assert(!Status);
    704     if (!Status)
    705     {
    706         return S_OK;
    707     }
    708     return E_FAIL;
    709 }
    710 
    711 HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext,
    712                                     VBOXWDDM_CONTEXT_TYPE enmType, HANDLE hEvent, uint64_t u64UmInfo)
    713 {
    714     VBOXWDDM_CREATECONTEXT_INFO Info = {0};
    715     Info.u32IfVersion = 9;
    716     Info.enmType = enmType;
    717     Info.hUmEvent = (uint64_t)hEvent;
    718     Info.u64UmInfo = u64UmInfo;
    719     D3DKMT_CREATECONTEXT ContextData = {0};
    720     ContextData.hDevice = pDevice->hDevice;
    721     ContextData.NodeOrdinal = 0;
    722     ContextData.EngineAffinity = 0;
    723     ContextData.pPrivateDriverData = &Info;
    724     ContextData.PrivateDriverDataSize = sizeof (Info);
    725     ContextData.ClientHint = enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_UHGSMI_GL ? D3DKMT_CLIENTHINT_OPENGL : D3DKMT_CLIENTHINT_DX9;
    726     NTSTATUS Status = pDevice->pAdapter->pCallbacks->pfnD3DKMTCreateContext(&ContextData);
    727     Assert(!Status);
    728     if (!Status)
    729     {
    730         pContext->pDevice = pDevice;
    731         pContext->hContext = ContextData.hContext;
    732         pContext->pCommandBuffer = ContextData.pCommandBuffer;
    733         pContext->CommandBufferSize = ContextData.CommandBufferSize;
    734         pContext->pAllocationList = ContextData.pAllocationList;
    735         pContext->AllocationListSize = ContextData.AllocationListSize;
    736         pContext->pPatchLocationList = ContextData.pPatchLocationList;
    737         pContext->PatchLocationListSize = ContextData.PatchLocationListSize;
    738         return S_OK;
    739     }
    740     return E_FAIL;
    741 }
    742 
    743 HRESULT vboxDispKmtDestroyContext(PVBOXDISPKMT_CONTEXT pContext)
    744 {
    745     D3DKMT_DESTROYCONTEXT DestroyContextData = {0};
    746     DestroyContextData.hContext = pContext->hContext;
    747     NTSTATUS Status = pContext->pDevice->pAdapter->pCallbacks->pfnD3DKMTDestroyContext(&DestroyContextData);
    748     Assert(!Status);
    749     if (!Status)
    750         return S_OK;
    751     return E_FAIL;
    752 }
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxUhgsmiKmt.h

    r34345 r35650  
    1919#include "VBoxDispD3DCmn.h"
    2020
    21 #include <D3dkmthk.h>
    22 
    23 typedef struct VBOXDISPKMT_CALLBACKS
    24 {
    25     HMODULE hGdi32;
    26     /* open adapter */
    27     PFND3DKMT_OPENADAPTERFROMHDC pfnD3DKMTOpenAdapterFromHdc;
    28     PFND3DKMT_OPENADAPTERFROMGDIDISPLAYNAME pfnD3DKMTOpenAdapterFromGdiDisplayName;
    29     /* close adapter */
    30     PFND3DKMT_CLOSEADAPTER pfnD3DKMTCloseAdapter;
    31     /* escape */
    32     PFND3DKMT_ESCAPE pfnD3DKMTEscape;
    33 
    34     PFND3DKMT_CREATEDEVICE pfnD3DKMTCreateDevice;
    35     PFND3DKMT_DESTROYDEVICE pfnD3DKMTDestroyDevice;
    36     PFND3DKMT_CREATECONTEXT pfnD3DKMTCreateContext;
    37     PFND3DKMT_DESTROYCONTEXT pfnD3DKMTDestroyContext;
    38 
    39     PFND3DKMT_RENDER pfnD3DKMTRender;
    40 
    41     PFND3DKMT_CREATEALLOCATION pfnD3DKMTCreateAllocation;
    42     PFND3DKMT_DESTROYALLOCATION pfnD3DKMTDestroyAllocation;
    43 
    44     PFND3DKMT_LOCK pfnD3DKMTLock;
    45     PFND3DKMT_UNLOCK pfnD3DKMTUnlock;
    46 } VBOXDISPKMT_CALLBACKS, *PVBOXDISPKMT_CALLBACKS;
    47 
    48 HRESULT vboxDispKmtCallbacksInit(PVBOXDISPKMT_CALLBACKS pCallbacks);
    49 HRESULT vboxDispKmtCallbacksTerm(PVBOXDISPKMT_CALLBACKS pCallbacks);
    50 
    51 typedef struct VBOXDISPKMT_ADAPTER
    52 {
    53     D3DKMT_HANDLE hAdapter;
    54     HDC hDc;
    55     PVBOXDISPKMT_CALLBACKS pCallbacks;
    56 }VBOXDISPKMT_ADAPTER, *PVBOXDISPKMT_ADAPTER;
    57 
    58 typedef struct VBOXDISPKMT_DEVICE
    59 {
    60     struct VBOXDISPKMT_ADAPTER *pAdapter;
    61     D3DKMT_HANDLE hDevice;
    62     VOID *pCommandBuffer;
    63     UINT CommandBufferSize;
    64     D3DDDI_ALLOCATIONLIST *pAllocationList;
    65     UINT AllocationListSize;
    66     D3DDDI_PATCHLOCATIONLIST *pPatchLocationList;
    67     UINT PatchLocationListSize;
    68 }VBOXDISPKMT_DEVICE, *PVBOXDISPKMT_DEVICE;
    69 
    70 typedef struct VBOXDISPKMT_CONTEXT
    71 {
    72     struct VBOXDISPKMT_DEVICE *pDevice;
    73     D3DKMT_HANDLE hContext;
    74     VOID *pCommandBuffer;
    75     UINT CommandBufferSize;
    76     D3DDDI_ALLOCATIONLIST *pAllocationList;
    77     UINT AllocationListSize;
    78     D3DDDI_PATCHLOCATIONLIST *pPatchLocationList;
    79     UINT PatchLocationListSize;
    80 } VBOXDISPKMT_CONTEXT, *PVBOXDISPKMT_CONTEXT;
    8121
    8222typedef struct VBOXUHGSMI_PRIVATE_KMT
     
    9232#define VBOXUHGSMIKMT_GET(_p) VBOXUHGSMIKMT_GET_PRIVATE(_p, VBOXUHGSMI_PRIVATE_KMT)
    9333
    94 HRESULT vboxDispKmtOpenAdapter(PVBOXDISPKMT_CALLBACKS pCallbacks, PVBOXDISPKMT_ADAPTER pAdapter);
    95 HRESULT vboxDispKmtCloseAdapter(PVBOXDISPKMT_ADAPTER pAdapter);
    96 HRESULT vboxDispKmtCreateDevice(PVBOXDISPKMT_ADAPTER pAdapter, PVBOXDISPKMT_DEVICE pDevice);
    97 HRESULT vboxDispKmtDestroyDevice(PVBOXDISPKMT_DEVICE pDevice);
    98 HRESULT vboxDispKmtCreateContext(PVBOXDISPKMT_DEVICE pDevice, PVBOXDISPKMT_CONTEXT pContext,
    99         VBOXWDDM_CONTEXT_TYPE enmType, HANDLE hEvent, uint64_t u64UmInfo);
    100 HRESULT vboxDispKmtDestroyContext(PVBOXDISPKMT_CONTEXT pContext);
    101 
    10234HRESULT vboxUhgsmiKmtCreate(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, BOOL bD3D);
    10335HRESULT vboxUhgsmiKmtDestroy(PVBOXUHGSMI_PRIVATE_KMT pHgsmi);
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/cubetexture.c

    r33836 r35650  
    404404#ifdef VBOX_WITH_WDDM
    405405        , HANDLE *shared_handle
    406         , void *pvClientMem
     406        , void **pavClientMem
    407407#endif
    408408        )
     
    418418            wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture,
    419419            (IUnknown *)texture, &d3d9_cubetexture_wined3d_parent_ops,
    420             shared_handle, pvClientMem);
     420            shared_handle, pavClientMem);
    421421#else
    422422    hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage,
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9_private.h

    r33836 r35650  
    417417#ifdef VBOX_WITH_WDDM
    418418        , HANDLE *shared_handle
    419         , void *pvClientMem
     419        , void **pavClientMem
    420420#endif
    421421        ) DECLSPEC_HIDDEN;
     
    445445#ifdef VBOX_WITH_WDDM
    446446        , HANDLE *shared_handle
    447         , void *pvClientMem
     447        , void **pavClientMem
    448448#endif
    449449        ) DECLSPEC_HIDDEN;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c

    r33836 r35650  
    768768        UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format,
    769769        D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle,
    770         void *pvClientMem) /* <- extension arg to pass in the client memory buffer,
     770        void **pavClientMem) /* <- extension arg to pass in the client memory buffer,
    771771                            *    applicable ONLY for SYSMEM textures */
    772772{
     
    787787    hr = texture_init(object, This, width, height, levels, usage, format, pool
    788788        , shared_handle
    789         , pvClientMem
     789        , pavClientMem
    790790            );
    791791    if (FAILED(hr))
     
    812812            UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format,
    813813            D3DPOOL pool, IDirect3DCubeTexture9 **texture, HANDLE *shared_handle,
    814             void *pvClientMem) /* <- extension arg to pass in the client memory buffer,
     814            void **pavClientMem) /* <- extension arg to pass in the client memory buffer,
    815815                                *    applicable ONLY for SYSMEM textures */
    816816{
     
    829829    }
    830830
    831     hr = cubetexture_init(object, This, edge_length, levels, usage, format, pool, shared_handle, pvClientMem);
     831    hr = cubetexture_init(object, This, edge_length, levels, usage, format, pool, shared_handle, pavClientMem);
    832832    if (FAILED(hr))
    833833    {
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/texture.c

    r33656 r35650  
    401401#ifdef VBOX_WITH_WDDM
    402402        , HANDLE *shared_handle
    403         , void *pvClientMem
     403        , void **pavClientMem
    404404#endif
    405405        )
     
    416416            &texture->wineD3DTexture, (IUnknown *)texture, &d3d9_texture_wined3d_parent_ops
    417417            , shared_handle
    418             , pvClientMem);
     418            , pavClientMem);
    419419#else
    420420    hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/wined3d.h

    r33836 r35650  
    74087408#ifdef VBOX_WITH_WDDM
    74097409        , HANDLE *shared_handle
    7410         , void *pvClientMem
     7410        , void **pavClientMem
    74117411#endif
    74127412        );
     
    74497449#ifdef VBOX_WITH_WDDM
    74507450        , HANDLE *shared_handle
    7451         , void *pvClientMem
     7451        , void **pavClientMem
    74527452#endif
    74537453        );
     
    81158115#define IWineD3DDevice_CreateRendertargetView(This,resource,parent,rendertarget_view) (This)->lpVtbl->CreateRendertargetView(This,resource,parent,rendertarget_view)
    81168116#ifdef VBOX_WITH_WDDM
    8117 #define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem)
     8117#define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem)
    81188118#else
    81198119#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)
     
    81228122#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)
    81238123#ifdef VBOX_WITH_WDDM
    8124 #define IWineD3DDevice_CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem)
     8124#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)
    81258125#else
    81268126#define IWineD3DDevice_CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops) (This)->lpVtbl->CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/VBoxWineEx.h

    r33836 r35650  
    2525            UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format,
    2626            D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle,
    27             void *pvClientMem);
     27            void **pavClientMem);
    2828typedef FNVBOXWINEEXD3DDEV9_CREATETEXTURE *PFNVBOXWINEEXD3DDEV9_CREATETEXTURE;
    2929
     
    3131            UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format,
    3232            D3DPOOL pool, IDirect3DCubeTexture9 **texture, HANDLE *shared_handle,
    33             void *pvClientMem);
     33            void **pavClientMem);
    3434typedef FNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE *PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE;
    3535
     
    4747            UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format,
    4848            D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle,
    49             void *pvClientMem); /* <- extension arg to pass in the client memory buffer,
     49            void **pavClientMem); /* <- extension arg to pass in the client memory buffer,
    5050                                 *    applicable ONLY for SYSMEM textures */
    5151
     
    5353            UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format,
    5454            D3DPOOL pool, IDirect3DCubeTexture9 **texture, HANDLE *shared_handle,
    55             void *pvClientMem); /* <- extension arg to pass in the client memory buffer,
     55            void **pavClientMem); /* <- extension arg to pass in the client memory buffer,
    5656                                 *    applicable ONLY for SYSMEM textures */
    5757
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h

    r35332 r35650  
    74107410#ifdef VBOX_WITH_WDDM
    74117411        , HANDLE *shared_handle
    7412         , void *pvClientMem
     7412        , void **pavClientMem
    74137413#endif
    74147414        );
     
    74517451#ifdef VBOX_WITH_WDDM
    74527452        , HANDLE *shared_handle
    7453         , void *pvClientMem
     7453        , void **pavClientMem
    74547454#endif
    74557455        );
     
    81178117#define IWineD3DDevice_CreateRendertargetView(This,resource,parent,rendertarget_view) (This)->lpVtbl->CreateRendertargetView(This,resource,parent,rendertarget_view)
    81188118#ifdef VBOX_WITH_WDDM
    8119 #define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem)
     8119#define IWineD3DDevice_CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem) (This)->lpVtbl->CreateTexture(This,width,height,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pavClientMem)
    81208120#else
    81218121#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)
     
    81248124#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)
    81258125#ifdef VBOX_WITH_WDDM
    8126 #define IWineD3DDevice_CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem) (This)->lpVtbl->CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops,shared_handle,pvClientMem)
     8126#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)
    81278127#else
    81288128#define IWineD3DDevice_CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops) (This)->lpVtbl->CreateCubeTexture(This,edge_length,levels,usage,format,pool,texture,parent,parent_ops)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/basetexture.c

    r33732 r35650  
    4242#ifdef VBOX_WITH_WDDM
    4343        , HANDLE *shared_handle
    44         , void *pvClientMem
     44        , void **pavClientMem
    4545#endif
    4646        )
     
    5757            size, usage, format_desc, pool, parent, parent_ops
    5858#ifdef VBOX_WITH_WDDM
    59             , shared_handle, pvClientMem
     59            , shared_handle, pavClientMem ? pavClientMem[0] : NULL /* <- @todo: should be always NULL ? */
    6060#endif
    6161            );
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/cubetexture.c

    r33836 r35650  
    443443#ifdef VBOX_WITH_WDDM
    444444        , HANDLE *shared_handle
    445         , void *pvClientMem
     445        , void **pavClientMem
    446446#endif
    447447        )
     
    496496            device, 0, usage, format_desc, pool, parent, parent_ops
    497497#ifdef VBOX_WITH_WDDM
    498             , shared_handle, pvClientMem
     498            , shared_handle, pavClientMem
    499499#endif
    500500            );
     
    547547            hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_w,
    548548                    format, usage, pool, i /* Level */, j, &texture->surfaces[j][i]
    549                     , NULL, pvClientMem
     549                    , NULL, pavClientMem ? pavClientMem[i * 6 + j] : NULL
    550550                );
    551551#else
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c

    r34304 r35650  
    881881#ifdef VBOX_WITH_WDDM
    882882        , HANDLE *shared_handle
    883         , void *pvClientMem
     883        , void **pavClientMem
    884884#endif
    885885        )
     
    904904#ifdef VBOX_WITH_WDDM
    905905            , shared_handle
    906             , pvClientMem
     906            , pavClientMem
    907907#endif
    908908            );
     
    994994#ifdef VBOX_WITH_WDDM
    995995        , HANDLE *shared_handle
    996         , void *pvClientMem
     996        , void **pavClientMem
    997997#endif
    998998        )
     
    10131013#ifdef VBOX_WITH_WDDM
    10141014            , shared_handle
    1015             , pvClientMem
     1015            , pavClientMem
    10161016#endif
    10171017        );
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/texture.c

    r33656 r35650  
    444444#ifdef VBOX_WITH_WDDM
    445445        , HANDLE *shared_handle
    446         , void *pvClientMem
     446        , void **pavClientMem
    447447#endif
    448448        )
     
    515515            device, 0, usage, format_desc, pool, parent, parent_ops
    516516#ifdef VBOX_WITH_WDDM
    517             , shared_handle, pvClientMem
     517            , shared_handle, pavClientMem
    518518#endif
    519519        );
     
    593593                        * this is done this way because the surface does not have its parent (texture) setup properly
    594594                        * thus we can not initialize texture at this stage */
    595                 , pvClientMem);
     595                , pavClientMem ? pavClientMem[i] : NULL);
    596596
    597597#else
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h

    r34987 r35650  
    19521952#ifdef VBOX_WITH_WDDM
    19531953        , HANDLE *shared_handle
    1954         , void *pvClientMem
     1954        , void **pavClientMem
    19551955#endif
    19561956        ) DECLSPEC_HIDDEN;
     
    19831983#ifdef VBOX_WITH_WDDM
    19841984        , HANDLE *shared_handle
    1985         , void *pvClientMem
     1985        , void **pavClientMem
    19861986#endif
    19871987        ) DECLSPEC_HIDDEN;
     
    20062006#ifdef VBOX_WITH_WDDM
    20072007        , HANDLE *shared_handle
    2008         , void *pvClientMem
     2008        , void **pavClientMem
    20092009#endif
    20102010        ) DECLSPEC_HIDDEN;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette