Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp	(revision 94264)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp	(revision 94265)
@@ -2578,8 +2578,7 @@
 {
 #ifdef VMSVGA3D_DX
-    DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXReadbackQuery(pThisCC, idDXContext);
+    //DEBUG_BREAKPOINT_TEST();
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXReadbackQuery(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -2992,7 +2991,6 @@
 #ifdef VMSVGA3D_DX
     DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXDestroyBlendState(pThisCC, idDXContext);
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXDestroyBlendState(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -3021,7 +3019,6 @@
 #ifdef VMSVGA3D_DX
     DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXDestroyDepthStencilState(pThisCC, idDXContext);
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -3050,7 +3047,6 @@
 #ifdef VMSVGA3D_DX
     DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXDestroyRasterizerState(pThisCC, idDXContext);
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXDestroyRasterizerState(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -3079,7 +3075,6 @@
 #ifdef VMSVGA3D_DX
     DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXDestroySamplerState(pThisCC, idDXContext);
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXDestroySamplerState(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -3152,5 +3147,5 @@
 {
 #ifdef VMSVGA3D_DX
-    DEBUG_BREAKPOINT_TEST();
+    //DEBUG_BREAKPOINT_TEST();
     RT_NOREF(cbCmd);
     return vmsvga3dDXDestroyStreamOutput(pThisCC, idDXContext, pCmd);
@@ -3211,8 +3206,62 @@
 {
 #ifdef VMSVGA3D_DX
-    DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXBufferCopy(pThisCC, idDXContext);
+    //DEBUG_BREAKPOINT_TEST();
+    RT_NOREF(idDXContext, cbCmd);
+
+    int rc;
+
+    /** @todo Backend should o the copy is both buffers have a hardware resource. */
+    SVGA3dSurfaceImageId imageBufferSrc;
+    imageBufferSrc.sid = pCmd->src;
+    imageBufferSrc.face = 0;
+    imageBufferSrc.mipmap = 0;
+
+    SVGA3dSurfaceImageId imageBufferDest;
+    imageBufferDest.sid = pCmd->dest;
+    imageBufferDest.face = 0;
+    imageBufferDest.mipmap = 0;
+
+    /*
+     * Map the source buffer.
+     */
+    VMSVGA3D_MAPPED_SURFACE mapBufferSrc;
+    rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferSrc, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBufferSrc);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Map the destination buffer.
+         */
+        VMSVGA3D_MAPPED_SURFACE mapBufferDest;
+        rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferDest, NULL, VMSVGA3D_SURFACE_MAP_WRITE, &mapBufferDest);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Copy the source buffer to the destination.
+             */
+            uint8_t const *pu8BufferSrc = (uint8_t *)mapBufferSrc.pvData;
+            uint32_t const cbBufferSrc = mapBufferSrc.box.w * mapBufferSrc.cbPixel;
+
+            uint8_t *pu8BufferDest = (uint8_t *)mapBufferDest.pvData;
+            uint32_t const cbBufferDest = mapBufferDest.box.w * mapBufferDest.cbPixel;
+
+            if (   pCmd->srcX < cbBufferSrc
+                && pCmd->width <= cbBufferSrc- pCmd->srcX
+                && pCmd->destX < cbBufferDest
+                && pCmd->width <= cbBufferDest - pCmd->destX)
+            {
+                RT_UNTRUSTED_VALIDATED_FENCE();
+
+                memcpy(&pu8BufferDest[pCmd->destX], &pu8BufferSrc[pCmd->srcX], pCmd->width);
+            }
+            else
+                ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
+
+            vmsvga3dSurfaceUnmap(pThisCC, &imageBufferDest, &mapBufferDest, true);
+        }
+
+        vmsvga3dSurfaceUnmap(pThisCC, &imageBufferSrc, &mapBufferSrc, false);
+    }
+
+    return rc;
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -3351,8 +3400,7 @@
 {
 #ifdef VMSVGA3D_DX
-    DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXBindAllQuery(pThisCC, idDXContext);
+    //DEBUG_BREAKPOINT_TEST();
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXBindAllQuery(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
@@ -3366,8 +3414,7 @@
 {
 #ifdef VMSVGA3D_DX
-    DEBUG_BREAKPOINT_TEST();
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    RT_NOREF(pSvgaR3State, pCmd, cbCmd);
-    return vmsvga3dDXReadbackAllQuery(pThisCC, idDXContext);
+    //DEBUG_BREAKPOINT_TEST();
+    RT_NOREF(cbCmd);
+    return vmsvga3dDXReadbackAllQuery(pThisCC, idDXContext, pCmd);
 #else
     RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp	(revision 94264)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp	(revision 94265)
@@ -38,4 +38,7 @@
 #include "DevVGA-SVGA3d-internal.h"
 #include "DevVGA-SVGA-internal.h"
+
+
+static int dxReadbackQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId, SVGACOTableDXQueryEntry *pEntry);
 
 
@@ -1087,5 +1090,5 @@
 
     SVGACOTableDXQueryEntry *pEntry = &pDXContext->cot.paQuery[queryId];
-    Assert(pEntry->state == SVGADX_QDSTATE_IDLE || SVGADX_QDSTATE_PENDING);
+    Assert(pEntry->state == SVGADX_QDSTATE_IDLE || pEntry->state == SVGADX_QDSTATE_PENDING || pEntry->state == SVGADX_QDSTATE_FINISHED);
     if (pEntry->state != SVGADX_QDSTATE_ACTIVE)
     {
@@ -1129,5 +1132,5 @@
 
 
-int vmsvga3dDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext)
+int vmsvga3dDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackQuery const *pCmd)
 {
     int rc;
@@ -1141,5 +1144,14 @@
     AssertRCReturn(rc, rc);
 
-    rc = pSvgaR3State->pFuncsDX->pfnDXReadbackQuery(pThisCC, pDXContext);
+    SVGA3dQueryId const queryId = pCmd->queryId;
+
+    ASSERT_GUEST_RETURN(pDXContext->cot.paQuery, VERR_INVALID_STATE);
+    ASSERT_GUEST_RETURN(queryId < pDXContext->cot.cQuery, VERR_INVALID_PARAMETER);
+    RT_UNTRUSTED_VALIDATED_FENCE();
+
+    SVGACOTableDXQueryEntry *pEntry = &pDXContext->cot.paQuery[queryId];
+    Assert(pEntry->state == SVGADX_QDSTATE_PENDING);
+
+    rc = dxReadbackQuery(pThisCC, pDXContext, queryId, pEntry);
     return rc;
 }
@@ -1613,5 +1625,5 @@
     AssertRCReturn(rc, rc);
 
-    const SVGA3dBlendStateId blendId = pCmd->blendId;
+    SVGA3dBlendStateId const blendId = pCmd->blendId;
 
     ASSERT_GUEST_RETURN(pDXContext->cot.paBlendState, VERR_INVALID_STATE);
@@ -1629,5 +1641,5 @@
 
 
-int vmsvga3dDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext)
+int vmsvga3dDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyBlendState const *pCmd)
 {
     int rc;
@@ -1641,5 +1653,15 @@
     AssertRCReturn(rc, rc);
 
-    rc = pSvgaR3State->pFuncsDX->pfnDXDestroyBlendState(pThisCC, pDXContext);
+    SVGA3dBlendStateId const blendId = pCmd->blendId;
+
+    ASSERT_GUEST_RETURN(pDXContext->cot.paBlendState, VERR_INVALID_STATE);
+    ASSERT_GUEST_RETURN(blendId < pDXContext->cot.cBlendState, VERR_INVALID_PARAMETER);
+    RT_UNTRUSTED_VALIDATED_FENCE();
+
+    pSvgaR3State->pFuncsDX->pfnDXDestroyBlendState(pThisCC, pDXContext, blendId);
+
+    SVGACOTableDXBlendStateEntry *pEntry = &pDXContext->cot.paBlendState[blendId];
+    RT_ZERO(*pEntry);
+
     return rc;
 }
@@ -1689,5 +1711,5 @@
 
 
-int vmsvga3dDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext)
+int vmsvga3dDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilState const *pCmd)
 {
     int rc;
@@ -1701,5 +1723,15 @@
     AssertRCReturn(rc, rc);
 
-    rc = pSvgaR3State->pFuncsDX->pfnDXDestroyDepthStencilState(pThisCC, pDXContext);
+    SVGA3dDepthStencilStateId const depthStencilId = pCmd->depthStencilId;
+
+    ASSERT_GUEST_RETURN(pDXContext->cot.paDepthStencil, VERR_INVALID_STATE);
+    ASSERT_GUEST_RETURN(depthStencilId < pDXContext->cot.cDepthStencil, VERR_INVALID_PARAMETER);
+    RT_UNTRUSTED_VALIDATED_FENCE();
+
+    pSvgaR3State->pFuncsDX->pfnDXDestroyDepthStencilState(pThisCC, pDXContext, depthStencilId);
+
+    SVGACOTableDXDepthStencilEntry *pEntry = &pDXContext->cot.paDepthStencil[depthStencilId];
+    RT_ZERO(*pEntry);
+
     return rc;
 }
@@ -1748,5 +1780,5 @@
 
 
-int vmsvga3dDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext)
+int vmsvga3dDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRasterizerState const *pCmd)
 {
     int rc;
@@ -1760,5 +1792,15 @@
     AssertRCReturn(rc, rc);
 
-    rc = pSvgaR3State->pFuncsDX->pfnDXDestroyRasterizerState(pThisCC, pDXContext);
+    SVGA3dRasterizerStateId const rasterizerId = pCmd->rasterizerId;
+
+    ASSERT_GUEST_RETURN(pDXContext->cot.paRasterizerState, VERR_INVALID_STATE);
+    ASSERT_GUEST_RETURN(rasterizerId < pDXContext->cot.cRasterizerState, VERR_INVALID_PARAMETER);
+    RT_UNTRUSTED_VALIDATED_FENCE();
+
+    rc = pSvgaR3State->pFuncsDX->pfnDXDestroyRasterizerState(pThisCC, pDXContext, rasterizerId);
+
+    SVGACOTableDXRasterizerStateEntry *pEntry = &pDXContext->cot.paRasterizerState[rasterizerId];
+    RT_ZERO(*pEntry);
+
     return rc;
 }
@@ -1800,5 +1842,5 @@
 
 
-int vmsvga3dDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext)
+int vmsvga3dDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroySamplerState const *pCmd)
 {
     int rc;
@@ -1812,5 +1854,15 @@
     AssertRCReturn(rc, rc);
 
-    rc = pSvgaR3State->pFuncsDX->pfnDXDestroySamplerState(pThisCC, pDXContext);
+    SVGA3dSamplerId const samplerId = pCmd->samplerId;
+
+    ASSERT_GUEST_RETURN(pDXContext->cot.paSampler, VERR_INVALID_STATE);
+    ASSERT_GUEST_RETURN(samplerId < pDXContext->cot.cSampler, VERR_INVALID_PARAMETER);
+    RT_UNTRUSTED_VALIDATED_FENCE();
+
+    pSvgaR3State->pFuncsDX->pfnDXDestroySamplerState(pThisCC, pDXContext, samplerId);
+
+    SVGACOTableDXSamplerEntry *pEntry = &pDXContext->cot.paSampler[samplerId];
+    RT_ZERO(*pEntry);
+
     return rc;
 }
@@ -2300,34 +2352,84 @@
 
 
-int vmsvga3dDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext)
-{
-    int rc;
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    AssertReturn(pSvgaR3State->pFuncsDX && pSvgaR3State->pFuncsDX->pfnDXBindAllQuery, VERR_INVALID_STATE);
-    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
-    AssertReturn(p3dState, VERR_INVALID_STATE);
-
-    PVMSVGA3DDXCONTEXT pDXContext;
-    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
-    AssertRCReturn(rc, rc);
-
-    rc = pSvgaR3State->pFuncsDX->pfnDXBindAllQuery(pThisCC, pDXContext);
-    return rc;
-}
-
-
-int vmsvga3dDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext)
-{
-    int rc;
-    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
-    AssertReturn(pSvgaR3State->pFuncsDX && pSvgaR3State->pFuncsDX->pfnDXReadbackAllQuery, VERR_INVALID_STATE);
-    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
-    AssertReturn(p3dState, VERR_INVALID_STATE);
-
-    PVMSVGA3DDXCONTEXT pDXContext;
-    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
-    AssertRCReturn(rc, rc);
-
-    rc = pSvgaR3State->pFuncsDX->pfnDXReadbackAllQuery(pThisCC, pDXContext);
+int vmsvga3dDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllQuery const *pCmd)
+{
+    int rc;
+    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
+    AssertReturn(pSvgaR3State->pFuncsDX && pSvgaR3State->pFuncsDX->pfnDXBindQuery, VERR_INVALID_STATE);
+    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
+    AssertReturn(p3dState, VERR_INVALID_STATE);
+
+    RT_NOREF(idDXContext);
+
+    PVMSVGA3DDXCONTEXT pDXContext;
+    rc = vmsvga3dDXContextFromCid(p3dState, pCmd->cid, &pDXContext);
+    AssertRCReturn(rc, rc);
+
+    for (uint32_t i = 0; i < pDXContext->cot.cQuery; ++i)
+    {
+        SVGACOTableDXQueryEntry *pEntry = &pDXContext->cot.paQuery[i];
+        if (pEntry->type != SVGA3D_QUERYTYPE_INVALID)
+        {
+            pEntry->mobid = pCmd->mobid;
+            pSvgaR3State->pFuncsDX->pfnDXBindQuery(pThisCC, pDXContext, i);
+        }
+    }
+
+    return rc;
+}
+
+
+static int dxReadbackQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId, SVGACOTableDXQueryEntry *pEntry)
+{
+    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
+
+    PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pEntry->mobid);
+    ASSERT_GUEST_RETURN(pMob, VERR_INVALID_STATE); /* No MOB bound. */
+
+    uint32_t const cbMob = vmsvgaR3MobSize(pMob);
+    ASSERT_GUEST_RETURN(cbMob > pEntry->offset, VERR_INVALID_PARAMETER);
+    uint32_t const cbAvail = cbMob - pEntry->offset;
+
+    /* Create a memory pointer, which is accessible by host. */
+    int rc = vmsvgaR3MobBackingStoreCreate(pSvgaR3State, pMob, cbMob);
+    AssertRCReturn(rc, rc);
+
+    void *pvQuery = vmsvgaR3MobBackingStorePtr(pMob, pEntry->offset);
+    /** @todo Write the query data only. */
+    uint32_t cbQuery = 0; /* Actual size of query data returned by backend. */
+    rc = pSvgaR3State->pFuncsDX->pfnDXReadbackQuery(pThisCC, pDXContext, queryId, pvQuery, cbAvail, &cbQuery);
+    if (RT_SUCCESS(rc))
+        rc = vmsvgaR3MobBackingStoreWriteToGuest(pSvgaR3State, pMob);
+
+    vmsvgaR3MobBackingStoreDelete(pSvgaR3State, pMob);
+
+    pEntry->state = SVGADX_QDSTATE_FINISHED;
+    return rc;
+}
+
+
+int vmsvga3dDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackAllQuery const *pCmd)
+{
+    int rc;
+    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
+    AssertReturn(pSvgaR3State->pFuncsDX && pSvgaR3State->pFuncsDX->pfnDXReadbackQuery, VERR_INVALID_STATE);
+    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
+    AssertReturn(p3dState, VERR_INVALID_STATE);
+
+    RT_NOREF(idDXContext);
+
+    PVMSVGA3DDXCONTEXT pDXContext;
+    rc = vmsvga3dDXContextFromCid(p3dState, pCmd->cid, &pDXContext);
+    AssertRCReturn(rc, rc);
+
+    for (uint32_t i = 0; i < pDXContext->cot.cQuery; ++i)
+    {
+        SVGACOTableDXQueryEntry *pEntry = &pDXContext->cot.paQuery[i];
+        if (pEntry->state == SVGADX_QDSTATE_PENDING)
+        {
+            dxReadbackQuery(pThisCC, pDXContext, i, pEntry);
+        }
+    }
+
     return rc;
 }
Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp	(revision 94264)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win-dx.cpp	(revision 94265)
@@ -237,5 +237,4 @@
 typedef struct DXQUERY
 {
-    SVGA3dQueryType             enmQueryType;
     ID3D11Query                *pQuery;
 } DXQUERY;
@@ -1276,5 +1275,5 @@
 static void dxDestroyStreamOutput(DXSTREAMOUTPUT *pDXStreamOutput)
 {
-    RT_NOREF(pDXStreamOutput);
+    RT_ZERO(*pDXStreamOutput);
 }
 
@@ -1710,5 +1709,6 @@
                 hr = pDevice->pDevice->CreateGeometryShaderWithStreamOutput(pDXShader->pvDXBC, pDXShader->cbDXBC,
                     pDXStreamOutput->aDeclarationEntry, pDXStreamOutput->cDeclarationEntry,
-                    pEntry->streamOutputStrideInBytes, cSOTarget, pEntry->rasterizedStream,
+                    pEntry->numOutputStreamStrides ? pEntry->streamOutputStrideInBytes : NULL, pEntry->numOutputStreamStrides,
+                    pEntry->rasterizedStream,
                     /*pClassLinkage=*/ NULL, &pDXShader->pGeometryShader);
                 Assert(SUCCEEDED(hr));
@@ -5509,5 +5509,9 @@
 
         /* Make sure that 16 bit indices are enough. */
-        AssertReturn(vertexCount <= 65535, VERR_NOT_SUPPORTED);
+        if (vertexCount > 65535)
+        {
+            LogRelMax(1, ("VMSVGA: ignore Draw(TRIANGLEFAN, %u)\n", vertexCount));
+            return VERR_NOT_SUPPORTED;
+        }
 
         /* Generate indices. */
@@ -5644,5 +5648,9 @@
 
     /* Make sure that 16 bit indices are enough. */
-    AssertReturn(IndexCountTF <= 65535, VERR_NOT_SUPPORTED);
+    if (IndexCountTF > 65535)
+    {
+        LogRelMax(1, ("VMSVGA: ignore DrawIndexed(TRIANGLEFAN, %u)\n", IndexCountTF));
+        return VERR_NOT_SUPPORTED;
+    }
 
     /* Save the current index buffer. */
@@ -6129,5 +6137,4 @@
 
     DXQUERY *pDXQuery = &pDXContext->pBackendDXContext->paQuery[queryId];
-    Assert(pDXQuery->enmQueryType == SVGA3D_QUERYTYPE_INVALID);
 
     D3D11_QUERY_DESC desc;
@@ -6140,6 +6147,4 @@
     AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE);
 
-    pDXQuery->enmQueryType = (SVGA3dQueryType)pEntry->type;
-
     return VINF_SUCCESS;
 }
@@ -6148,5 +6153,4 @@
 static int dxDestroyQuery(DXQUERY *pDXQuery)
 {
-    pDXQuery->enmQueryType = SVGA3D_QUERYTYPE_INVALID;
     D3D_RELEASE(pDXQuery->pQuery);
     return VINF_SUCCESS;
@@ -6184,5 +6188,5 @@
 
 
-static int dxBeginQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, DXQUERY *pDXQuery)
+static int dxBeginQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId, DXQUERY *pDXQuery)
 {
     DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
@@ -6190,5 +6194,6 @@
 
     /* Begin is disabled for some queries. */
-    if (pDXQuery->enmQueryType == SVGA3D_QUERYTYPE_TIMESTAMP)
+    SVGACOTableDXQueryEntry *pEntry = &pDXContext->cot.paQuery[queryId];
+    if (pEntry->type == SVGA3D_QUERYTYPE_TIMESTAMP)
         return VINF_SUCCESS;
     pDXDevice->pImmediateContext->Begin(pDXQuery->pQuery);
@@ -6203,5 +6208,5 @@
 
     DXQUERY *pDXQuery = &pDXContext->pBackendDXContext->paQuery[queryId];
-    int rc = dxBeginQuery(pThisCC, pDXContext, pDXQuery);
+    int rc = dxBeginQuery(pThisCC, pDXContext, queryId, pDXQuery);
     return rc;
 }
@@ -6229,11 +6234,55 @@
 
 
-static DECLCALLBACK(int) vmsvga3dBackDXReadbackQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
+static int dxReadbackQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId, DXQUERY *pDXQuery,
+                           void *pvData, uint32_t cbData, uint32_t *pcbOut)
+{
+    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
+    AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE);
+
+    SVGACOTableDXQueryEntry *pEntry = &pDXContext->cot.paQuery[queryId];
+
+    uint32_t cbRequired;
+    switch (pEntry->type)
+    {
+        case SVGA3D_QUERYTYPE_OCCLUSION:               cbRequired = sizeof(UINT64); break;
+        case SVGA3D_QUERYTYPE_TIMESTAMP:               cbRequired = sizeof(UINT64); break;
+        case SVGA3D_QUERYTYPE_TIMESTAMPDISJOINT:       cbRequired = sizeof(D3D11_QUERY_DATA_TIMESTAMP_DISJOINT); break;
+        case SVGA3D_QUERYTYPE_PIPELINESTATS:           cbRequired = sizeof(D3D11_QUERY_DATA_PIPELINE_STATISTICS); break;
+        case SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE:      cbRequired = sizeof(BOOL); break;
+        case SVGA3D_QUERYTYPE_STREAMOUTPUTSTATS:       cbRequired = sizeof(D3D11_QUERY_DATA_SO_STATISTICS); break;
+        case SVGA3D_QUERYTYPE_STREAMOVERFLOWPREDICATE: cbRequired = sizeof(BOOL); break;
+        case SVGA3D_QUERYTYPE_OCCLUSION64:             cbRequired = sizeof(UINT64); break;
+        case SVGA3D_QUERYTYPE_SOSTATS_STREAM0:         cbRequired = sizeof(D3D11_QUERY_DATA_SO_STATISTICS); break;
+        case SVGA3D_QUERYTYPE_SOSTATS_STREAM1:         cbRequired = sizeof(D3D11_QUERY_DATA_SO_STATISTICS); break;
+        case SVGA3D_QUERYTYPE_SOSTATS_STREAM2:         cbRequired = sizeof(D3D11_QUERY_DATA_SO_STATISTICS); break;
+        case SVGA3D_QUERYTYPE_SOSTATS_STREAM3:         cbRequired = sizeof(D3D11_QUERY_DATA_SO_STATISTICS); break;
+        case SVGA3D_QUERYTYPE_SOP_STREAM0:             cbRequired = sizeof(BOOL); break;
+        case SVGA3D_QUERYTYPE_SOP_STREAM1:             cbRequired = sizeof(BOOL); break;
+        case SVGA3D_QUERYTYPE_SOP_STREAM2:             cbRequired = sizeof(BOOL); break;
+        case SVGA3D_QUERYTYPE_SOP_STREAM3:             cbRequired = sizeof(BOOL); break;
+        default:
+            AssertFailedReturn(VERR_INVALID_STATE);
+    }
+
+    ASSERT_GUEST_RETURN(cbData > cbRequired, VERR_INVALID_PARAMETER);
+
+    while (pDXDevice->pImmediateContext->GetData(pDXQuery->pQuery, pvData, cbRequired, 0) != S_OK)
+    {
+    }
+
+    *pcbOut = cbRequired;
+    return VINF_SUCCESS;
+}
+
+
+static DECLCALLBACK(int) vmsvga3dBackDXReadbackQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext,
+                                                     SVGA3dQueryId queryId, void *pvData, uint32_t cbData, uint32_t *pcbOut)
+{
+    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
+    RT_NOREF(pBackend);
+
+    DXQUERY *pDXQuery = &pDXContext->pBackendDXContext->paQuery[queryId];
+    int rc = dxReadbackQuery(pThisCC, pDXContext, queryId, pDXQuery, pvData, cbData, pcbOut);
+    return rc;
 }
 
@@ -6709,5 +6758,5 @@
     /* Not much can be done here because ID3D11Device::CreateInputLayout requires
      * a pShaderBytecodeWithInputSignature which is not known at this moment.
-     * InputLayout object will be created in SVGA_3D_CMD_DX_SET_INPUT_LAYOUT.
+     * InputLayout object will be created in setupPipeline.
      */
 
@@ -6742,4 +6791,5 @@
 }
 
+
 static DECLCALLBACK(int) vmsvga3dBackDXDefineBlendState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext,
                                                         SVGA3dBlendStateId blendId, SVGACOTableDXBlendStateEntry const *pEntry)
@@ -6752,11 +6802,11 @@
 
 
-static DECLCALLBACK(int) vmsvga3dBackDXDestroyBlendState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
+static DECLCALLBACK(int) vmsvga3dBackDXDestroyBlendState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dBlendStateId blendId)
+{
+    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
+    RT_NOREF(pBackend);
+
+    D3D_RELEASE(pDXContext->pBackendDXContext->papBlendState[blendId]);
+    return VINF_SUCCESS;
 }
 
@@ -6783,11 +6833,11 @@
 
 
-static DECLCALLBACK(int) vmsvga3dBackDXDestroyDepthStencilState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
+static DECLCALLBACK(int) vmsvga3dBackDXDestroyDepthStencilState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilStateId depthStencilId)
+{
+    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
+    RT_NOREF(pBackend);
+
+    D3D_RELEASE(pDXContext->pBackendDXContext->papDepthStencilState[depthStencilId]);
+    return VINF_SUCCESS;
 }
 
@@ -6814,11 +6864,11 @@
 
 
-static DECLCALLBACK(int) vmsvga3dBackDXDestroyRasterizerState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
+static DECLCALLBACK(int) vmsvga3dBackDXDestroyRasterizerState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRasterizerStateId rasterizerId)
+{
+    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
+    RT_NOREF(pBackend);
+
+    D3D_RELEASE(pDXContext->pBackendDXContext->papRasterizerState[rasterizerId]);
+    return VINF_SUCCESS;
 }
 
@@ -6845,13 +6895,12 @@
 
 
-static DECLCALLBACK(int) vmsvga3dBackDXDestroySamplerState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
-}
-
+static DECLCALLBACK(int) vmsvga3dBackDXDestroySamplerState(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSamplerId samplerId)
+{
+    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
+    RT_NOREF(pBackend);
+
+    D3D_RELEASE(pDXContext->pBackendDXContext->papSamplerState[samplerId]);
+    return VINF_SUCCESS;
+}
 
 
@@ -7247,8 +7296,8 @@
                 DXQUERY *pDXQuery = &pBackendDXContext->paQuery[i];
                 if (   pEntry->type != SVGA3D_QUERYTYPE_INVALID
-                    && pDXQuery->enmQueryType == SVGA3D_QUERYTYPE_INVALID)
+                    && pDXQuery->pQuery == NULL)
                     dxDefineQuery(pThisCC, pDXContext, i, pEntry);
                 else
-                    Assert(pEntry->type == pDXQuery->enmQueryType);
+                    Assert(pEntry->type == SVGA3D_QUERYTYPE_INVALID || pDXQuery->pQuery);
             }
             break;
@@ -7312,24 +7361,4 @@
 
 static DECLCALLBACK(int) vmsvga3dBackDXMoveQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
-}
-
-
-static DECLCALLBACK(int) vmsvga3dBackDXBindAllQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
-{
-    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
-
-    RT_NOREF(pBackend, pDXContext);
-    AssertFailed(); /** @todo Implement */
-    return VERR_NOT_IMPLEMENTED;
-}
-
-
-static DECLCALLBACK(int) vmsvga3dBackDXReadbackAllQuery(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext)
 {
     PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
@@ -8024,6 +8053,4 @@
                 p->pfnDXSurfaceCopyAndReadback    = vmsvga3dBackDXSurfaceCopyAndReadback;
                 p->pfnDXMoveQuery                 = vmsvga3dBackDXMoveQuery;
-                p->pfnDXBindAllQuery              = vmsvga3dBackDXBindAllQuery;
-                p->pfnDXReadbackAllQuery          = vmsvga3dBackDXReadbackAllQuery;
                 p->pfnDXMobFence64                = vmsvga3dBackDXMobFence64;
                 p->pfnDXBindAllShader             = vmsvga3dBackDXBindAllShader;
Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h	(revision 94264)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h	(revision 94265)
@@ -447,5 +447,5 @@
     DECLCALLBACKMEMBER(int, pfnDXBeginQuery,                (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId));
     DECLCALLBACKMEMBER(int, pfnDXEndQuery,                  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId));
-    DECLCALLBACKMEMBER(int, pfnDXReadbackQuery,             (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
+    DECLCALLBACKMEMBER(int, pfnDXReadbackQuery,             (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dQueryId queryId, void *pvData, uint32_t cbData, uint32_t *pcbOut));
     DECLCALLBACKMEMBER(int, pfnDXSetPredication,            (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     DECLCALLBACKMEMBER(int, pfnDXSetSOTargets,              (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t cSoTarget, SVGA3dSoTarget const *paSoTarget));
@@ -467,11 +467,11 @@
     DECLCALLBACKMEMBER(int, pfnDXDestroyElementLayout,      (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dElementLayoutId elementLayoutId));
     DECLCALLBACKMEMBER(int, pfnDXDefineBlendState,          (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dBlendStateId blendId, SVGACOTableDXBlendStateEntry const *pEntry));
-    DECLCALLBACKMEMBER(int, pfnDXDestroyBlendState,         (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
+    DECLCALLBACKMEMBER(int, pfnDXDestroyBlendState,         (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dBlendStateId blendId));
     DECLCALLBACKMEMBER(int, pfnDXDefineDepthStencilState,   (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilStateId depthStencilId, SVGACOTableDXDepthStencilEntry const *pEntry));
-    DECLCALLBACKMEMBER(int, pfnDXDestroyDepthStencilState,  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
+    DECLCALLBACKMEMBER(int, pfnDXDestroyDepthStencilState,  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilStateId depthStencilId));
     DECLCALLBACKMEMBER(int, pfnDXDefineRasterizerState,     (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRasterizerStateId rasterizerId, SVGACOTableDXRasterizerStateEntry const *pEntry));
-    DECLCALLBACKMEMBER(int, pfnDXDestroyRasterizerState,    (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
+    DECLCALLBACKMEMBER(int, pfnDXDestroyRasterizerState,    (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRasterizerStateId rasterizerId));
     DECLCALLBACKMEMBER(int, pfnDXDefineSamplerState,        (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSamplerId samplerId, SVGACOTableDXSamplerEntry const *pEntry));
-    DECLCALLBACKMEMBER(int, pfnDXDestroySamplerState,       (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
+    DECLCALLBACKMEMBER(int, pfnDXDestroySamplerState,       (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dSamplerId samplerId));
     DECLCALLBACKMEMBER(int, pfnDXDefineShader,              (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderId shaderId, SVGACOTableDXShaderEntry const *pEntry));
     DECLCALLBACKMEMBER(int, pfnDXDestroyShader,             (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderId shaderId));
@@ -484,6 +484,4 @@
     DECLCALLBACKMEMBER(int, pfnDXSurfaceCopyAndReadback,    (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     DECLCALLBACKMEMBER(int, pfnDXMoveQuery,                 (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
-    DECLCALLBACKMEMBER(int, pfnDXBindAllQuery,              (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
-    DECLCALLBACKMEMBER(int, pfnDXReadbackAllQuery,          (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     DECLCALLBACKMEMBER(int, pfnDXMobFence64,                (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
     DECLCALLBACKMEMBER(int, pfnDXBindAllShader,             (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
@@ -577,5 +575,5 @@
 int vmsvga3dDXBeginQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBeginQuery const *pCmd);
 int vmsvga3dDXEndQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXEndQuery const *pCmd);
-int vmsvga3dDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
+int vmsvga3dDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackQuery const *pCmd);
 int vmsvga3dDXSetPredication(PVGASTATECC pThisCC, uint32_t idDXContext);
 int vmsvga3dDXSetSOTargets(PVGASTATECC pThisCC, uint32_t idDXContext, uint32_t cSoTarget, SVGA3dSoTarget const *paSoTarget);
@@ -597,11 +595,11 @@
 int vmsvga3dDXDestroyElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyElementLayout const *pCmd);
 int vmsvga3dDXDefineBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineBlendState const *pCmd);
-int vmsvga3dDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext);
+int vmsvga3dDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyBlendState const *pCmd);
 int vmsvga3dDXDefineDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilState const *pCmd);
-int vmsvga3dDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext);
+int vmsvga3dDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilState const *pCmd);
 int vmsvga3dDXDefineRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRasterizerState const *pCmd);
-int vmsvga3dDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext);
+int vmsvga3dDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRasterizerState const *pCmd);
 int vmsvga3dDXDefineSamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineSamplerState const *pCmd);
-int vmsvga3dDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext);
+int vmsvga3dDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroySamplerState const *pCmd);
 int vmsvga3dDXDefineShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShader const *pCmd);
 int vmsvga3dDXDestroyShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShader const *pCmd);
@@ -615,6 +613,6 @@
 int vmsvga3dDXSurfaceCopyAndReadback(PVGASTATECC pThisCC, uint32_t idDXContext);
 int vmsvga3dDXMoveQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
-int vmsvga3dDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
-int vmsvga3dDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext);
+int vmsvga3dDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllQuery const *pCmd);
+int vmsvga3dDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackAllQuery const *pCmd);
 int vmsvga3dDXMobFence64(PVGASTATECC pThisCC, uint32_t idDXContext);
 int vmsvga3dDXBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext);
