Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 75715)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 75752)
@@ -667,4 +667,5 @@
     GLGETPROC_(PFNGLCOMPRESSEDTEXIMAGE2DPROC             , glCompressedTexImage2D, "");
     GLGETPROC_(PFNGLCOMPRESSEDTEXIMAGE3DPROC             , glCompressedTexImage3D, "");
+    GLGETPROC_(PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC          , glCompressedTexSubImage2D, "");
     GLGETPROC_(PFNGLPOINTPARAMETERFPROC                  , glPointParameterf, "");
     GLGETPROC_(PFNGLBLENDEQUATIONSEPARATEPROC            , glBlendEquationSeparate, "");
@@ -1226,5 +1227,5 @@
     case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8:
     case SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8:
-    // case SVGA3D_DEVCAP_SURFACEFMT_Z_DF16:
+    case SVGA3D_DEVCAP_SURFACEFMT_Z_DF16:
     case SVGA3D_DEVCAP_SURFACEFMT_Z_DF24:
     case SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8_INT:
@@ -1572,4 +1573,9 @@
 void vmsvga3dSurfaceFormat2OGL(PVMSVGA3DSURFACE pSurface, SVGA3dSurfaceFormat format)
 {
+#if 0
+#define AssertTestFmt(f) AssertMsgFailed(("Test me - " #f "\n"))
+#else
+#define AssertTestFmt(f) do {} while(0)
+#endif
     switch (format)
     {
@@ -1588,5 +1594,5 @@
         pSurface->formatGL = GL_RGB;
         pSurface->typeGL = GL_UNSIGNED_SHORT_5_6_5;
-        AssertMsgFailed(("Test me - SVGA3D_R5G6B5\n"));
+        AssertTestFmt(SVGA3D_R5G6B5);
         break;
     case SVGA3D_X1R5G5B5:               /* D3DFMT_X1R5G5B5 - WINED3DFMT_B5G5R5X1_UNORM */
@@ -1594,5 +1600,5 @@
         pSurface->formatGL = GL_BGRA;
         pSurface->typeGL = GL_UNSIGNED_SHORT_1_5_5_5_REV;
-        AssertMsgFailed(("Test me - SVGA3D_X1R5G5B5\n"));
+        AssertTestFmt(SVGA3D_X1R5G5B5);
         break;
     case SVGA3D_A1R5G5B5:               /* D3DFMT_A1R5G5B5 - WINED3DFMT_B5G5R5A1_UNORM */
@@ -1600,5 +1606,5 @@
         pSurface->formatGL = GL_BGRA;
         pSurface->typeGL = GL_UNSIGNED_SHORT_1_5_5_5_REV;
-        AssertMsgFailed(("Test me - SVGA3D_A1R5G5B5\n"));
+        AssertTestFmt(SVGA3D_A1R5G5B5);
         break;
     case SVGA3D_A4R4G4B4:               /* D3DFMT_A4R4G4B4 - WINED3DFMT_B4G4R4A4_UNORM */
@@ -1606,5 +1612,5 @@
         pSurface->formatGL = GL_BGRA;
         pSurface->typeGL = GL_UNSIGNED_SHORT_4_4_4_4_REV;
-        AssertMsgFailed(("Test me - SVGA3D_A4R4G4B4\n"));
+        AssertTestFmt(SVGA3D_A4R4G4B4);
         break;
 
@@ -1624,10 +1630,10 @@
         pSurface->formatGL = GL_DEPTH_COMPONENT;
         pSurface->typeGL = GL_UNSIGNED_SHORT;
-        //AssertMsgFailed(("Test me - SVGA3D_Z_D16\n"));
+        AssertTestFmt(SVGA3D_Z_D16);
         break;
     case SVGA3D_Z_D24S8:                /* D3DFMT_D24S8 - WINED3DFMT_D24_UNORM_S8_UINT */
         pSurface->internalFormatGL = GL_DEPTH24_STENCIL8;
         pSurface->formatGL = GL_DEPTH_STENCIL;
-        pSurface->typeGL = GL_UNSIGNED_INT;
+        pSurface->typeGL = GL_UNSIGNED_INT_24_8;
         break;
     case SVGA3D_Z_D15S1:                /* D3DFMT_D15S1 - WINED3DFMT_S1_UINT_D15_UNORM */
@@ -1636,5 +1642,5 @@
         pSurface->typeGL = GL_UNSIGNED_SHORT;
         /** @todo Wine sources hints at no hw support for this, so test this one! */
-        AssertMsgFailed(("Test me - SVGA3D_Z_D15S1\n"));
+        AssertTestFmt(SVGA3D_Z_D15S1);
         break;
     case SVGA3D_Z_D24X8:                /* D3DFMT_D24X8 - WINED3DFMT_X8D24_UNORM */
@@ -1642,4 +1648,5 @@
         pSurface->formatGL = GL_DEPTH_COMPONENT;
         pSurface->typeGL = GL_UNSIGNED_INT;
+        AssertTestFmt(SVGA3D_Z_D24X8);
         break;
 
@@ -1648,5 +1655,5 @@
         pSurface->internalFormatGL = GL_DEPTH_COMPONENT16;
         pSurface->formatGL = GL_DEPTH_COMPONENT;
-        pSurface->typeGL = GL_FLOAT;
+        pSurface->typeGL = GL_HALF_FLOAT;
         break;
 
@@ -1657,8 +1664,8 @@
         break;
 
-    case SVGA3D_Z_D24S8_INT:            /* D3DFMT_??? - not supported */
+    case SVGA3D_Z_D24S8_INT:            /* D3DFMT_D24S8 */
         pSurface->internalFormatGL = GL_DEPTH24_STENCIL8;
         pSurface->formatGL = GL_DEPTH_STENCIL;
-        pSurface->typeGL = GL_INT;        /* ??? */
+        pSurface->typeGL = GL_UNSIGNED_INT_24_8;
         break;
 
@@ -1750,5 +1757,5 @@
 #else
         pSurface->typeGL = GL_HALF_FLOAT;
-        AssertMsgFailed(("Test me - SVGA3D_ARGB_S10E5\n"));
+        AssertTestFmt(SVGA3D_ARGB_S10E5);
 #endif
         break;
@@ -1768,5 +1775,5 @@
 #endif
         pSurface->typeGL = GL_UNSIGNED_INT;
-        AssertMsgFailed(("Test me - SVGA3D_A2R10G10B10\n"));
+        AssertTestFmt(SVGA3D_A2R10G10B10);
         break;
 
@@ -1780,5 +1787,5 @@
 #else
         pSurface->typeGL = GL_HALF_FLOAT;
-        AssertMsgFailed(("Test me - SVGA3D_R_S10E5\n"));
+        AssertTestFmt(SVGA3D_R_S10E5);
 #endif
         break;
@@ -1795,5 +1802,5 @@
 #else
         pSurface->typeGL = GL_HALF_FLOAT;
-        AssertMsgFailed(("Test me - SVGA3D_RG_S10E5\n"));
+        AssertTestFmt(SVGA3D_RG_S10E5);
 #endif
         break;
@@ -1829,5 +1836,5 @@
 #else
         pSurface->typeGL = GL_UNSIGNED_SHORT;
-        AssertMsgFailed(("test me - SVGA3D_G16R16\n"));
+        AssertTestFmt(SVGA3D_G16R16);
 #endif
         break;
@@ -1840,5 +1847,5 @@
 #else
         pSurface->typeGL = GL_UNSIGNED_SHORT;
-        AssertMsgFailed(("Test me - SVGA3D_A16B16G16R16\n"));
+        AssertTestFmt(SVGA3D_A16B16G16R16);
 #endif
         break;
@@ -1848,5 +1855,5 @@
         pSurface->formatGL = GL_BGRA;
         pSurface->typeGL = GL_UNSIGNED_INT_8_8_8_8_REV;
-        AssertMsgFailed(("test me - SVGA3D_R8G8B8A8_SNORM\n"));
+        AssertTestFmt(SVGA3D_R8G8B8A8_SNORM);
         break;
     case SVGA3D_R16G16_UNORM:
@@ -1854,5 +1861,5 @@
         pSurface->formatGL = GL_RG;
         pSurface->typeGL = GL_UNSIGNED_SHORT;
-        AssertMsgFailed(("test me - SVGA3D_R16G16_UNORM\n"));
+        AssertTestFmt(SVGA3D_R16G16_UNORM);
         break;
 
@@ -1881,4 +1888,5 @@
         break;
     }
+#undef AssertTestFmt
 }
 
@@ -2644,13 +2652,30 @@
             vmsvga3dOglSetUnpackParams(pState, pContext, pSurface, &SavedParams); /** @todo do we need to set ROW_LENGTH to w here? */
 
-            glTexSubImage2D(texImageTarget,
-                            uHostMipmap,
-                            u32HostBlockX,
-                            u32HostBlockY,
-                            cBlocksX,
-                            cBlocksY,
-                            pSurface->formatGL,
-                            pSurface->typeGL,
-                            pDoubleBuffer);
+            if (   pSurface->internalFormatGL == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
+                || pSurface->internalFormatGL == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
+                || pSurface->internalFormatGL == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
+            {
+                pState->ext.glCompressedTexSubImage2D(texImageTarget,
+                                                      uHostMipmap,
+                                                      pBox->x,
+                                                      pBox->y,
+                                                      pBox->w,
+                                                      pBox->h,
+                                                      pSurface->internalFormatGL,
+                                                      cbSurfacePitch * cBlocksY,
+                                                      pDoubleBuffer);
+            }
+            else
+            {
+                glTexSubImage2D(texImageTarget,
+                                uHostMipmap,
+                                u32HostBlockX,
+                                u32HostBlockY,
+                                cBlocksX,
+                                cBlocksY,
+                                pSurface->formatGL,
+                                pSurface->typeGL,
+                                pDoubleBuffer);
+            }
             VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
 
@@ -4821,5 +4846,5 @@
                  currentStage, sid, pContext->aSidActiveTextures[currentStage]));
 
-            /* Only is texture actually changed. */ /// @todo needs testing.
+            /* Only if texture actually changed. */ /// @todo needs testing.
             if (pContext->aSidActiveTextures[currentStage] != sid)
             {
@@ -4830,7 +4855,10 @@
                     VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
 
-                    /* Necessary for the fixed pipeline. */
-                    glDisable(pCurrentTextureSurface->targetGL);
-                    VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
+                    if (currentStage < 8)
+                    {
+                        /* Necessary for the fixed pipeline. */
+                        glDisable(pCurrentTextureSurface->targetGL);
+                        VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
+                    }
 
                     pCurrentTextureSurface = NULL;
@@ -4862,7 +4890,10 @@
                     VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
 
-                    /* Necessary for the fixed pipeline. */
-                    glEnable(pSurface->targetGL);
-                    VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
+                    if (currentStage < 8)
+                    {
+                        /* Necessary for the fixed pipeline. */
+                        glEnable(pSurface->targetGL);
+                        VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);
+                    }
 
                     /* Remember the currently active texture. */
