Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp	(revision 41443)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp	(revision 41471)
@@ -1059,5 +1059,16 @@
 }
 
-static VOID vboxWddmDalCheckAddRts(PVBOXWDDMDISP_DEVICE pDevice)
+static DECLINLINE(BOOLEAN) vboxWddmDalCheckAddRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, BOOLEAN fWrite)
+{
+    BOOLEAN fChanged = FALSE;
+    for (UINT i = 0; i < pRc->cAllocations; ++i)
+    {
+        PVBOXWDDMDISP_ALLOCATION pDAlloc = &pRc->aAllocations[i];
+        fChanged |= vboxWddmDalCheckAdd(pDevice, pDAlloc, fWrite);
+    }
+    return fChanged;
+}
+
+static VOID vboxWddmDalCheckAddRtsSamplers(PVBOXWDDMDISP_DEVICE pDevice)
 {
     for (UINT i = 0; i < pDevice->cRTs; ++i)
@@ -1068,4 +1079,13 @@
         }
     }
+
+    for (UINT i = 0, iSampler = 0; iSampler < pDevice->cSamplerTextures; ++i)
+    {
+        Assert(i < RT_ELEMENTS(pDevice->aSamplerTextures));
+        if (!pDevice->aSamplerTextures[i]) continue;
+        vboxWddmDalCheckAddRc(pDevice, pDevice->aSamplerTextures[i], FALSE);
+        ++iSampler; \
+    } \
+
 }
 
@@ -3527,5 +3547,4 @@
         }
 
-#ifdef VBOXWDDMDISP_DEBUG
         Assert(pDevice->cSamplerTextures < RT_ELEMENTS(pDevice->aSamplerTextures));
         int idx = VBOXWDDMDISP_SAMPLER_IDX(Stage);
@@ -3550,10 +3569,8 @@
             WARN(("incorrect dampler index1! (%d)\n", Stage));
         }
-#endif
     }
     else
     {
         pD3DIfTex = NULL;
-#ifdef VBOXWDDMDISP_DEBUG
         Assert(pDevice->cSamplerTextures < RT_ELEMENTS(pDevice->aSamplerTextures));
         int idx = VBOXWDDMDISP_SAMPLER_IDX(Stage);
@@ -3573,5 +3590,4 @@
             WARN(("incorrect dampler index2! (%d)\n", Stage));
         }
-#endif
     }
 
@@ -3753,5 +3769,5 @@
     }
 
-    vboxWddmDalCheckAddRts(pDevice);
+    vboxWddmDalCheckAddRtsSamplers(pDevice);
 
     VBOXVDBG_DUMP_DRAWPRIM_LEAVE(pDevice);
@@ -3807,5 +3823,5 @@
     Assert(hr == S_OK);
 
-    vboxWddmDalCheckAddRts(pDevice);
+    vboxWddmDalCheckAddRtsSamplers(pDevice);
 
     VBOXVDBG_DUMP_DRAWPRIM_LEAVE(pDevice);
@@ -3823,5 +3839,5 @@
     VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
     Assert(0);
-    vboxWddmDalCheckAddRts(pDevice);
+    vboxWddmDalCheckAddRtsSamplers(pDevice);
     vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice));
     return E_FAIL;
@@ -3836,5 +3852,5 @@
     VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
     Assert(0);
-    vboxWddmDalCheckAddRts(pDevice);
+    vboxWddmDalCheckAddRtsSamplers(pDevice);
     vboxVDbgPrintF(("==> "__FUNCTION__", hDevice(0x%p)\n", hDevice));
     return E_FAIL;
@@ -3929,5 +3945,5 @@
 #endif
 
-    vboxWddmDalCheckAddRts(pDevice);
+    vboxWddmDalCheckAddRtsSamplers(pDevice);
 
     VBOXVDBG_DUMP_DRAWPRIM_LEAVE(pDevice);
@@ -3946,5 +3962,5 @@
     VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
     Assert(0);
-    vboxWddmDalCheckAddRts(pDevice);
+    vboxWddmDalCheckAddRtsSamplers(pDevice);
     vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p)\n", hDevice));
     return E_FAIL;
@@ -4049,15 +4065,6 @@
     }
 
-    for (UINT i = 0; i < pDstRc->cAllocations; ++i)
-    {
-        PVBOXWDDMDISP_ALLOCATION pDAlloc = &pDstRc->aAllocations[i];
-        vboxWddmDalCheckAdd(pDevice, pDAlloc, TRUE);
-    }
-
-    for (UINT i = 0; i < pSrcRc->cAllocations; ++i)
-    {
-        PVBOXWDDMDISP_ALLOCATION pDAlloc = &pSrcRc->aAllocations[i];
-        vboxWddmDalCheckAdd(pDevice, pDAlloc, FALSE);
-    }
+    vboxWddmDalCheckAddRc(pDevice, pDstRc, TRUE);
+    vboxWddmDalCheckAddRc(pDevice, pSrcRc, FALSE);
 
     vboxVDbgPrintF(("<== "__FUNCTION__", hDevice(0x%p), hr(0x%x)\n", hDevice, hr));
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h	(revision 41443)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h	(revision 41471)
@@ -203,8 +203,6 @@
     RTLISTANCHOR DirtyAllocList;
 
-#ifdef VBOXWDDMDISP_DEBUG
     UINT cSamplerTextures;
     struct VBOXWDDMDISP_RESOURCE *aSamplerTextures[VBOXWDDMDISP_TOTAL_SAMPLERS];
-#endif
 
     UINT cRTs;
