Index: trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
===================================================================
--- trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 53740)
+++ trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp	(revision 53741)
@@ -88,4 +88,9 @@
 #include <float.h>
 
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
+# define VBOX_D3D9CAPS_ONLY_DEFINES
+# include "shaderlib/wine/include/d3d9caps.h" /* For some capability constants. */
+#endif
+
 
 /* Generated by VBoxDef2LazyLoad from the VBoxSVGA3D.def file. */
@@ -205,6 +210,9 @@
 #endif
 
-/** Macro wrapping glGetIntegerv for use during initialization.
- * This will release log errors.  */
+
+/**
+ * Macro wrapping glGetIntegerv for use during initialization.
+ * Uses AssertLogRelMsg.
+ */
 #define VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(a_enmGlValue, a_pDest) \
     do \
@@ -212,9 +220,12 @@
         glGetIntegerv(a_enmGlValue, a_pDest); \
         GLenum iGlError = glGetError(); \
-        if (RT_UNLIKELY(iGlError != GL_NO_ERROR)) \
-            LogRel(("VMSVGA3d: glGetIntegerv(" #a_enmGlValue " (%#x),) -> %#x\n", (int)a_enmGlValue, iGlError)); \
+        AssertLogRelMsg(iGlError == GL_NO_ERROR, \
+                        ("VMSVGA3d: glGetIntegerv(" #a_enmGlValue " (%#x),) -> %#x\n", (int)a_enmGlValue, iGlError)); \
     } while (0)
 
-/** Macro for doing something and then checking for errors during initialization. */
+/**
+ * Macro for doing something and then checking for errors during initialization.
+ * Uses AssertLogRelMsg.
+ */
 #define VMSVGA3D_INIT_CHECKED(a_Expr) \
     do \
@@ -222,6 +233,5 @@
         a_Expr; \
         GLenum iGlError = glGetError(); \
-        if (RT_UNLIKELY(iGlError != GL_NO_ERROR)) \
-            LogRel(("VMSVGA3d: " #a_Expr " -> %#x\n", iGlError)); \
+        AssertLogRelMsg(iGlError == GL_NO_ERROR, ("VMSVGA3d: %s -> %#x\n", #a_Expr, iGlError)); \
     } while (0)
 
@@ -654,5 +664,5 @@
     bool fRet = false;
 
-#if defined(RT_OS_DARWIN)
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     /*
      * OpenGL 3.2+ core profile (glGetString(GL_EXTENSIONS) returns NULL).
@@ -782,6 +792,8 @@
 
     /* Temporarily.  Later start if (fMinGLVersion != 0.0 && fActualGLVersion >= fMinGLVersion) return true; */
+#if defined(VBOX_VMSVGA3D_USE_OPENGL_CORE) || !defined(RT_OS_DARWIN)
     AssertMsg(fMinGLVersion == 0.0 || fRet == (fActualGLVersion >= fMinGLVersion),
               ("%s actual:%d min:%d\n", pszWantedExtension, (int)(fActualGLVersion * 10), (int)(fMinGLVersion * 10) ));
+#endif
     return fRet;
 }
@@ -793,5 +805,5 @@
 static void vmsvga3dLogRelExtensions(void)
 {
-#if defined(RT_OS_DARWIN)
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     /* OpenGL 3.0 interface (glGetString(GL_EXTENSIONS) return NULL). */
     PFNGLGETSTRINGIPROC pfnGlGetStringi = (PFNGLGETSTRINGIPROC)OGLGETPROCADDRESS("glGetStringi");
@@ -981,5 +993,5 @@
 
     /* Extension support */
-#ifdef RT_OS_DARWIN
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     /** @todo OpenGL version history suggest this, verify...  */
     pState->ext.fEXT_stencil_two_side = vmsvga3dCheckGLExtension(pState->fGLVersion, 2.0, "GL_EXT_stencil_two_side");
@@ -1002,15 +1014,56 @@
 
     /* Query capabilities */
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
+    glGetIntegerv(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
+    if (glGetError() != GL_NO_ERROR)
+        pState->caps.maxActiveLights = 1;
+#else
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
+#endif
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_BUFFER_SIZE, &pState->caps.maxTextureBufferSize);
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
+    glGetIntegerv(GL_MAX_LIGHTS, &pState->caps.maxActiveLights);
+    if (glGetError() != GL_NO_ERROR)
+        VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_IMAGE_UNITS, &pState->caps.maxTextures);
+#else
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_UNITS_ARB, &pState->caps.maxTextures);
+#endif
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_CLIP_DISTANCES, &pState->caps.maxClipDistances);
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_COLOR_ATTACHMENTS, &pState->caps.maxColorAttachments);
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_RECTANGLE_TEXTURE_SIZE, &pState->caps.maxRectangleTextureSize);
     VMSVGA3D_INIT_CHECKED_GL_GET_INTEGER_VALUE(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &pState->caps.maxTextureAnisotropy);
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
+    glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pState->caps.flPointSize);
+    if (glGetError() != GL_NO_ERROR)
+    {
+        pState->caps.flPointSize[0] = 1;
+        pState->caps.flPointSize[1] = 1;
+    }
+#else
     VMSVGA3D_INIT_CHECKED(glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pState->caps.flPointSize));
+#endif
 
     if (pState->ext.glGetProgramivARB)
     {
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
+        pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
+                                      &pState->caps.maxFragmentShaderTemps);
+        if (glGetError() != GL_NO_ERROR)
+            pState->caps.maxFragmentShaderTemps = D3DVS20_MAX_NUMTEMPS;
+        pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
+                                      &pState->caps.maxFragmentShaderInstructions);
+        if (glGetError() != GL_NO_ERROR)
+            pState->caps.maxFragmentShaderInstructions = 0;
+
+        pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
+                                      &pState->caps.maxVertexShaderTemps);
+        if (glGetError() != GL_NO_ERROR)
+            pState->caps.maxVertexShaderTemps = D3DVS20_MAX_NUMTEMPS;
+        pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
+                                      &pState->caps.maxVertexShaderInstructions);
+        if (glGetError() != GL_NO_ERROR)
+            pState->caps.maxVertexShaderInstructions = 0;
+
+#else
         VMSVGA3D_INIT_CHECKED(pState->ext.glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB,
                                                             &pState->caps.maxFragmentShaderTemps));
@@ -1021,4 +1074,5 @@
         VMSVGA3D_INIT_CHECKED(pState->ext.glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB,
                                                             &pState->caps.maxVertexShaderInstructions));
+#endif
     }
     pState->caps.fS3TCSupported = vmsvga3dCheckGLExtension(pState->fGLVersion, 0.0, "GL_EXT_texture_compression_s3tc");
@@ -1158,5 +1212,5 @@
     AssertRC(rc);
 
-#ifndef RT_OS_DARWIN
+#if !defined(RT_OS_DARWIN) || defined(VBOX_VMSVGA3D_USE_OPENGL_CORE)
     /* on the Mac, OpenGL 3 came very late so we have a capable 2.1 implementation */
     if (pState->fGLVersion < 3.0)
Index: trunk/src/VBox/Devices/Graphics/shaderlib/directx.c
===================================================================
--- trunk/src/VBox/Devices/Graphics/shaderlib/directx.c	(revision 53740)
+++ trunk/src/VBox/Devices/Graphics/shaderlib/directx.c	(revision 53741)
@@ -1908,5 +1908,5 @@
 #endif
 
-#if defined(RT_OS_DARWIN)
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
 /** Checks if @a pszExtension is one of the extensions we're looking for and
  *  updates @a pGlInfo->supported accordingly. */
@@ -1930,5 +1930,5 @@
     struct wined3d_driver_info *driver_info = &adapter->driver_info;
     struct wined3d_gl_info *gl_info = &adapter->gl_info;
-#if !defined(RT_OS_DARWIN)
+#ifndef VBOX_VMSVGA3D_USE_OPENGL_CORE
     const char *GL_Extensions    = NULL;
     const char *WGL_Extensions   = NULL;
@@ -1951,5 +1951,5 @@
     ENTER_GL();
 
-    gl_renderer_str = (const char *)glGetString(GL_RENDERER);
+    VBOX_CHECK_GL_CALL(gl_renderer_str = (const char *)glGetString(GL_RENDERER));
     TRACE_(d3d_caps)("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str));
     if (!gl_renderer_str)
@@ -1960,5 +1960,5 @@
     }
 
-    gl_vendor_str = (const char *)glGetString(GL_VENDOR);
+    VBOX_CHECK_GL_CALL(gl_vendor_str = (const char *)glGetString(GL_VENDOR));
     TRACE_(d3d_caps)("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str));
     if (!gl_vendor_str)
@@ -1970,5 +1970,5 @@
 
     /* Parse the GL_VERSION field into major and minor information */
-    gl_version_str = (const char *)glGetString(GL_VERSION);
+    VBOX_CHECK_GL_CALL(gl_version_str = (const char *)glGetString(GL_VERSION));
     TRACE_(d3d_caps)("GL_VERSION: %s.\n", debugstr_a(gl_version_str));
     if (!gl_version_str)
@@ -2004,17 +2004,32 @@
 
     /* Retrieve opengl defaults */
-    glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
+    VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max));
     gl_info->limits.clipplanes = min(WINED3DMAXUSERCLIPPLANES, gl_max);
     TRACE_(d3d_caps)("ClipPlanes support - num Planes=%d\n", gl_max);
 
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
+    if (glGetError() != GL_NO_ERROR)
+        gl_max = 0;
+#else
+    VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_LIGHTS, &gl_max));
+#endif
     gl_info->limits.lights = gl_max;
     TRACE_(d3d_caps)("Lights support - max lights=%d\n", gl_max);
 
-    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max);
+    VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max));
     gl_info->limits.texture_size = gl_max;
     TRACE_(d3d_caps)("Maximum texture size support - max texture size=%d\n", gl_max);
 
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, gl_floatv);
+    if (glGetError() != GL_NO_ERROR)
+    {
+        gl_floatv[0] = 1;
+        gl_floatv[1] = 1;
+    }
+#else
+    VBOX_CHECK_GL_CALL(glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, gl_floatv));
+#endif
     gl_info->limits.pointsize_min = gl_floatv[0];
     gl_info->limits.pointsize_max = gl_floatv[1];
@@ -2022,6 +2037,6 @@
 
     /* Parse the gl supported features, in theory enabling parts of our code appropriately. */
-#if !defined(RT_OS_DARWIN)
-    GL_Extensions = (const char *)glGetString(GL_EXTENSIONS);
+#ifndef VBOX_VMSVGA3D_USE_OPENGL_CORE
+    VBOX_CHECK_GL_CALL(GL_Extensions = (const char *)glGetString(GL_EXTENSIONS));
     if (!GL_Extensions)
     {
@@ -2040,17 +2055,22 @@
     gl_info->supported[VBOX_SHARED_CONTEXTS] = TRUE;
 
-#if defined(RT_OS_DARWIN)
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
     {
         /* We work with OpenGL 3.2+ on darwin, so we need to handle extensions differently. */
         GLint idxExt;
         GLint cExtensions = 1024;
-        float fGLVersion = atof((const char *)glGetString(GL_VERSION));
+        float fGLVersion;
+        VBOX_CHECK_GL_CALL(fGLVersion = atof((const char *)glGetString(GL_VERSION)));
 
 # define GL_NUM_EXTENSIONS 0x821D /// FIXME
         extern const GLubyte * glGetStringi(GLenum name, GLuint index); /// FIXME
 
-        glGetIntegerv(GL_NUM_EXTENSIONS, &cExtensions);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_NUM_EXTENSIONS, &cExtensions));
         for (idxExt = 0; idxExt < cExtensions; idxExt++)
-            check_gl_extension(gl_info, (const char *)glGetStringi(GL_EXTENSIONS, idxExt));
+        {
+            const char *pszExt;
+            VBOX_CHECK_GL_CALL((const char *)glGetStringi(GL_EXTENSIONS, idxExt));
+            check_gl_extension(gl_info, pszExt);
+        }
 
         if (fGLVersion >= 1.1)
@@ -2329,5 +2349,5 @@
     if (gl_info->supported[NV_REGISTER_COMBINERS])
     {
-        glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &gl_max));
         gl_info->limits.general_combiners = gl_max;
         TRACE_(d3d_caps)("Max general combiners: %d.\n", gl_max);
@@ -2335,5 +2355,5 @@
     if (gl_info->supported[ARB_DRAW_BUFFERS])
     {
-        glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max));
         gl_info->limits.buffers = gl_max;
         TRACE_(d3d_caps)("Max draw buffers: %u.\n", gl_max);
@@ -2341,5 +2361,11 @@
     if (gl_info->supported[ARB_MULTITEXTURE])
     {
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
         glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
+        if (glGetError() != GL_NO_ERROR)
+            VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &gl_max));
+#else
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max));
+#endif
         gl_info->limits.textures = min(MAX_TEXTURES, gl_max);
         TRACE_(d3d_caps)("Max textures: %d.\n", gl_info->limits.textures);
@@ -2348,5 +2374,5 @@
         {
             GLint tmp;
-            glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &tmp);
+            VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &tmp));
             gl_info->limits.fragment_samplers = min(MAX_FRAGMENT_SAMPLERS, tmp);
         }
@@ -2360,7 +2386,7 @@
         {
             GLint tmp;
-            glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &tmp);
+            VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &tmp));
             gl_info->limits.vertex_samplers = tmp;
-            glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &tmp);
+            VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &tmp));
             gl_info->limits.combined_samplers = tmp;
 
@@ -2400,5 +2426,5 @@
     if (gl_info->supported[ARB_VERTEX_BLEND])
     {
-        glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max));
         gl_info->limits.blends = gl_max;
         TRACE_(d3d_caps)("Max blends: %u.\n", gl_info->limits.blends);
@@ -2406,5 +2432,5 @@
     if (gl_info->supported[EXT_TEXTURE3D])
     {
-        glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max));
         gl_info->limits.texture3d_size = gl_max;
         TRACE_(d3d_caps)("Max texture3D size: %d.\n", gl_info->limits.texture3d_size);
@@ -2412,5 +2438,5 @@
     if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])
     {
-        glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max));
         gl_info->limits.anisotropy = gl_max;
         TRACE_(d3d_caps)("Max anisotropy: %d.\n", gl_info->limits.anisotropy);
@@ -2418,18 +2444,18 @@
     if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
     {
-        GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)));
         gl_info->limits.arb_ps_float_constants = gl_max;
         TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info->limits.arb_ps_float_constants);
-        GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max)));
         gl_info->limits.arb_ps_native_constants = gl_max;
         TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
                 gl_info->limits.arb_ps_native_constants);
-        GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max)));
         gl_info->limits.arb_ps_temps = gl_max;
         TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_ps_temps);
-        GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max)));
         gl_info->limits.arb_ps_instructions = gl_max;
         TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info->limits.arb_ps_instructions);
-        GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &gl_max)));
         gl_info->limits.arb_ps_local_constants = gl_max;
         TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info->limits.arb_ps_instructions);
@@ -2437,15 +2463,15 @@
     if (gl_info->supported[ARB_VERTEX_PROGRAM])
     {
-        GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)));
         gl_info->limits.arb_vs_float_constants = gl_max;
         TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info->limits.arb_vs_float_constants);
-        GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max)));
         gl_info->limits.arb_vs_native_constants = gl_max;
         TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
                 gl_info->limits.arb_vs_native_constants);
-        GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max)));
         gl_info->limits.arb_vs_temps = gl_max;
         TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_vs_temps);
-        GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max));
+        VBOX_CHECK_GL_CALL(GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max)));
         gl_info->limits.arb_vs_instructions = gl_max;
         TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info->limits.arb_vs_instructions);
@@ -2456,5 +2482,5 @@
     if (gl_info->supported[ARB_VERTEX_SHADER])
     {
-        glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max));
         gl_info->limits.glsl_vs_float_constants = gl_max / 4;
 #ifdef VBOX_WITH_WDDM
@@ -2483,5 +2509,5 @@
     if (gl_info->supported[ARB_FRAGMENT_SHADER])
     {
-        glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max);
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max));
         gl_info->limits.glsl_ps_float_constants = gl_max / 4;
 #ifdef VBOX_WITH_WDDM
@@ -2507,5 +2533,11 @@
 #endif
         TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info->limits.glsl_ps_float_constants);
+#ifdef VBOX_VMSVGA3D_USE_OPENGL_CORE
         glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max);
+        if (glGetError() != GL_NO_ERROR)
+            gl_max = 60;
+#else
+        VBOX_CHECK_GL_CALL(glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max));
+#endif
         gl_info->limits.glsl_varyings = gl_max;
         TRACE_(d3d_caps)("Max GLSL varyings: %u (%u 4 component varyings).\n", gl_max, gl_max / 4);
@@ -2524,5 +2556,5 @@
     if (gl_info->supported[NV_LIGHT_MAX_EXPONENT])
     {
-        glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess);
+        VBOX_CHECK_GL_CALL(glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess));
     }
     else
Index: trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/d3d9caps.h
===================================================================
--- trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/d3d9caps.h	(revision 53740)
+++ trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/d3d9caps.h	(revision 53741)
@@ -292,4 +292,5 @@
 #define D3DMAX30SHADERINSTRUCTIONS          32768
 
+#ifndef VBOX_D3D9CAPS_ONLY_DEFINES
 
 typedef struct _D3DVSHADERCAPS2_0 {
@@ -402,3 +403,5 @@
 } D3DCAPS9;
 
+#endif /* !VBOX_D3D9CAPS_ONLY_DEFINES */
+
 #endif
Index: trunk/src/VBox/Devices/Graphics/shaderlib/wined3d_private.h
===================================================================
--- trunk/src/VBox/Devices/Graphics/shaderlib/wined3d_private.h	(revision 53740)
+++ trunk/src/VBox/Devices/Graphics/shaderlib/wined3d_private.h	(revision 53741)
@@ -3438,3 +3438,21 @@
 #endif
 
-#endif
+/** @def VBOX_CHECK_GL_CALL
+ * Performs OpenGL call @a a_Expr and check glGetError.
+ * Errors will be asserted in strict builds and hit the release log in
+ * non-strict builds.
+ * @param   a_Expr  The OpenGL call expression.  Always executed!
+ */
+#ifdef VBOX_WITH_VMSVGA
+# define VBOX_CHECK_GL_CALL(a_Expr) \
+        do { \
+            GLint rcCheckCall; \
+            a_Expr; \
+            rcCheckCall = glGetError(); \
+            AssertLogRelMsg(rcCheckCall == GL_NO_ERROR, ("%s -> %#x\n", #a_Expr, rcCheckCall)); \
+        } while (0)
+#else
+# define VBOX_CHECK_GL_CALL(a_Expr) do { a_Expr; } while (0)
+#endif
+
+#endif
