Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoTools.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoTools.h	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/common/VBoxVideoTools.h	(revision 43334)
@@ -229,4 +229,93 @@
 }
 
+typedef struct VBOXPOINT3D
+{
+    UINT x;
+    UINT y;
+    UINT z;
+} VBOXPOINT3D, *PVBOXPOINT3D;
+
+typedef struct VBOXBOX3D
+{
+    UINT Left;
+    UINT Top;
+    UINT Right;
+    UINT Bottom;
+    UINT Front;
+    UINT Back;
+} VBOXBOX3D, *PVBOXBOX3D;
+
+DECLINLINE(void) vboxWddmBoxTranslate(VBOXBOX3D * pBox, int x, int y, int z)
+{
+    pBox->Left   += x;
+    pBox->Top    += y;
+    pBox->Right  += x;
+    pBox->Bottom += y;
+    pBox->Front  += z;
+    pBox->Back   += z;
+}
+
+DECLINLINE(void) vboxWddmBoxMove(VBOXBOX3D * pBox, int x, int y, int z)
+{
+    LONG w = pBox->Right - pBox->Left;
+    LONG h = pBox->Bottom - pBox->Top;
+    LONG d = pBox->Back - pBox->Front;
+    pBox->Left   = x;
+    pBox->Top    = y;
+    pBox->Right  = w + x;
+    pBox->Bottom = h + y;
+    pBox->Front  = z;
+    pBox->Back   = d + z;
+}
+
+#define VBOXWDDM_BOXDIV_U(_v, _d, _nz) do { \
+        UINT tmp = (_v) / (_d); \
+        if (!tmp && (_v) && (_nz)) \
+            (_v) = 1; \
+        else \
+            (_v) = tmp; \
+    } while (0)
+
+DECLINLINE(void) vboxWddmBoxDivide(VBOXBOX3D * pBox, int div, bool fDontReachZero)
+{
+    VBOXWDDM_BOXDIV_U(pBox->Left, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pBox->Top, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pBox->Right, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pBox->Bottom, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pBox->Front, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pBox->Back, div, fDontReachZero);
+}
+
+DECLINLINE(void) vboxWddmPoint3DDivide(VBOXPOINT3D * pPoint, int div, bool fDontReachZero)
+{
+    VBOXWDDM_BOXDIV_U(pPoint->x, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pPoint->y, div, fDontReachZero);
+    VBOXWDDM_BOXDIV_U(pPoint->y, div, fDontReachZero);
+}
+
+DECLINLINE(void) vboxWddmBoxTranslated(VBOXBOX3D * pDst, const VBOXBOX3D * pBox, int x, int y, int z)
+{
+    *pDst = *pBox;
+    vboxWddmBoxTranslate(pDst, x, y, z);
+}
+
+DECLINLINE(void) vboxWddmBoxMoved(VBOXBOX3D * pDst, const VBOXBOX3D * pBox, int x, int y, int z)
+{
+    *pDst = *pBox;
+    vboxWddmBoxMove(pDst, x, y, z);
+}
+
+DECLINLINE(void) vboxWddmBoxDivided(VBOXBOX3D * pDst, const VBOXBOX3D * pBox, int div, bool fDontReachZero)
+{
+    *pDst = *pBox;
+    vboxWddmBoxDivide(pDst, div, fDontReachZero);
+}
+
+DECLINLINE(void) vboxWddmPoint3DDivided(VBOXPOINT3D * pDst, const VBOXPOINT3D * pPoint, int div, bool fDontReachZero)
+{
+    *pDst = *pPoint;
+    vboxWddmPoint3DDivide(pDst, div, fDontReachZero);
+}
+
 /* the dirty rect info is valid */
 #define VBOXWDDM_DIRTYREGION_F_VALID      0x00000001
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h	(revision 43334)
@@ -537,4 +537,5 @@
         case D3DDDIFMT_L8:
             return 8;
+        case D3DDDIFMT_L16:
         case D3DDDIFMT_A8L8:
             return 16;
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxD3DIf.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxD3DIf.cpp	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxD3DIf.cpp	(revision 43334)
@@ -543,62 +543,96 @@
     else if (VBOXWDDMDISP_IS_TEXTURE(pRc->RcDesc.fFlags))
     {
+        PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];
+        IDirect3DBaseTexture9 *pD3DIfTex;
+        HANDLE hSharedHandle = pAllocation->hSharedHandle;
+        void **pavClientMem = NULL;
+        VBOXDISP_D3DIFTYPE enmD3DIfType = VBOXDISP_D3DIFTYPE_UNDEFINED;
+        hr = S_OK;
+        if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM)
+        {
+            pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pRc->cAllocations);
+            Assert(pavClientMem);
+            if (pavClientMem)
+            {
+                for (UINT i = 0; i < pRc->cAllocations; ++i)
+                {
+                    Assert(pRc->aAllocations[i].pvMem);
+                    pavClientMem[i] = pRc->aAllocations[i].pvMem;
+                }
+            }
+            else
+                hr = E_FAIL;
+        }
+
+#ifdef DEBUG
         if (!pRc->RcDesc.fFlags.CubeMap)
         {
-#ifdef DEBUG
-            {
-                PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[0];
-                uint32_t tstW = pAlloc->SurfDesc.width;
-                uint32_t tstH = pAlloc->SurfDesc.height;
-                for (UINT i = 1; i < pRc->cAllocations; ++i)
-                {
-                    tstW /= 2;
-                    tstH /= 2;
-                    pAlloc = &pRc->aAllocations[i];
-                    Assert((pAlloc->SurfDesc.width == tstW) || (!tstW && (pAlloc->SurfDesc.width==1)));
-                    Assert((pAlloc->SurfDesc.height == tstH) || (!tstH && (pAlloc->SurfDesc.height==1)));
-                }
-            }
+            PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[0];
+            uint32_t tstW = pAlloc->SurfDesc.width;
+            uint32_t tstH = pAlloc->SurfDesc.height;
+            for (UINT i = 1; i < pRc->cAllocations; ++i)
+            {
+                tstW /= 2;
+                tstH /= 2;
+                pAlloc = &pRc->aAllocations[i];
+                Assert((pAlloc->SurfDesc.width == tstW) || (!tstW && (pAlloc->SurfDesc.width==1)));
+                Assert((pAlloc->SurfDesc.height == tstH) || (!tstH && (pAlloc->SurfDesc.height==1)));
+            }
+        }
 #endif
-            PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];
-            IDirect3DTexture9 *pD3DIfTex;
-            HANDLE hSharedHandle = pAllocation->hSharedHandle;
-            void **pavClientMem = NULL;
-            hr = S_OK;
-            if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM)
-            {
-                Assert(pAllocation->pvMem);
-                Assert(pAllocation->SurfDesc.pitch);
-                UINT minPitch = vboxWddmCalcPitch(pAllocation->SurfDesc.width, pAllocation->SurfDesc.format);
-                Assert(minPitch);
-                if (minPitch)
-                {
-                    if (pAllocation->SurfDesc.pitch != minPitch)
-                    {
-                        Assert(pAllocation->SurfDesc.pitch > minPitch);
-                        pAllocation->D3DWidth = vboxWddmCalcWidthForPitch(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.format);
-                    }
-                    Assert(pAllocation->D3DWidth >= pAllocation->SurfDesc.width);
+
+        if (SUCCEEDED(hr))
+        {
+            if (pRc->RcDesc.fFlags.CubeMap)
+            {
+                if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height)
+                     || (pRc->cAllocations%6!=0))
+                {
+                    WARN(("unexpected cubemap texture config: (%d ; %d), allocs: %d",
+                            pAllocation->SurfDesc.width, pAllocation->SurfDesc.height, pRc->cAllocations));
+                    hr = E_INVALIDARG;
                 }
                 else
                 {
-                    Assert(pAllocation->D3DWidth == pAllocation->SurfDesc.width);
-                }
-            }
-            if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM)
-            {
-                pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pRc->cAllocations);
-                Assert(pavClientMem);
-                if (pavClientMem)
-                {
-                    for (UINT i = 0; i < pRc->cAllocations; ++i)
-                    {
-                        Assert(pRc->aAllocations[i].pvMem);
-                        pavClientMem[i] = pRc->aAllocations[i].pvMem;
-                    }
-                }
-                else
-                    hr = E_FAIL;
-            }
-            if (hr == S_OK)
+                    hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
+                                                pAllocation->D3DWidth,
+                                                VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc),
+                                                vboxDDI2D3DUsage(pRc->RcDesc.fFlags),
+                                                vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
+                                                vboxDDI2D3DPool(pRc->RcDesc.enmPool),
+                                                (IDirect3DCubeTexture9**)&pD3DIfTex,
+#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
+                                                NULL,
+#else
+                                                pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL,
+#endif
+                                                pavClientMem);
+                        Assert(hr == S_OK);
+                        Assert(pD3DIfTex);
+                        enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE;
+                }
+            }
+            else if (pRc->RcDesc.fFlags.Volume)
+            {
+                hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateVolumeTexture((IDirect3DDevice9Ex *)pDevice9If,
+                                            pAllocation->D3DWidth,
+                                            pAllocation->SurfDesc.height,
+                                            pAllocation->SurfDesc.depth,
+                                            pRc->cAllocations,
+                                            vboxDDI2D3DUsage(pRc->RcDesc.fFlags),
+                                            vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
+                                            vboxDDI2D3DPool(pRc->RcDesc.enmPool),
+                                            (IDirect3DVolumeTexture9**)&pD3DIfTex,
+#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
+                                            NULL,
+#else
+                                            pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL,
+#endif
+                                            pavClientMem);
+                Assert(hr == S_OK);
+                Assert(pD3DIfTex);
+                enmD3DIfType = VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE;
+            }
+            else
             {
                 hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice9If,
@@ -609,5 +643,5 @@
                                             vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
                                             vboxDDI2D3DPool(pRc->RcDesc.enmPool),
-                                            &pD3DIfTex,
+                                            (IDirect3DTexture9**)&pD3DIfTex,
 #ifdef VBOXWDDMDISP_DEBUG_NOSHARED
                                             NULL,
@@ -617,95 +651,29 @@
                                             pavClientMem);
                 Assert(hr == S_OK);
-                if (hr == S_OK)
-                {
-                    Assert(pD3DIfTex);
+                Assert(pD3DIfTex);
+                enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
+            }
+
+            if (SUCCEEDED(hr))
+            {
+                Assert(pD3DIfTex);
+                Assert(enmD3DIfType != VBOXDISP_D3DIFTYPE_UNDEFINED);
 #ifndef VBOXWDDMDISP_DEBUG_NOSHARED
-                    Assert(!!(pRc->RcDesc.fFlags.SharedResource) == !!(hSharedHandle));
+                Assert(!!(pRc->RcDesc.fFlags.SharedResource) == !!(hSharedHandle));
 #endif
-                    for (UINT i = 0; i < pRc->cAllocations; ++i)
-                    {
-                        PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];
-                        pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
-                        pAlloc->pD3DIf = pD3DIfTex;
-                        pAlloc->hSharedHandle = hSharedHandle;
-                        if (i > 0)
-                            pD3DIfTex->AddRef();
-                    }
-                }
-
-                if (pavClientMem)
-                    RTMemFree(pavClientMem);
-            }
-        }
-        else /*pRc->RcDesc.fFlags.CubeMap*/
-        {
-            PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];
-            IDirect3DCubeTexture9 *pD3DIfCubeTex;
-            HANDLE hSharedHandle = pAllocation->hSharedHandle;
-            void **pavClientMem = NULL;
-
-            if ( (pAllocation->SurfDesc.width!=pAllocation->SurfDesc.height)
-                 || (pRc->cAllocations%6!=0))
-            {
-                Assert(0);
-                hr = E_INVALIDARG;
-            }
-            else
-            {
-                hr = S_OK;
-                if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM)
-                {
-                    pavClientMem = (void**)RTMemAlloc(sizeof (pavClientMem[0]) * pRc->cAllocations);
-                    Assert(pavClientMem);
-                    if (pavClientMem)
-                    {
-                        for (UINT i = 0; i < pRc->cAllocations; ++i)
-                        {
-                            pavClientMem[i] = pRc->aAllocations[i].pvMem;
-                        }
-                    }
-                    else
-                        hr = E_FAIL;
-                }
-
-                if (hr == S_OK)
-                {
-                    hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
-                                            pAllocation->SurfDesc.width,
-                                            VBOXDISP_CUBEMAP_LEVELS_COUNT(pRc),
-                                            vboxDDI2D3DUsage(pRc->RcDesc.fFlags),
-                                            vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
-                                            vboxDDI2D3DPool(pRc->RcDesc.enmPool),
-                                            &pD3DIfCubeTex,
-#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
-                                            NULL,
-#else
-                                            pRc->RcDesc.fFlags.SharedResource ? &hSharedHandle : NULL,
-#endif
-                                            pavClientMem);
-                    Assert(hr == S_OK);
-                    if (hr == S_OK)
-                    {
-                        Assert(pD3DIfCubeTex);
-#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
-                        Assert(!!(pRc->RcDesc.fFlags.SharedResource) == !!(hSharedHandle));
-#endif
-
-                        for (UINT i = 0; i < pRc->cAllocations; ++i)
-                        {
-                            PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];
-                            pAlloc->enmD3DIfType = VBOXDISP_D3DIFTYPE_CUBE_TEXTURE;
-                            pAlloc->pD3DIf = pD3DIfCubeTex;
-                            pAlloc->hSharedHandle = hSharedHandle;
-                            if (i > 0)
-                                pD3DIfCubeTex->AddRef();
-                        }
-                    }
-
-                    if (pavClientMem)
-                        RTMemFree(pavClientMem);
-                }
-            }
-        }
+                for (UINT i = 0; i < pRc->cAllocations; ++i)
+                {
+                    PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];
+                    pAlloc->enmD3DIfType = enmD3DIfType;
+                    pAlloc->pD3DIf = pD3DIfTex;
+                    pAlloc->hSharedHandle = hSharedHandle;
+                    if (i > 0)
+                        pD3DIfTex->AddRef();
+                }
+            }
+        }
+
+        if (pavClientMem)
+            RTMemFree(pavClientMem);
     }
     else if (pRc->RcDesc.fFlags.RenderTarget || pRc->RcDesc.fFlags.Primary)
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp	(revision 43334)
@@ -2209,4 +2209,11 @@
             VBOXVDBG_DUMP_SETTEXTURE(pRc);
         }
+        else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE)
+        {
+            pD3DIfTex = (IDirect3DVolumeTexture9*)pRc->aAllocations[0].pD3DIf;
+
+            VBOXVDBG_BREAK_SHARED(pRc);
+            VBOXVDBG_DUMP_SETTEXTURE(pRc);
+        }
         else
         {
@@ -2701,15 +2708,47 @@
 }
 
+AssertCompile(sizeof (D3DDDIBOX) == sizeof (VBOXBOX3D));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Left) == RT_SIZEOFMEMB(VBOXBOX3D, Left));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Top) == RT_SIZEOFMEMB(VBOXBOX3D, Top));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Right) == RT_SIZEOFMEMB(VBOXBOX3D, Right));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Bottom) == RT_SIZEOFMEMB(VBOXBOX3D, Bottom));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Front) == RT_SIZEOFMEMB(VBOXBOX3D, Front));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Back) == RT_SIZEOFMEMB(VBOXBOX3D, Back));
+
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Left) == RT_OFFSETOF(VBOXBOX3D, Left));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Top) == RT_OFFSETOF(VBOXBOX3D, Top));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Right) == RT_OFFSETOF(VBOXBOX3D, Right));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Bottom) == RT_OFFSETOF(VBOXBOX3D, Bottom));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Front) == RT_OFFSETOF(VBOXBOX3D, Front));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Back) == RT_OFFSETOF(VBOXBOX3D, Back));
+
 static HRESULT APIENTRY vboxWddmDDevVolBlt(HANDLE hDevice, CONST D3DDDIARG_VOLUMEBLT* pData)
 {
     VBOXDISP_DDI_PROLOGUE_DEV(hDevice);
+    vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice));
+    PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
+    Assert(pDevice);
+    VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
+    IDirect3DDevice9 * pDevice9If = VBOXDISP_D3DEV(pDevice);
+    PVBOXWDDMDISP_RESOURCE pDstRc = (PVBOXWDDMDISP_RESOURCE)pData->hDstResource;
+    PVBOXWDDMDISP_RESOURCE pSrcRc = (PVBOXWDDMDISP_RESOURCE)pData->hSrcResource;
+    /* requirements for D3DDevice9::UpdateTexture */
+    Assert(pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE);
+    Assert(pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE);
+    IDirect3DVolumeTexture9 * pSrcTex = (IDirect3DVolumeTexture9*)pSrcRc->aAllocations[0].pD3DIf;
+    IDirect3DVolumeTexture9 * pDstTex = (IDirect3DVolumeTexture9*)pDstRc->aAllocations[0].pD3DIf;
+    VBOXPOINT3D Point;
+    Point.x = pData->DstX;
+    Point.y = pData->DstY;
+    Point.z = pData->DstZ;
+
+    HRESULT hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9VolTexBlt((IDirect3DDevice9Ex*)pDevice9If, pSrcTex, pDstTex,
+                                        (VBOXBOX3D*)&pData->SrcBox, &Point);
+    if (FAILED(hr))
+        WARN(("pfnVBoxWineExD3DDev9VolTexBlt failed hr 0x%x", hr));
+    else
+        hr = S_OK;
     vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice));
-    PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
-    Assert(pDevice);
-    VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
-    Assert(0);
-//    @todo: vboxWddmDalCheckAdd(pDevice);
-    vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice));
-    return E_FAIL;
+    return hr;;
 }
 
@@ -2739,7 +2778,10 @@
     /* requirements for D3DDevice9::UpdateTexture */
     Assert(pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE
-            || pDstRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_CUBE_TEXTURE);
+            || pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE
+            || pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE);
     Assert(pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_TEXTURE
-            || pSrcRc->aAllocations[0].enmD3DIfType==VBOXDISP_D3DIFTYPE_CUBE_TEXTURE);
+            || pSrcRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_CUBE_TEXTURE
+            || pDstRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE);
+    Assert(pSrcRc->aAllocations[0].enmD3DIfType == pDstRc->aAllocations[0].enmD3DIfType);
     Assert(pSrcRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM);
     Assert(pDstRc->RcDesc.enmPool != D3DDDIPOOL_SYSTEMMEM);
@@ -2769,4 +2811,7 @@
     else
     {
+        Assert(pDstRc->aAllocations[0].enmD3DIfType != VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE);
+        Assert(pSrcRc->aAllocations[0].enmD3DIfType != VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE);
+
         IDirect3DSurface9 *pSrcSurfIf = NULL;
         IDirect3DSurface9 *pDstSurfIf = NULL;
@@ -3040,4 +3085,19 @@
 }
 
+AssertCompile(sizeof (D3DDDIBOX) == sizeof (D3DBOX));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Left) == RT_SIZEOFMEMB(D3DBOX, Left));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Top) == RT_SIZEOFMEMB(D3DBOX, Top));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Right) == RT_SIZEOFMEMB(D3DBOX, Right));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Bottom) == RT_SIZEOFMEMB(D3DBOX, Bottom));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Front) == RT_SIZEOFMEMB(D3DBOX, Front));
+AssertCompile(RT_SIZEOFMEMB(D3DDDIBOX, Back) == RT_SIZEOFMEMB(D3DBOX, Back));
+
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Left) == RT_OFFSETOF(D3DBOX, Left));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Top) == RT_OFFSETOF(D3DBOX, Top));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Right) == RT_OFFSETOF(D3DBOX, Right));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Bottom) == RT_OFFSETOF(D3DBOX, Bottom));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Front) == RT_OFFSETOF(D3DBOX, Front));
+AssertCompile(RT_OFFSETOF(D3DDDIBOX, Back) == RT_OFFSETOF(D3DBOX, Back));
+
 static HRESULT APIENTRY vboxWddmDDevLock(HANDLE hDevice, D3DDDIARG_LOCK* pData)
 {
@@ -3070,5 +3130,5 @@
             Assert(pTexAlloc->pD3DIf);
             RECT *pRect = NULL;
-            bool bNeedResynch = false;
+            BOOL fNeedLock = TRUE;
             Assert(!pData->Flags.RangeValid);
             Assert(!pData->Flags.BoxValid);
@@ -3080,7 +3140,58 @@
             /* else - we lock the entire texture, pRect == NULL */
 
-            if (!pLockAlloc->LockInfo.cLocks)
+            if (pLockAlloc->LockInfo.cLocks)
+            {
+                Assert(pLockAlloc->LockInfo.fFlags.AreaValid == pData->Flags.AreaValid);
+                if (pLockAlloc->LockInfo.fFlags.AreaValid && pData->Flags.AreaValid)
+                {
+                    Assert(pLockAlloc->LockInfo.Area.left == pData->Area.left);
+                    Assert(pLockAlloc->LockInfo.Area.top == pData->Area.top);
+                    Assert(pLockAlloc->LockInfo.Area.right == pData->Area.right);
+                    Assert(pLockAlloc->LockInfo.Area.bottom == pData->Area.bottom);
+                }
+                Assert(pLockAlloc->LockInfo.LockedRect.pBits);
+                Assert((pLockAlloc->LockInfo.fFlags.Value & ~1) == (pData->Flags.Value & ~1)); /* <- 1 is "ReadOnly" flag */
+
+                if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly)
+                {
+                    switch (pTexAlloc->enmD3DIfType)
+                    {
+                        case VBOXDISP_D3DIFTYPE_TEXTURE:
+                            hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex);
+                            break;
+                        case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE:
+                            hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex),
+                                    VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex));
+                            break;
+                        case VBOXDISP_D3DIFTYPE_SURFACE:
+                            hr = pD3DIfSurface->UnlockRect();
+                            break;
+                        default:
+                            Assert(0);
+                            break;
+                    }
+                    Assert(hr == S_OK);
+                }
+                else
+                {
+                    fNeedLock = FALSE;
+                }
+            }
+
+            if (fNeedLock && SUCCEEDED(hr))
             {
                 VBOXVDBG_CHECK_SMSYNC(pRc);
+
+                pLockAlloc->LockInfo.fFlags = pData->Flags;
+                if (pRect)
+                {
+                    pLockAlloc->LockInfo.Area = *pRect;
+                    Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 1);
+                }
+                else
+                {
+                    Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 0);
+                }
+
                 switch (pTexAlloc->enmD3DIfType)
                 {
@@ -3107,89 +3218,12 @@
                         break;
                 }
-                Assert(hr == S_OK);
-                if (hr == S_OK)
-                {
-                    pLockAlloc->LockInfo.fFlags = pData->Flags;
-                    if (pRect)
-                    {
-                        pLockAlloc->LockInfo.Area = *pRect;
-                        Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 1);
-                    }
-                    else
-                    {
-                        Assert(pLockAlloc->LockInfo.fFlags.AreaValid == 0);
-                    }
-
-                    bNeedResynch = !pData->Flags.Discard;
-                }
-            }
-            else
-            {
-                Assert(pLockAlloc->LockInfo.fFlags.AreaValid == pData->Flags.AreaValid);
-                if (pLockAlloc->LockInfo.fFlags.AreaValid && pData->Flags.AreaValid)
-                {
-                    Assert(pLockAlloc->LockInfo.Area.left == pData->Area.left);
-                    Assert(pLockAlloc->LockInfo.Area.top == pData->Area.top);
-                    Assert(pLockAlloc->LockInfo.Area.right == pData->Area.right);
-                    Assert(pLockAlloc->LockInfo.Area.bottom == pData->Area.bottom);
-                }
-                Assert(pLockAlloc->LockInfo.LockedRect.pBits);
-
-                bNeedResynch = pLockAlloc->LockInfo.fFlags.Discard && !pData->Flags.Discard;
-
-                Assert(!bNeedResynch);
-
-                if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly)
-                {
-                    switch (pTexAlloc->enmD3DIfType)
-                    {
-                        case VBOXDISP_D3DIFTYPE_TEXTURE:
-                            hr = pD3DIfTex->UnlockRect(pData->SubResourceIndex);
-                            break;
-                        case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE:
-                            hr = pD3DIfCubeTex->UnlockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex),
-                                    VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex));
-                            break;
-                        case VBOXDISP_D3DIFTYPE_SURFACE:
-                            hr = pD3DIfSurface->UnlockRect();
-                            break;
-                        default:
-                            Assert(0);
-                            break;
-                    }
-                    Assert(hr == S_OK);
-                    if (hr == S_OK)
-                    {
-                        switch (pTexAlloc->enmD3DIfType)
-                        {
-                            case VBOXDISP_D3DIFTYPE_TEXTURE:
-                                hr = pD3DIfTex->LockRect(pData->SubResourceIndex,
-                                        &pLockAlloc->LockInfo.LockedRect,
-                                        pRect,
-                                        vboxDDI2D3DLockFlags(pData->Flags));
-                                break;
-                            case VBOXDISP_D3DIFTYPE_CUBE_TEXTURE:
-                                hr = pD3DIfCubeTex->LockRect(VBOXDISP_CUBEMAP_INDEX_TO_FACE(pRc, pData->SubResourceIndex),
-                                        VBOXDISP_CUBEMAP_INDEX_TO_LEVEL(pRc, pData->SubResourceIndex),
-                                        &pLockAlloc->LockInfo.LockedRect,
-                                        pRect,
-                                        vboxDDI2D3DLockFlags(pData->Flags));
-                                break;
-                            case VBOXDISP_D3DIFTYPE_SURFACE:
-                                hr = pD3DIfSurface->LockRect(&pLockAlloc->LockInfo.LockedRect,
-                                        pRect,
-                                        vboxDDI2D3DLockFlags(pData->Flags));
-                                break;
-                            default:
-                                Assert(0);
-                                break;
-                        }
-                        Assert(hr == S_OK);
-                        pLockAlloc->LockInfo.fFlags.ReadOnly = 0;
-                    }
-                }
-            }
-
-            if (hr == S_OK)
+
+                if (FAILED(hr))
+                {
+                    WARN(("LockRect failed, hr", hr));
+                }
+            }
+
+            if (SUCCEEDED(hr))
             {
                 ++pLockAlloc->LockInfo.cLocks;
@@ -3210,4 +3244,97 @@
 
                 VBOXVDBG_DUMP_LOCK_ST(pData);
+
+                hr = S_OK;
+            }
+        }
+        else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE)
+        {
+            PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0];
+            Assert(pData->SubResourceIndex < pRc->cAllocations);
+            PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex];
+            IDirect3DVolumeTexture9 *pD3DIfTex = (IDirect3DVolumeTexture9*)pTexAlloc->pD3DIf;
+            Assert(pTexAlloc->pD3DIf);
+            D3DDDIBOX *pBox = NULL;
+            BOOL fNeedLock = TRUE;
+            Assert(!pData->Flags.AreaValid);
+            Assert(!pData->Flags.BoxValid);
+            if (pData->Flags.BoxValid)
+            {
+                pBox = &pData->Box;
+            }
+
+            /* else - we lock the entire texture, pBox == NULL */
+
+            if (pLockAlloc->LockInfo.cLocks)
+            {
+                Assert(pLockAlloc->LockInfo.fFlags.BoxValid == pData->Flags.BoxValid);
+                if (pLockAlloc->LockInfo.fFlags.BoxValid && pData->Flags.BoxValid)
+                {
+                    Assert(pLockAlloc->LockInfo.Box.Left == pData->Box.Left);
+                    Assert(pLockAlloc->LockInfo.Box.Top == pData->Box.Top);
+                    Assert(pLockAlloc->LockInfo.Box.Right == pData->Box.Right);
+                    Assert(pLockAlloc->LockInfo.Box.Bottom == pData->Box.Bottom);
+                    Assert(pLockAlloc->LockInfo.Box.Front == pData->Box.Front);
+                    Assert(pLockAlloc->LockInfo.Box.Back == pData->Box.Back);
+                }
+                Assert(pLockAlloc->LockInfo.LockedBox.pBits);
+                Assert((pLockAlloc->LockInfo.fFlags.Value & ~1) == (pData->Flags.Value & ~1)); /* <- 1 is "ReadOnly" flag */
+
+                if (pLockAlloc->LockInfo.fFlags.ReadOnly && !pData->Flags.ReadOnly)
+                {
+                    hr = pD3DIfTex->UnlockBox(pData->SubResourceIndex);
+                    Assert(hr == S_OK);
+                }
+                else
+                {
+                    fNeedLock = FALSE;
+                }
+            }
+
+            if (fNeedLock && SUCCEEDED(hr))
+            {
+                VBOXVDBG_CHECK_SMSYNC(pRc);
+
+                pLockAlloc->LockInfo.fFlags = pData->Flags;
+                if (pBox)
+                {
+                    pLockAlloc->LockInfo.Box = *pBox;
+                    Assert(pLockAlloc->LockInfo.fFlags.BoxValid == 1);
+                }
+                else
+                {
+                    Assert(pLockAlloc->LockInfo.fFlags.BoxValid == 0);
+                }
+
+                hr = pD3DIfTex->LockBox(pData->SubResourceIndex,
+                                &pLockAlloc->LockInfo.LockedBox,
+                                (D3DBOX*)pBox,
+                                vboxDDI2D3DLockFlags(pData->Flags));
+                if (FAILED(hr))
+                {
+                    WARN(("LockRect failed, hr", hr));
+                }
+            }
+
+            if (SUCCEEDED(hr))
+            {
+                ++pLockAlloc->LockInfo.cLocks;
+
+                if (!pData->Flags.NotifyOnly)
+                {
+                    pData->pSurfData = pLockAlloc->LockInfo.LockedBox.pBits;
+                    pData->Pitch = pLockAlloc->LockInfo.LockedBox.RowPitch;
+                    pData->SlicePitch = pLockAlloc->LockInfo.LockedBox.SlicePitch;
+                    Assert(!pLockAlloc->pvMem);
+                }
+                else
+                {
+                    Assert(pLockAlloc->pvMem);
+                    Assert(pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM);
+                }
+
+                VBOXVDBG_DUMP_LOCK_ST(pData);
+
+                hr = S_OK;
             }
         }
@@ -3546,10 +3673,27 @@
                         break;
                 }
-                Assert(hr == S_OK);
+                if (FAILED(hr))
+                    WARN(("UnlockRect failed, hr 0x%x", hr));
                 VBOXVDBG_CHECK_SMSYNC(pRc);
             }
-            else
-            {
-                Assert(pLockAlloc->LockInfo.cLocks < UINT32_MAX);
+        }
+        else if (pRc->aAllocations[0].enmD3DIfType == VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE)
+        {
+            Assert(pData->SubResourceIndex < pRc->cAllocations);
+            PVBOXWDDMDISP_ALLOCATION pLockAlloc = &pRc->aAllocations[pData->SubResourceIndex];
+
+            VBOXVDBG_DUMP_UNLOCK_ST(pData);
+
+            --pLockAlloc->LockInfo.cLocks;
+            Assert(pLockAlloc->LockInfo.cLocks < UINT32_MAX);
+            if (!pLockAlloc->LockInfo.cLocks)
+            {
+                PVBOXWDDMDISP_ALLOCATION pTexAlloc = &pRc->aAllocations[0];
+                Assert(pTexAlloc->pD3DIf);
+                IDirect3DVolumeTexture9 *pD3DIfTex = (IDirect3DVolumeTexture9*)pTexAlloc->pD3DIf;
+                hr = pD3DIfTex->UnlockBox(pData->SubResourceIndex);
+                if (FAILED(hr))
+                    WARN(("UnlockBox failed, hr 0x%x", hr));
+                VBOXVDBG_CHECK_SMSYNC(pRc);
             }
         }
@@ -3858,4 +4002,27 @@
 
         pAllocation->SurfDesc.VidPnSourceId = pResource->VidPnSourceId;
+
+        if (pRc->RcDesc.enmPool == D3DDDIPOOL_SYSTEMMEM)
+        {
+            Assert(pAllocation->pvMem);
+            Assert(pAllocation->SurfDesc.pitch);
+            UINT minPitch = vboxWddmCalcPitch(pAllocation->SurfDesc.width, pAllocation->SurfDesc.format);
+            Assert(minPitch);
+            if (minPitch)
+            {
+                if (pAllocation->SurfDesc.pitch != minPitch)
+                {
+                    Assert(pAllocation->SurfDesc.pitch > minPitch);
+                    pAllocation->D3DWidth = vboxWddmCalcWidthForPitch(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.format);
+                    Assert(VBOXWDDMDISP_IS_TEXTURE(pRc->RcDesc.fFlags) && !pRc->RcDesc.fFlags.CubeMap); /* <- tested for textures only! */
+                }
+                Assert(pAllocation->D3DWidth >= pAllocation->SurfDesc.width);
+            }
+            else
+            {
+                Assert(pAllocation->D3DWidth == pAllocation->SurfDesc.width);
+            }
+        }
+
     }
 
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h	(revision 43334)
@@ -234,5 +234,8 @@
     };
     D3DDDI_LOCKFLAGS fFlags;
-    D3DLOCKED_RECT LockedRect;
+    union {
+        D3DLOCKED_RECT LockedRect;
+        D3DLOCKED_BOX LockedBox;
+    };
 #ifdef VBOXWDDMDISP_DEBUG
     PVOID pvData;
@@ -246,4 +249,5 @@
     VBOXDISP_D3DIFTYPE_TEXTURE,
     VBOXDISP_D3DIFTYPE_CUBE_TEXTURE,
+    VBOXDISP_D3DIFTYPE_VOLUME_TEXTURE,
     VBOXDISP_D3DIFTYPE_VERTEXBUFFER,
     VBOXDISP_D3DIFTYPE_INDEXBUFFER
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp	(revision 43334)
@@ -66,8 +66,29 @@
         }
 
+        pD3D->pfnVBoxWineExD3DDev9CreateVolumeTexture = (PFNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9CreateVolumeTexture");
+        if (!pD3D->pfnVBoxWineExD3DDev9CreateVolumeTexture)
+        {
+            WARN(("no VBoxWineExD3DDev9CreateVolumeTexture"));
+            break;
+        }
+
         pD3D->pfnVBoxWineExD3DDev9Flush = (PFNVBOXWINEEXD3DDEV9_FLUSH)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9Flush");
         if (!pD3D->pfnVBoxWineExD3DDev9Flush)
         {
             WARN(("no VBoxWineExD3DDev9Flush"));
+            break;
+        }
+
+        pD3D->pfnVBoxWineExD3DDev9VolBlt = (PFNVBOXWINEEXD3DDEV9_VOLBLT)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9VolBlt");
+        if (!pD3D->pfnVBoxWineExD3DDev9VolBlt)
+        {
+            WARN(("no VBoxWineExD3DDev9VolBlt"));
+            break;
+        }
+
+        pD3D->pfnVBoxWineExD3DDev9VolTexBlt = (PFNVBOXWINEEXD3DDEV9_VOLTEXBLT)GetProcAddress(pD3D->hD3DLib, "VBoxWineExD3DDev9VolTexBlt");
+        if (!pD3D->pfnVBoxWineExD3DDev9VolTexBlt)
+        {
+            WARN(("no VBoxWineExD3DDev9VolTexBlt"));
             break;
         }
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.h	(revision 43334)
@@ -59,5 +59,11 @@
     PFNVBOXWINEEXD3DDEV9_CREATECUBETEXTURE pfnVBoxWineExD3DDev9CreateCubeTexture;
 
+    PFNVBOXWINEEXD3DDEV9_CREATEVOLUMETEXTURE pfnVBoxWineExD3DDev9CreateVolumeTexture;
+
     PFNVBOXWINEEXD3DDEV9_FLUSH pfnVBoxWineExD3DDev9Flush;
+
+    PFNVBOXWINEEXD3DDEV9_VOLBLT pfnVBoxWineExD3DDev9VolBlt;
+
+    PFNVBOXWINEEXD3DDEV9_VOLTEXBLT pfnVBoxWineExD3DDev9VolTexBlt;
 
     PFNVBOXWINEEXD3DDEV9_UPDATE pfnVBoxWineExD3DDev9Update;
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxScreen.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxScreen.cpp	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxScreen.cpp	(revision 43334)
@@ -17,4 +17,5 @@
  */
 
+#include "VBoxDispD3DCmn.h"
 #include "VBoxScreen.h"
 
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.h	(revision 43314)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.h	(revision 43334)
@@ -20,5 +20,4 @@
 #define ___VBoxUhgsmiKmt_h__
 
-#include "VBoxUhgsmiBase.h"
 #include "VBoxDispD3DCmn.h"
 
