Index: /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 82407)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 82408)
@@ -6328,4 +6328,21 @@
     }
 
+    /* Flush any shader changes; after (!) checking the vertex declarations to deal with pre-transformed vertices. */
+    if (pContext->pShaderContext)
+    {
+        uint32_t rtHeight = 0;
+
+        if (pContext->state.aRenderTargets[SVGA3D_RT_COLOR0] != SVGA_ID_INVALID)
+        {
+            PVMSVGA3DSURFACE pRenderTarget;
+            rc = vmsvga3dSurfaceFromSid(pState, pContext->state.aRenderTargets[SVGA3D_RT_COLOR0], &pRenderTarget);
+            AssertRCReturn(rc, rc);
+
+            rtHeight = pRenderTarget->paMipmapLevels[0].mipmapSize.height;
+        }
+
+        ShaderUpdateState(pContext->pShaderContext, rtHeight);
+    }
+
     /*
      * D3D and OpenGL have a different meaning of value zero for the vertex array stride:
@@ -6396,18 +6413,4 @@
             Assert(pVertexDivisor[iVertexDivisor].s.count == 1);
         }
-    }
-
-    /* Flush any shader changes; after (!) checking the vertex declarations to deal with pre-transformed vertices. */
-    if (pContext->pShaderContext)
-    {
-        uint32_t rtHeight = 0;
-
-        if (pContext->state.aRenderTargets[SVGA3D_RT_COLOR0] != SVGA_ID_INVALID)
-        {
-            PVMSVGA3DSURFACE pRenderTarget = pState->papSurfaces[pContext->state.aRenderTargets[SVGA3D_RT_COLOR0]];
-            rtHeight = pRenderTarget->paMipmapLevels[0].mipmapSize.height;
-        }
-
-        ShaderUpdateState(pContext->pShaderContext, rtHeight);
     }
 
