Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk	(revision 78188)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk	(revision 78190)
@@ -119,4 +119,5 @@
  	wddm/VBoxMPCm.cpp \
  	wddm/VBoxMPCr.cpp \
+ 	wddm/VBoxMPSa.cpp \
  	wddm/VBoxMPMisc.cpp \
  	wddm/VBoxWddm.rc \
@@ -132,7 +133,4 @@
  	$(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
 
- VBoxWddm_SOURCES         += \
-	$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/util/sortarray.cpp
-
  if defined(VBOX_WITH_CROGL)
    VBoxWddm_SOURCES       += \
@@ -142,5 +140,4 @@
  	$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c \
  	$(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer/pack_misc.c \
- 	$(VBOX_PATH_CROGL_GENFILES)/pack_bounds_swap.c \
  	$(VBOX_PATH_CROGL_GENFILES)/packer.c \
  	wddm/VBoxMPCrUtil.cpp
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.cpp	(revision 78190)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.cpp	(revision 78190)
@@ -0,0 +1,415 @@
+/* $Id$ */
+
+/** @file
+ * Sorted array impl
+ */
+
+/*
+ * Copyright (C) 2014-2019 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <cr_error.h>
+#include <iprt/err.h>
+#include <iprt/mem.h>
+
+#include <memory.h>
+
+#include "VBoxMPSa.h"
+
+VBOXSADECL(int) CrSaInit(CR_SORTARRAY *pArray, uint32_t cInitBuffer)
+{
+    pArray->cBufferSize = cInitBuffer;
+    pArray->cSize = 0;
+    if (cInitBuffer)
+    {
+        pArray->pElements = (uint64_t*)RTMemAlloc(cInitBuffer * sizeof (pArray->pElements[0]));
+        if (!pArray->pElements)
+        {
+            WARN(("no memory"));
+            /* sanity */
+            pArray->cBufferSize = 0;
+            return VERR_NO_MEMORY;
+        }
+    }
+    else
+        pArray->pElements = NULL;
+
+    return VINF_SUCCESS;
+}
+
+VBOXSADECL(void) CrSaCleanup(CR_SORTARRAY *pArray)
+{
+    if (pArray->pElements)
+        RTMemFree(pArray->pElements);
+
+    CrSaInit(pArray, 0);
+}
+
+static int crSaSearch(const CR_SORTARRAY *pArray, uint64_t element)
+{
+    int iMin = 0;
+    int iMax = pArray->cSize;
+    int i = 0;
+
+    while (iMin < iMax)
+    {
+        i = (iMax + iMin) / 2;
+
+        uint64_t el = pArray->pElements[i];
+        if (el == element)
+            return i;
+        else if (el < element)
+            iMin = i + 1;
+        else
+            iMax = i;
+    }
+
+    return -1;
+}
+
+static void crSaDbgValidate(const CR_SORTARRAY *pArray)
+{
+    Assert(pArray->cSize <= pArray->cBufferSize);
+    Assert(!pArray->pElements == !pArray->cBufferSize);
+    if (!pArray->cSize)
+        return;
+    uint64_t cur = pArray->pElements[0];
+    for (uint32_t i = 1; i < pArray->cSize; ++i)
+    {
+        Assert(pArray->pElements[i] > cur);
+        cur = pArray->pElements[i];
+    }
+}
+
+#ifdef DEBUG
+# define crSaValidate crSaDbgValidate
+#else
+# define crSaValidate(_a) do {} while (0)
+#endif
+
+static int crSaInsAt(CR_SORTARRAY *pArray, uint32_t iPos, uint64_t element)
+{
+    if (pArray->cSize == pArray->cBufferSize)
+    {
+        uint32_t cNewBufferSize = pArray->cBufferSize + 16;
+        uint64_t *pNew;
+        if (pArray->pElements)
+            pNew = (uint64_t*)RTMemRealloc(pArray->pElements, cNewBufferSize * sizeof (pArray->pElements[0]));
+        else
+            pNew = (uint64_t*)RTMemAlloc(cNewBufferSize * sizeof (pArray->pElements[0]));
+        if (!pNew)
+        {
+            WARN(("no memory"));
+            return VERR_NO_MEMORY;
+        }
+
+        pArray->pElements = pNew;
+        pArray->cBufferSize = cNewBufferSize;
+        crSaValidate(pArray);
+    }
+
+    for (int32_t i = (int32_t)pArray->cSize - 1; i >= (int32_t)iPos; --i)
+    {
+        pArray->pElements[i+1] = pArray->pElements[i];
+    }
+
+    pArray->pElements[iPos] = element;
+    ++pArray->cSize;
+
+    crSaValidate(pArray);
+
+    return VINF_SUCCESS;
+}
+
+static void crSaDelAt(CR_SORTARRAY *pArray, uint32_t iPos)
+{
+    Assert(pArray->cSize > iPos);
+
+    for (uint32_t i = iPos; i < pArray->cSize - 1; ++i)
+    {
+        pArray->pElements[i] = pArray->pElements[i+1];
+    }
+
+    --pArray->cSize;
+}
+
+static int crSaAdd(CR_SORTARRAY *pArray, uint64_t element)
+{
+    int iMin = 0;
+    int iMax = pArray->cSize;
+    int i = 0;
+    uint64_t el;
+
+    if (!iMax)
+        return crSaInsAt(pArray, 0, element);
+
+    el = element; /* Shup up MSC. */
+    while (iMin < iMax)
+    {
+        i = (iMax + iMin) / 2;
+
+        el = pArray->pElements[i];
+        if (el == element)
+            return VINF_ALREADY_INITIALIZED;
+        else if (el < element)
+            iMin = i + 1;
+        else
+            iMax = i;
+    }
+
+    if (el < element)
+        return crSaInsAt(pArray, i+1, element);
+    return crSaInsAt(pArray, i, element);
+}
+
+static int crSaRemove(CR_SORTARRAY *pArray, uint64_t element)
+{
+    int i = crSaSearch(pArray, element);
+    if (i >= 0)
+    {
+        crSaDelAt(pArray, i);
+        return VINF_SUCCESS;
+    }
+    return VINF_ALREADY_INITIALIZED;
+}
+
+/*
+ *  * @return true if element is found */
+VBOXSADECL(bool) CrSaContains(const CR_SORTARRAY *pArray, uint64_t element)
+{
+    return crSaSearch(pArray, element) >= 0;
+}
+
+VBOXSADECL(int) CrSaAdd(CR_SORTARRAY *pArray, uint64_t element)
+{
+    return crSaAdd(pArray, element);
+}
+
+VBOXSADECL(int) CrSaRemove(CR_SORTARRAY *pArray, uint64_t element)
+{
+    return crSaRemove(pArray, element);
+}
+
+static int crSaIntersected(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
+{
+    int rc = VINF_SUCCESS;
+    CrSaClear(pResult);
+
+    for (uint32_t i = 0, j = 0; i < pArray1->cSize && j < pArray2->cSize; )
+    {
+        if (pArray1->pElements[i] == pArray2->pElements[j])
+        {
+            rc = CrSaAdd(pResult, pArray1->pElements[i]);
+            if (rc < 0)
+            {
+                WARN(("CrSaAdd failed"));
+                return rc;
+            }
+
+            ++i;
+            ++j;
+        }
+        else if (pArray1->pElements[i] < pArray2->pElements[j])
+        {
+            ++i;
+        }
+        else
+        {
+            ++j;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static void crSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
+{
+    for (uint32_t i = 0, j = 0; i < pArray1->cSize && j < pArray2->cSize; )
+    {
+        if (pArray1->pElements[i] == pArray2->pElements[j])
+        {
+            ++i;
+            ++j;
+        }
+        else if (pArray1->pElements[i] < pArray2->pElements[j])
+            crSaDelAt(pArray1, i);
+        else
+            ++j;
+    }
+}
+
+/*
+ * @return >= 0 success
+ * < 0 - no memory
+ *  */
+VBOXSADECL(void) CrSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
+{
+    crSaIntersect(pArray1, pArray2);
+}
+
+VBOXSADECL(int) CrSaIntersected(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
+{
+    return crSaIntersected(pArray1, pArray2, pResult);
+}
+
+static int crSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
+{
+    int rc = VINF_SUCCESS;
+    CrSaClear(pResult);
+
+    uint32_t i = 0, j = 0;
+    uint32_t cResult = 0;
+    while (i < pArray1->cSize && j < pArray2->cSize)
+    {
+        uint64_t element;
+        if (pArray1->pElements[i] == pArray2->pElements[j])
+        {
+            element = pArray1->pElements[i];
+            ++i;
+            ++j;
+        }
+        else if (pArray1->pElements[i] < pArray2->pElements[j])
+        {
+            element = pArray1->pElements[i];
+            ++i;
+        }
+        else
+        {
+            element = pArray1->pElements[j];
+            ++j;
+        }
+
+        rc = crSaInsAt(pResult, cResult++, element);
+        if (rc < 0)
+        {
+            WARN(("crSaInsAt failed"));
+            return rc;
+        }
+    }
+
+    uint32_t iTail;
+    const CR_SORTARRAY *pTail;
+
+    if (i < pArray1->cSize)
+    {
+        iTail = i;
+        pTail = pArray1;
+    }
+    else if (j < pArray2->cSize)
+    {
+        iTail = j;
+        pTail = pArray2;
+    }
+    else
+    {
+        iTail = 0;
+        pTail = 0;
+    }
+
+    if (pTail)
+    {
+        for (;iTail < pTail->cSize; ++iTail)
+        {
+            rc = crSaInsAt(pResult, cResult++, pTail->pElements[iTail]);
+            if (rc < 0)
+            {
+                WARN(("crSaInsAt failed"));
+                return rc;
+            }
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+VBOXSADECL(int) CrSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
+{
+    return crSaUnited(pArray1, pArray2, pResult);
+}
+
+static int crSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult)
+{
+    CrSaClear(pResult);
+
+    if (pArray1->cSize > pResult->cBufferSize)
+    {
+        CrSaCleanup(pResult);
+        uint32_t cNewBufferSize = pArray1->cSize;
+        uint64_t *pNew = (uint64_t*)RTMemAlloc(cNewBufferSize * sizeof (pResult->pElements[0]));
+        if (!pNew)
+        {
+            WARN(("no memory"));
+            return VERR_NO_MEMORY;
+        }
+
+        pResult->pElements = pNew;
+        pResult->cBufferSize = cNewBufferSize;
+        crSaValidate(pResult);
+    }
+
+    pResult->cSize = pArray1->cSize;
+    memcpy(pResult->pElements, pArray1->pElements, pArray1->cSize * sizeof (pArray1->pElements[0]));
+    return VINF_SUCCESS;
+}
+
+/*
+ * @return VINF_SUCCESS on success
+ * VERR_NO_MEMORY - no memory
+ *  */
+VBOXSADECL(int) CrSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult)
+{
+    return crSaClone(pArray1, pResult);
+}
+
+static int crSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
+{
+    int diff = CrSaGetSize(pArray1) - CrSaGetSize(pArray2);
+    if (diff)
+        return diff;
+
+    return memcmp(pArray1->pElements, pArray2->pElements, pArray1->cSize * sizeof (pArray1->pElements[0]));
+}
+
+VBOXSADECL(int) CrSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
+{
+    return crSaCmp(pArray1, pArray2);
+}
+
+static bool crSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
+{
+    if (CrSaGetSize(pArray1) < CrSaGetSize(pArray2))
+        return false;
+
+    uint32_t i = 0, j = 0;
+    while (j < pArray2->cSize)
+    {
+        if (i == pArray1->cSize)
+            return false;
+
+        if (pArray1->pElements[i] == pArray2->pElements[j])
+        {
+            ++i;
+            ++j;
+        }
+        else if (pArray1->pElements[i] < pArray2->pElements[j])
+            ++i;
+        else
+            return false;
+    }
+
+    return true;
+}
+
+VBOXSADECL(bool) CrSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
+{
+    return crSaCovers(pArray1, pArray2);
+}
+
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.h	(revision 78190)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPSa.h	(revision 78190)
@@ -0,0 +1,102 @@
+/* $Id$ */
+
+/** @file
+ * Sorted array API
+ */
+
+/*
+ * Copyright (C) 2014-2019 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#ifndef ___cr_sortarray_h_
+#define ___cr_sortarray_h_
+
+#include <iprt/types.h>
+#include <iprt/assert.h>
+
+typedef struct CR_SORTARRAY
+{
+    uint32_t cBufferSize;
+    uint32_t cSize;
+    uint64_t *pElements;
+} CR_SORTARRAY;
+
+
+#ifndef IN_RING0
+# define VBOXSADECL(_type) DECLEXPORT(_type)
+#else
+# define VBOXSADECL(_type) RTDECL(_type)
+#endif
+
+
+DECLINLINE(uint32_t) CrSaGetSize(const CR_SORTARRAY *pArray)
+{
+    return pArray->cSize;
+}
+
+DECLINLINE(uint64_t) CrSaGetVal(const CR_SORTARRAY *pArray, uint32_t i)
+{
+    Assert(i < pArray->cSize);
+    return pArray->pElements[i];
+}
+
+DECLINLINE(const uint64_t*) CrSaGetElements(const CR_SORTARRAY *pArray)
+{
+    return pArray->pElements;
+}
+
+DECLINLINE(void) CrSaClear(CR_SORTARRAY *pArray)
+{
+    pArray->cSize = 0;
+}
+
+VBOXSADECL(int) CrSaInit(CR_SORTARRAY *pArray, uint32_t cInitBuffer);
+VBOXSADECL(void) CrSaCleanup(CR_SORTARRAY *pArray);
+/*
+ * @return true if element is found */
+VBOXSADECL(bool) CrSaContains(const CR_SORTARRAY *pArray, uint64_t element);
+
+/*
+ * @return VINF_SUCCESS  if element is added
+ * VINF_ALREADY_INITIALIZED if element was in array already
+ * VERR_NO_MEMORY - no memory
+ *  */
+VBOXSADECL(int) CrSaAdd(CR_SORTARRAY *pArray, uint64_t element);
+
+/*
+ * @return VINF_SUCCESS  if element is removed
+ * VINF_ALREADY_INITIALIZED if element was NOT in array
+ *  */
+VBOXSADECL(int) CrSaRemove(CR_SORTARRAY *pArray, uint64_t element);
+
+/*
+ * @return VINF_SUCCESS on success
+ * VERR_NO_MEMORY - no memory
+ *  */
+VBOXSADECL(void) CrSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
+VBOXSADECL(int) CrSaIntersected(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
+
+/*
+ * @return VINF_SUCCESS on success
+ * VERR_NO_MEMORY - no memory
+ *  */
+VBOXSADECL(int) CrSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
+
+/*
+ * @return VINF_SUCCESS on success
+ * VERR_NO_MEMORY - no memory
+ *  */
+VBOXSADECL(int) CrSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult);
+
+VBOXSADECL(int) CrSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
+
+VBOXSADECL(bool) CrSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
+
+#endif /* ___cr_sortarray_h_ */
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h	(revision 78188)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h	(revision 78190)
@@ -36,4 +36,5 @@
 #include "VBoxMPVbva.h"
 #include "VBoxMPCr.h"
+#include "VBoxMPSa.h"
 #include "VBoxMPVModes.h"
 
@@ -41,6 +42,4 @@
 #include <cr_vreg.h>
 #endif
-
-#include <cr_sortarray.h>
 
 #if 0
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVModes.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVModes.h	(revision 78188)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVModes.h	(revision 78190)
@@ -24,6 +24,5 @@
 //#include "../../common/VBoxVideoTools.h"
 
-#include <cr_sortarray.h>
-
+#include "VBoxMPSa.h"
 
 #define _CR_TYPECAST(_Type, _pVal) ((_Type*)((void*)(_pVal)))
Index: trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_config.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_config.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_config.c	(revision 78190)
@@ -15,11 +15,4 @@
 }
 
-/* No SPU options yet.
- */
-SPUOptions arraySPUOptions[] = {
-   { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
-};
-
-
 void arrayspuSetVBoxConfiguration( void )
 {
Index: trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_init.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_init.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_init.c	(revision 78190)
@@ -11,6 +11,4 @@
 
 extern SPUNamedFunctionTable _cr_array_table[];
-
-extern SPUOptions arraySPUOptions[];
 
 static SPUFunctions array_functions = {
@@ -73,5 +71,5 @@
 int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
          SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
-         SPUOptionsPtr *options, int *flags )
+         int *flags )
 {
     *name = "array";
@@ -80,5 +78,4 @@
     *self = arraySPUSelfDispatch;
     *cleanup = arraySPUCleanup;
-    *options = arraySPUOptions;
     *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
 
Index: trunk/src/VBox/Additions/common/crOpenGL/context.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/context.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/context.c	(revision 78190)
@@ -29,5 +29,4 @@
 #include "cr_mem.h"
 #include "cr_string.h"
-#include "cr_environment.h"
 #include "stub.h"
 
Index: trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h	(revision 78190)
@@ -18,5 +18,4 @@
 
 #include "cr_spu.h"
-#include "cr_timer.h"
 #include "cr_glstate.h"
 
@@ -52,6 +51,4 @@
 extern SPUNamedFunctionTable _cr_feedback_table[];
 
-extern SPUOptions feedbackSPUOptions[];
-
 extern void feedbackspuGatherConfiguration( void );
 
Index: trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c	(revision 78190)
@@ -6,5 +6,4 @@
 
 #include "cr_string.h"
-#include "cr_environment.h"
 #include "cr_error.h"
 #include "cr_mem.h"
@@ -21,21 +20,4 @@
 }
 
-static void set_default_viewport( void *foo, const char *response )
-{
-   (void) foo;
-   sscanf( response, "%d", &(feedback_spu.default_viewport) );
-}
-
-/* option, type, nr, default, min, max, title, callback
- */
-SPUOptions feedbackSPUOptions[] = {
-
-   { "default_viewport", CR_BOOL, 1, "0", "0", "1",
-     "Return default viewport parameters", (SPUOptionCB)set_default_viewport },
-
-   { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
-
-};
-
 
 void feedbackspuGatherConfiguration( void )
Index: trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c	(revision 78190)
@@ -6,5 +6,4 @@
 
 #include "cr_spu.h"
-#include "cr_environment.h"
 #include "cr_string.h"
 #include "cr_error.h"
@@ -73,5 +72,5 @@
 int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
 	     SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
-	     SPUOptionsPtr *options, int *flags )
+	     int *flags )
 {
 	*name = "feedback";
@@ -80,5 +79,4 @@
 	*self = feedbackSPUSelfDispatch;
 	*cleanup = feedbackSPUCleanup;
-	*options = feedbackSPUOptions;
 	*flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
 
Index: trunk/src/VBox/Additions/common/crOpenGL/icd_drv.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/icd_drv.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/icd_drv.c	(revision 78190)
@@ -28,4 +28,6 @@
 
 #include <iprt/win/windows.h>
+
+#include <stdio.h> /*sprintf*/
 
 /// @todo consider
Index: trunk/src/VBox/Additions/common/crOpenGL/load.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/load.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/load.c	(revision 78190)
@@ -11,7 +11,5 @@
 #include "cr_string.h"
 #include "cr_net.h"
-#include "cr_environment.h"
 #include "cr_process.h"
-#include "cr_rand.h"
 #include "cr_netserver.h"
 #include "stub.h"
@@ -19,8 +17,10 @@
 #include <string.h>
 #include <signal.h>
+#include <stdio.h> /*swprintf*/
 #include <iprt/initterm.h>
 #include <iprt/thread.h>
 #include <iprt/errcore.h>
 #include <iprt/asm.h>
+#include <iprt/env.h>
 #ifndef WINDOWS
 # include <sys/types.h>
@@ -601,140 +601,6 @@
 
 
-#if 0 /* unused */
-
-/**
- * Return a free port number for the mothership to use, or -1 if we
- * can't find one.
- */
-static int
-GenerateMothershipPort(void)
-{
-    const int MAX_PORT = 10100;
-    unsigned short port;
-
-    /* generate initial port number randomly */
-    crRandAutoSeed();
-    port = (unsigned short) crRandInt(10001, MAX_PORT);
-
-#ifdef WINDOWS
-    /* XXX should implement a free port check here */
-    return port;
-#else
-    /*
-     * See if this port number really is free, try another if needed.
-     */
-    {
-        struct sockaddr_in servaddr;
-        int so_reuseaddr = 1;
-        int sock, k;
-
-        /* create socket */
-        sock = socket(AF_INET, SOCK_STREAM, 0);
-        CRASSERT(sock > 2);
-
-        /* deallocate socket/port when we exit */
-        k = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-                                     (char *) &so_reuseaddr, sizeof(so_reuseaddr));
-        CRASSERT(k == 0);
-
-        /* initialize the servaddr struct */
-        crMemset(&servaddr, 0, sizeof(servaddr) );
-        servaddr.sin_family = AF_INET;
-        servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
-
-        while (port < MAX_PORT) {
-            /* Bind to the given port number, return -1 if we fail */
-            servaddr.sin_port = htons((unsigned short) port);
-            k = bind(sock, (struct sockaddr *) &servaddr, sizeof(servaddr));
-            if (k) {
-                /* failed to create port. try next one. */
-                port++;
-            }
-            else {
-                /* free the socket/port now so mothership can make it */
-                close(sock);
-                return port;
-            }
-        }
-    }
-#endif /* WINDOWS */
-    return -1;
-}
-
-
-/**
- * Try to determine which mothership configuration to use for this program.
- */
-static char **
-LookupMothershipConfig(const char *procName)
-{
-    const int procNameLen = crStrlen(procName);
-    FILE *f;
-    const char *home;
-    char configPath[1000];
-
-    /* first, check if the CR_CONFIG env var is set */
-    {
-        const char *conf = crGetenv("CR_CONFIG");
-        if (conf && crStrlen(conf) > 0)
-            return crStrSplit(conf, " ");
-    }
-
-    /* second, look up config name from config file */
-    home = crGetenv("HOME");
-    if (home)
-        sprintf(configPath, "%s/%s", home, CONFIG_LOOKUP_FILE);
-    else
-        crStrcpy(configPath, CONFIG_LOOKUP_FILE); /* from current dir */
-    /* Check if the CR_CONFIG_PATH env var is set. */
-    {
-        const char *conf = crGetenv("CR_CONFIG_PATH");
-        if (conf)
-            crStrcpy(configPath, conf); /* from env var */
-    }
-
-    f = fopen(configPath, "r");
-    if (!f) {
-        return NULL;
-    }
-
-    while (!feof(f)) {
-        char line[1000];
-        char **args;
-        fgets(line, 999, f);
-        line[crStrlen(line) - 1] = 0; /* remove trailing newline */
-        if (crStrncmp(line, procName, procNameLen) == 0 &&
-            (line[procNameLen] == ' ' || line[procNameLen] == '\t'))
-        {
-            crWarning("Using Chromium configuration for %s from %s",
-                                procName, configPath);
-            args = crStrSplit(line + procNameLen + 1, " ");
-            return args;
-        }
-    }
-    fclose(f);
-    return NULL;
-}
-
-
-static int Mothership_Awake = 0;
-
-
-/**
- * Signal handler to determine when mothership is ready.
- */
-static void
-MothershipPhoneHome(int signo)
-{
-    crDebug("Got signal %d: mothership is awake!", signo);
-    Mothership_Awake = 1;
-}
-
-#endif /* 0 */
-
 static void stubSetDefaultConfigurationOptions(void)
 {
-    unsigned char key[16]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
     stub.appDrawCursor = 0;
     stub.minChromiumWindowWidth = 0;
@@ -752,8 +618,4 @@
     stub.matchChromiumWindowCount = 0;
     stub.spu_dir = NULL;
-    crNetSetRank(0);
-    crNetSetContextRange(32, 35);
-    crNetSetNodeRange("iam0", "iamvis20");
-    crNetSetKey(key,sizeof(key));
     stub.force_pbuffers = 0;
 
@@ -963,5 +825,5 @@
 
     /** @todo check if it'd be of any use on other than guests, no use for windows */
-    app_id = crGetenv( "CR_APPLICATION_ID_NUMBER" );
+    app_id = RTEnvGet( "CR_APPLICATION_ID_NUMBER" );
 
     crNetInit( NULL, NULL );
@@ -1347,5 +1209,5 @@
 
 #ifdef VDBG_VEHANDLER
-        env = crGetenv("CR_DBG_VEH_ENABLE");
+        env = RTEnvGet("CR_DBG_VEH_ENABLE");
         g_VBoxVehEnable = crStrParseI32(env,
 # ifdef DEBUG_misha
@@ -1362,5 +1224,5 @@
             size_t cChars;
 
-            env = crGetenv("CR_DBG_VEH_FLAGS");
+            env = RTEnvGet("CR_DBG_VEH_FLAGS");
             g_VBoxVehFlags = crStrParseI32(env,
                     0
@@ -1372,5 +1234,5 @@
                     );
 
-            env = crGetenv("CR_DBG_VEH_DUMP_DIR");
+            env = RTEnvGet("CR_DBG_VEH_DUMP_DIR");
             if (!env)
                 env = VBOXMD_DUMP_DIR_DEFAULT;
@@ -1410,5 +1272,5 @@
             g_aszwVBoxMdFilePrefix[g_cVBoxMdFilePrefixLen] = L'\0';
 
-            env = crGetenv("CR_DBG_VEH_DUMP_TYPE");
+            env = RTEnvGet("CR_DBG_VEH_DUMP_TYPE");
 
             g_enmVBoxMdDumpType = crStrParseI32(env,
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py	(revision 78190)
@@ -53,5 +53,5 @@
         print('\t__fillin(%3d, "%s", (SPUGenericFunction) packspu_%s);' % (index, func_name, func_name ))
     else:
-        print('\t__fillin(%3d, "%s", (SPUGenericFunction) (pack_spu.swap ? crPack%sSWAP : crPack%s));' % (index, func_name, func_name, func_name ))
+        print('\t__fillin(%3d, "%s", (SPUGenericFunction) (crPack%s));' % (index, func_name, func_name ))
 print('\t__fillin(%3d, NULL, NULL);' % num_funcs)
 print('}')
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h	(revision 78190)
@@ -82,5 +82,4 @@
 typedef struct {
     int id;
-    int swap;
 
     /* config options */
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py	(revision 78190)
@@ -48,13 +48,5 @@
 #endif
 
-    if (pack_spu.swap)
-    {
-        crPackBeginSWAP( mode );
-    }
-    else
-    {
-        crPackBegin( mode );
-    }
-
+    crPackBegin( mode );
     if ( thread->netServer.conn->Barf ) {
         thread->BeginEndMode = mode;
@@ -99,12 +91,5 @@
     }
 
-    if (pack_spu.swap)
-    {
-        crPackEndSWAP();
-    }
-    else
-    {
-        crPackEnd();
-    }
+    crPackEnd();
 }
 
@@ -166,12 +151,5 @@
     print('void PACKSPU_APIENTRY packspu_%s(%s)' % ( func_name, apiutil.MakeDeclarationString(params) ))
     print('{')
-    print('\tif (pack_spu.swap)')
-    print('\t{')
-    print('\t\tcrPack%sSWAP(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
-    print('\t}')
-    print('\telse')
-    print('\t{')
-    print('\t\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
-    print('\t}')
+    print('\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
     print('\tRunState();')
     print('}')
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c	(revision 78190)
@@ -140,12 +140,6 @@
         crError( "packspu_GenBuffersARB doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackGenBuffersARBSWAP( n, buffer, &writeback );
-    }
-    else
-    {
-        crPackGenBuffersARB( n, buffer, &writeback );
-    }
+
+    crPackGenBuffersARB( n, buffer, &writeback );
     packspuFlush( (void *) thread );
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c	(revision 78190)
@@ -15,9 +15,6 @@
 #if CR_ARB_vertex_buffer_object
     GET_CONTEXT(ctx);
-    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackFogCoordPointerEXTSWAP( type, stride, pointer );
-        else
-            crPackFogCoordPointerEXT( type, stride, pointer );
+   if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
+        crPackFogCoordPointerEXT( type, stride, pointer );
     }
 #endif
@@ -30,8 +27,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackColorPointerSWAP( size, type, stride, pointer );
-        else
-            crPackColorPointer( size, type, stride, pointer );
+        crPackColorPointer( size, type, stride, pointer );
     }
 #endif
@@ -44,8 +38,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackSecondaryColorPointerEXTSWAP( size, type, stride, pointer );
-        else
-            crPackSecondaryColorPointerEXT( size, type, stride, pointer );
+        crPackSecondaryColorPointerEXT( size, type, stride, pointer );
     }
 #endif
@@ -59,8 +50,5 @@
     CRASSERT(ctx->clientState->extensions.ARB_vertex_buffer_object);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackVertexPointerSWAP( size, type, stride, pointer );
-        else
-            crPackVertexPointer( size, type, stride, pointer );
+        crPackVertexPointer( size, type, stride, pointer );
     }
 #endif
@@ -73,8 +61,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackTexCoordPointerSWAP( size, type, stride, pointer );
-        else
-            crPackTexCoordPointer( size, type, stride, pointer );
+        crPackTexCoordPointer( size, type, stride, pointer );
     }
 #endif
@@ -87,8 +72,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackNormalPointerSWAP( type, stride, pointer );
-        else
-            crPackNormalPointer( type, stride, pointer );
+        crPackNormalPointer( type, stride, pointer );
     }
 #endif
@@ -101,8 +83,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackEdgeFlagPointerSWAP( stride, pointer );
-        else
-            crPackEdgeFlagPointer( stride, pointer );
+        crPackEdgeFlagPointer( stride, pointer );
     }
 #endif
@@ -115,8 +94,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackVertexAttribPointerARBSWAP( index, size, type, normalized, stride, pointer );
-        else
-            crPackVertexAttribPointerARB( index, size, type, normalized, stride, pointer );
+        crPackVertexAttribPointerARB( index, size, type, normalized, stride, pointer );
     }
 #endif
@@ -129,8 +105,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackVertexAttribPointerNVSWAP( index, size, type, stride, pointer );
-        else
-            crPackVertexAttribPointerNV( index, size, type, stride, pointer );
+        crPackVertexAttribPointerNV( index, size, type, stride, pointer );
     }
 #endif
@@ -143,8 +116,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackIndexPointerSWAP( type, stride, pointer );
-        else
-            crPackIndexPointer( type, stride, pointer );
+        crPackIndexPointer( type, stride, pointer );
     }
 #endif
@@ -162,8 +132,5 @@
     GET_CONTEXT(ctx);
     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
-        if (pack_spu.swap)
-            crPackInterleavedArraysSWAP( format, stride, pointer );
-        else
-            crPackInterleavedArrays( format, stride, pointer );
+        crPackInterleavedArrays( format, stride, pointer );
     }
 #endif
@@ -380,8 +347,5 @@
 
         /* Send the DrawArrays command over the wire */
-        if (pack_spu.swap)
-            crPackArrayElementSWAP( index );
-        else
-            crPackArrayElement( index );
+        crPackArrayElement( index );
 
         if (cZvaValues)
@@ -400,8 +364,5 @@
 #endif
 
-        if (pack_spu.swap)
-            crPackExpandArrayElementSWAP( index, clientState, cZvaValues ? aAttrib : NULL );
-        else
-            crPackExpandArrayElement( index, clientState, cZvaValues ? aAttrib : NULL );
+        crPackExpandArrayElement( index, clientState, cZvaValues ? aAttrib : NULL );
 
 #ifdef CR_FORCE_ZVA_SERVER_ARRAY
@@ -529,8 +490,5 @@
 
         /* Send the DrawArrays command over the wire */
-        if (pack_spu.swap)
-            crPackDrawElementsSWAP( mode, count, type, indices );
-        else
-            crPackDrawElements( mode, count, type, indices );
+        crPackDrawElements( mode, count, type, indices );
 
         if (cZvaValues)
@@ -549,12 +507,7 @@
 #endif
 
-        if (pack_spu.swap)
-            crPackExpandDrawElementsSWAP( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
-        else
-        {
-            //packspu_Begin(mode);
-            crPackExpandDrawElements( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
-            //packspu_End();
-        }
+        //packspu_Begin(mode);
+        crPackExpandDrawElements( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
+        //packspu_End();
 
 #ifdef CR_FORCE_ZVA_SERVER_ARRAY
@@ -615,8 +568,5 @@
 
         /* Send the DrawRangeElements command over the wire */
-        if (pack_spu.swap)
-            crPackDrawRangeElementsSWAP( mode, start, end, count, type, indices );
-        else
-            crPackDrawRangeElements( mode, start, end, count, type, indices );
+        crPackDrawRangeElements( mode, start, end, count, type, indices );
 
         if (cZvaValues)
@@ -634,10 +584,5 @@
 #endif
 
-        if (pack_spu.swap)
-            crPackExpandDrawRangeElementsSWAP( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
-        else
-        {
-            crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
-        }
+        crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
 
 #ifdef CR_FORCE_ZVA_SERVER_ARRAY
@@ -709,8 +654,5 @@
 
         /* Send the DrawArrays command over the wire */
-        if (pack_spu.swap)
-            crPackDrawArraysSWAP( mode, first, count );
-        else
-            crPackDrawArrays( mode, first, count );
+        crPackDrawArrays( mode, first, count );
 
         if (cZvaValues)
@@ -729,8 +671,5 @@
 #endif
 
-        if (pack_spu.swap)
-            crPackExpandDrawArraysSWAP( mode, first, count, clientState, cZvaValues ? aAttrib : NULL );
-        else
-            crPackExpandDrawArrays( mode, first, count, clientState, cZvaValues ? aAttrib : NULL );
+        crPackExpandDrawArrays( mode, first, count, clientState, cZvaValues ? aAttrib : NULL );
 
 #ifdef CR_FORCE_ZVA_SERVER_ARRAY
@@ -809,9 +748,5 @@
     {
         crStateEnable(cap);
-
-        if (pack_spu.swap)
-            crPackEnableSWAP(cap);
-        else
-            crPackEnable(cap);
+        crPackEnable(cap);
     }
     else
@@ -834,9 +769,5 @@
     {
         crStateDisable(cap);
-
-        if (pack_spu.swap)
-            crPackDisableSWAP(cap);
-        else
-            crPackDisable(cap);
+        crPackDisable(cap);
     }
     else
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_config.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_config.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_config.c	(revision 78190)
@@ -23,31 +23,4 @@
 
 
-static void set_emit( void *foo, const char *response )
-{
-    RT_NOREF(foo);
-    sscanf( response, "%d", &(pack_spu.emit_GATHER_POST_SWAPBUFFERS) );
-}
-
-static void set_swapbuffer_sync( void *foo, const char *response )
-{
-    RT_NOREF(foo);
-    sscanf( response, "%d", &(pack_spu.swapbuffer_sync) );
-}
-
-
-
-/* No SPU options yet. Well.. not really..
- */
-SPUOptions packSPUOptions[] = {
-    { "emit_GATHER_POST_SWAPBUFFERS", CR_BOOL, 1, "0", NULL, NULL,
-      "Emit a parameter after SwapBuffers", (SPUOptionCB)set_emit },
-
-    { "swapbuffer_sync", CR_BOOL, 1, "1", NULL, NULL,
-        "Sync on SwapBuffers", (SPUOptionCB) set_swapbuffer_sync },
-
-    { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
-};
-
-
 void packspuSetVBoxConfiguration( const SPU *child_spu )
 {
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c	(revision 78190)
@@ -69,5 +69,5 @@
     /* packer setup */
     CRASSERT(thread->packer == NULL);
-    thread->packer = crPackNewContext( pack_spu.swap );
+    thread->packer = crPackNewContext();
     CRASSERT(thread->packer);
     crPackInitBuffer( &(thread->buffer), crNetAlloc(thread->netServer.conn),
@@ -357,8 +357,5 @@
 
     /* Pack the command */
-    if (pack_spu.swap)
-        crPackCreateContextSWAP( dpyName, visual, shareCtx, &serverCtx, &writeback );
-    else
-        crPackCreateContext( dpyName, visual, shareCtx, &serverCtx, &writeback );
+    crPackCreateContext( dpyName, visual, shareCtx, &serverCtx, &writeback );
 
     /* Flush buffer and get return value */
@@ -385,7 +382,4 @@
         CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
 
-        if (pack_spu.swap) {
-            serverCtx = (GLint) SWAP32(serverCtx);
-        }
         if (serverCtx < 0) {
 #ifdef CHROMIUM_THREADSAFE
@@ -472,9 +466,5 @@
         }
 
-        if (pack_spu.swap)
-            crPackDestroyContextSWAP( context->serverCtx );
-        else
-            crPackDestroyContext( context->serverCtx );
-
+        crPackDestroyContext( context->serverCtx );
         crStateDestroyContext( context->clientState );
 
@@ -600,9 +590,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackMakeCurrentSWAP( window, nativeWindow, serverCtx );
-    else
-        crPackMakeCurrent( window, nativeWindow, serverCtx );
-
+    crPackMakeCurrent( window, nativeWindow, serverCtx );
     if (serverCtx)
     {
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py	(revision 78190)
@@ -31,12 +31,5 @@
     print('{')
     print('\tGET_THREAD(thread);')
-    print('\tif (pack_spu.swap)')
-    print('\t{')
-    print('\t\tcrPack%sSWAP(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
-    print('\t}')
-    print('\telse')
-    print('\t{')
-    print('\t\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
-    print('\t}')
+    print('\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
     print('\tpackspuFlush( (void *) thread );')
     print('}\n')
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c	(revision 78190)
@@ -107,12 +107,6 @@
         crError( "packspu_GenFramebuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackGenFramebuffersEXTSWAP( n, framebuffers, &writeback );
-    }
-    else
-    {
-        crPackGenFramebuffersEXT( n, framebuffers, &writeback );
-    }
+
+    crPackGenFramebuffersEXT( n, framebuffers, &writeback );
     packspuFlush( (void *) thread );
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
@@ -129,12 +123,6 @@
         crError( "packspu_GenRenderbuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackGenRenderbuffersEXTSWAP( n, renderbuffers, &writeback );
-    }
-    else
-    {
-        crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
-    }
+
+    crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
     packspuFlush( (void *) thread );
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py	(revision 78190)
@@ -49,31 +49,10 @@
 """)
 
+print('#ifdef DEBUG');
 from get_sizes import *
-
-easy_swaps = {
-    'GenTextures': '(unsigned int) n',
-    'GetClipPlane': '4',
-    'GetPolygonStipple': '0'
-}
+print('#endif');
 
 simple_funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ]
-simple_swaps = [ 'SWAP32', 'SWAPFLOAT', 'SWAPDOUBLE', '(GLboolean) SWAP32' ]
-
 vertattr_get_funcs = [ 'GetVertexAttribdv' 'GetVertexAttribfv' 'GetVertexAttribiv' ]
-
-hard_funcs = {
-    'GetLightfv': 'SWAPFLOAT',
-    'GetLightiv': 'SWAP32',
-    'GetMaterialfv': 'SWAPFLOAT',
-    'GetMaterialiv': 'SWAP32',
-    'GetTexEnvfv': 'SWAPFLOAT',
-    'GetTexEnviv': 'SWAP32',
-    'GetTexGendv': 'SWAPDOUBLE',
-    'GetTexGenfv': 'SWAPFLOAT',
-    'GetTexGeniv': 'SWAP32',
-    'GetTexLevelParameterfv': 'SWAPFLOAT',
-    'GetTexLevelParameteriv': 'SWAP32',
-    'GetTexParameterfv': 'SWAPFLOAT',
-    'GetTexParameteriv': 'SWAP32' }
 
 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
@@ -93,6 +72,4 @@
             print('\t%s return_val = (%s) 0;' % (return_type, return_type))
             params.append( ("&return_val", "foo", 0) )
-        if (func_name in easy_swaps and easy_swaps[func_name] != '0') or func_name in simple_funcs or func_name in hard_funcs:
-            print('\tunsigned int i;')
         print('\tif (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))')
         print('\t{')
@@ -138,4 +115,5 @@
                )
             {
+                unsigned int i = 0;
                 %s localparams;
                 localparams = (%s) crAlloc(__numValues(pname) * sizeof(*localparams));
@@ -193,12 +171,5 @@
 
         params.append( ("&writeback", "foo", 0) )
-        print('\tif (pack_spu.swap)')
-        print('\t{')
-        print('\t\tcrPack%sSWAP(%s);' % (func_name, apiutil.MakeCallString( params ) ))
-        print('\t}')
-        print('\telse')
-        print('\t{')
-        print('\t\tcrPack%s(%s);' % (func_name, apiutil.MakeCallString( params ) ))
-        print('\t}')
+        print('\tcrPack%s(%s);' % (func_name, apiutil.MakeCallString( params ) ))
         print('\tpackspuFlush( (void *) thread );')
         print('\tCRPACKSPU_WRITEBACK_WAIT(thread, writeback);')
@@ -208,43 +179,4 @@
         lastParamName = params[-2][0]
         if return_type != 'void':
-            print('\tif (pack_spu.swap)')
-            print('\t{')
-            print('\t\treturn_val = (%s) SWAP32(return_val);' % return_type)
-            print('\t}')
             print('\treturn return_val;')
-        if func_name in easy_swaps and easy_swaps[func_name] != '0':
-            limit = easy_swaps[func_name]
-            print('\tif (pack_spu.swap)')
-            print('\t{')
-            print('\t\tfor (i = 0; i < %s; i++)' % limit)
-            print('\t\t{')
-            if params[-2][1].find( "double" ) > -1:
-                print('\t\t\t%s[i] = SWAPDOUBLE(%s[i]);' % (lastParamName, lastParamName))
-            else:
-                print('\t\t\t%s[i] = SWAP32(%s[i]);' % (lastParamName, lastParamName))
-            print('\t\t}')
-            print('\t}')
-        for index in range(len(simple_funcs)):
-            if simple_funcs[index] == func_name:
-                print('\tif (pack_spu.swap)')
-                print('\t{')
-                print('\t\tfor (i = 0; i < __numValues(pname); i++)')
-                print('\t\t{')
-                if simple_swaps[index] == 'SWAPDOUBLE':
-                    print('\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName))
-                else:
-                    print('\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName))
-                print('\t\t}')
-                print('\t}')
-        if func_name in hard_funcs:
-            print('\tif (pack_spu.swap)')
-            print('\t{')
-            print('\t\tfor (i = 0; i < crStateHlpComponentsCount(pname); i++)')
-            print('\t\t{')
-            if hard_funcs[func_name] == 'SWAPDOUBLE':
-                print('\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName))
-            else:
-                print('\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName))
-            print('\t\t}')
-            print('\t}')
         print('}\n')
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c	(revision 78190)
@@ -17,4 +17,7 @@
 static GLubyte gpszShadingVersion[255]="";
 #endif
+static uint32_t g_uOpenGlVersMaj = 0;
+static uint32_t g_uOpenGlVersMin = 0;
+
 
 static void GetString(GLenum name, GLubyte *pszStr)
@@ -23,8 +26,5 @@
     int writeback = 1;
 
-    if (pack_spu.swap)
-        crPackGetStringSWAP(name, pszStr, &writeback);
-    else
-        crPackGetString(name, pszStr, &writeback);
+    crPackGetString(name, pszStr, &writeback);
     packspuFlush( (void *) thread );
 
@@ -32,5 +32,5 @@
 }
 
-static GLfloat
+static void
 GetVersionString(void)
 {
@@ -40,4 +40,5 @@
     if (!fInitialized)
     {
+        int iGlVersion = 0;
         GLubyte return_value[100];
 
@@ -45,11 +46,11 @@
         CRASSERT(crStrlen((char *)return_value) < 100);
 
-        version = crStrToFloat((char *) return_value);
-        version = crStateComputeVersion(version);
+        iGlVersion = crStrParseGlVersion((const char *) return_value);
+        g_uOpenGlVersMaj = CR_GLVERSION_GET_MAJOR(iGlVersion);
+        g_uOpenGlVersMin = CR_GLVERSION_GET_MINOR(iGlVersion);
+        crStateComputeVersion(&g_uOpenGlVersMaj, &g_uOpenGlVersMin);
 
         fInitialized = GL_TRUE;
     }
-
-    return version;
 }
 
@@ -65,12 +66,5 @@
         int writeback = 1;
 
-        if (pack_spu.swap)
-        {
-            crPackGetStringSWAP( GL_EXTENSIONS, return_value, &writeback );
-        }
-        else
-        {
-            crPackGetString( GL_EXTENSIONS, return_value, &writeback );
-        }
+        crPackGetString( GL_EXTENSIONS, return_value, &writeback );
         packspuFlush( (void *) thread );
 
@@ -129,5 +123,4 @@
             {
                 char *oldlocale;
-                float version;
 
                 oldlocale = setlocale(LC_NUMERIC, NULL);
@@ -135,6 +128,6 @@
                 setlocale(LC_NUMERIC, "C");
 
-                version = GetVersionString();
-                sprintf((char*)ctx->glVersion, "%.1f Chromium %s", version, CR_VERSION_STRING);
+                GetVersionString();
+                sprintf((char*)ctx->glVersion, "%u.%u Chromium %s", g_uOpenGlVersMaj, g_uOpenGlVersMin, CR_VERSION_STRING);
 
                 if (oldlocale)
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c	(revision 78190)
@@ -33,19 +33,7 @@
         crError("packspu_CreateProgram doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!");
     }
-    if (pack_spu.swap)
-    {
-        crPackCreateProgramSWAP(&return_val, &writeback);
-    }
-    else
-    {
-        crPackCreateProgram(&return_val, &writeback);
-    }
+    crPackCreateProgram(&return_val, &writeback);
     packspuFlush((void *) thread);
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
-    if (pack_spu.swap)
-    {
-        return_val = (GLuint) SWAP32(return_val);
-    }
-
     crStateCreateProgram(return_val);
 
@@ -62,18 +50,8 @@
         crError("packspu_GetUniformLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!");
     }
-    if (pack_spu.swap)
-    {
-        crPackGetUniformLocationSWAP(program, name, &return_val, &writeback);
-    }
-    else
-    {
-        crPackGetUniformLocation(program, name, &return_val, &writeback);
-    }
+
+    crPackGetUniformLocation(program, name, &return_val, &writeback);
     packspuFlush((void *) thread);
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
-    if (pack_spu.swap)
-    {
-        return_val = (GLint) SWAP32(return_val);
-    }
     return return_val;
 }
@@ -124,18 +102,8 @@
         crError( "packspu_GetAttribLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackGetAttribLocationSWAP( program, name, &return_val, &writeback );
-    }
-    else
-    {
-        crPackGetAttribLocation( program, name, &return_val, &writeback );
-    }
+
+    crPackGetAttribLocation( program, name, &return_val, &writeback );
     packspuFlush( (void *) thread );
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
-    if (pack_spu.swap)
-    {
-        return_val = (GLint) SWAP32(return_val);
-    }
     return return_val;
 }
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c	(revision 78190)
@@ -135,9 +135,7 @@
 }
 
-extern SPUOptions packSPUOptions[];
-
 int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
          SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
-         SPUOptionsPtr *options, int *flags )
+         int *flags )
 {
     *name = "pack";
@@ -146,5 +144,4 @@
     *self = packSPUSelfDispatch;
     *cleanup = packSPUCleanup;
-    *options = packSPUOptions;
     *flags = (SPU_HAS_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ONE);
 
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c	(revision 78190)
@@ -85,8 +85,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackChromiumParametervCRSWAP(target, type, count, values);
-    else
-        crPackChromiumParametervCR(target, type, count, values);
+    crPackChromiumParametervCR(target, type, count, values);
 
     if (fFlush)
@@ -131,21 +128,10 @@
     GLint writeback = CRPACKSPU_IS_WDDM_CRHGSMI() ? 1 : pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network;
 
-    if (pack_spu.swap)
-    {
-        crPackFinishSWAP();
-    }
-    else
-    {
-        crPackFinish();
-    }
-
+    crPackFinish();
     if (packspuSyncOnFlushes())
     {
         if (writeback)
         {
-            if (pack_spu.swap)
-                crPackWritebackSWAP(&writeback);
-            else
-                crPackWriteback(&writeback);
+            crPackWriteback(&writeback);
 
             packspuFlush( (void *) thread );
@@ -277,13 +263,5 @@
 
     crPackSetContext(thread->packer);
-
-    if (pack_spu.swap)
-    {
-        crPackWindowCreateSWAP( dpyName, visBits, &return_val, &writeback );
-    }
-    else
-    {
-        crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
-    }
+    crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
     packspuFlush(thread);
     if (!(thread->netServer.conn->actual_network))
@@ -294,8 +272,4 @@
     {
         CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
-        if (pack_spu.swap)
-        {
-            return_val = (GLint) SWAP32(return_val);
-        }
         retVal = return_val;
     }
@@ -334,12 +308,5 @@
     }
 
-    if (pack_spu.swap)
-    {
-        crPackAreTexturesResidentSWAP( n, textures, residences, &return_val, &writeback );
-    }
-    else
-    {
-        crPackAreTexturesResident( n, textures, residences, &return_val, &writeback );
-    }
+    crPackAreTexturesResident( n, textures, residences, &return_val, &writeback );
     packspuFlush( (void *) thread );
 
@@ -373,12 +340,6 @@
         crError( "packspu_AreProgramsResidentNV doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackAreProgramsResidentNVSWAP( n, ids, residences, &return_val, &writeback );
-    }
-    else
-    {
-        crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback );
-    }
+
+    crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback );
     packspuFlush( (void *) thread );
 
@@ -403,13 +364,5 @@
     int writeback = 1;
 
-    if (pack_spu.swap)
-    {
-        crPackGetPolygonStippleSWAP( mask, &writeback );
-    }
-    else
-    {
-        crPackGetPolygonStipple( mask, &writeback );
-    }
-
+    crPackGetPolygonStipple( mask, &writeback );
 #ifdef CR_ARB_pixel_buffer_object
     if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
@@ -426,13 +379,5 @@
     int writeback = 1;
 
-    if (pack_spu.swap)
-    {
-        crPackGetPixelMapfvSWAP( map, values, &writeback );
-    }
-    else
-    {
-        crPackGetPixelMapfv( map, values, &writeback );
-    }
-
+    crPackGetPixelMapfv( map, values, &writeback );
 #ifdef CR_ARB_pixel_buffer_object
     if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
@@ -449,12 +394,5 @@
     int writeback = 1;
 
-    if (pack_spu.swap)
-    {
-        crPackGetPixelMapuivSWAP( map, values, &writeback );
-    }
-    else
-    {
-        crPackGetPixelMapuiv( map, values, &writeback );
-    }
+    crPackGetPixelMapuiv( map, values, &writeback );
 
 #ifdef CR_ARB_pixel_buffer_object
@@ -472,13 +410,5 @@
     int writeback = 1;
 
-    if (pack_spu.swap)
-    {
-        crPackGetPixelMapusvSWAP( map, values, &writeback );
-    }
-    else
-    {
-        crPackGetPixelMapusv( map, values, &writeback );
-    }
-
+    crPackGetPixelMapusv( map, values, &writeback );
 #ifdef CR_ARB_pixel_buffer_object
     if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
@@ -558,21 +488,8 @@
         crError( "packspu_GetError doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackGetErrorSWAP( &return_val, &writeback );
-    }
-    else
-    {
-        crPackGetError( &return_val, &writeback );
-    }
-
+
+    crPackGetError( &return_val, &writeback );
     packspuFlush( (void *) thread );
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
-
-    if (pack_spu.swap)
-    {
-        return_val = (GLenum) SWAP32(return_val);
-    }
-
     return return_val;
 }
@@ -619,5 +536,5 @@
 
         CRASSERT(thread->packer == NULL);
-        thread->packer = crPackNewContext( pack_spu.swap );
+        thread->packer = crPackNewContext();
         CRASSERT(thread->packer);
         crPackInitBuffer(&(thread->buffer), crNetAlloc(thread->netServer.conn),
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c	(revision 78190)
@@ -95,14 +95,6 @@
     CRASSERT( (void *) hdr >= buf->pack );
 
-    if (pack_spu.swap)
-    {
-        hdr->header.type = (CRMessageType) SWAP32(CR_MESSAGE_OPCODES);
-        hdr->numOpcodes  = SWAP32(num_opcodes);
-    }
-    else
-    {
-        hdr->header.type = CR_MESSAGE_OPCODES;
-        hdr->numOpcodes  = num_opcodes;
-    }
+    hdr->header.type = CR_MESSAGE_OPCODES;
+    hdr->numOpcodes  = num_opcodes;
 
     *len = buf->data_current - (unsigned char *) hdr;
@@ -206,9 +198,4 @@
        a header */
     len = ((unsigned int *) buf)[-1];
-    if (pack_spu.swap)
-    {
-        /* It's already been swapped, swap it back. */
-        len = SWAP32(len);
-    }
     len += 4 + sizeof(CRMessageOpcodes);
 
@@ -221,15 +208,6 @@
 
     msg = (CRMessageOpcodes *) src;
-
-    if (pack_spu.swap)
-    {
-        msg->header.type = (CRMessageType) SWAP32(CR_MESSAGE_OPCODES);
-        msg->numOpcodes  = SWAP32(1);
-    }
-    else
-    {
-        msg->header.type = CR_MESSAGE_OPCODES;
-        msg->numOpcodes  = 1;
-    }
+    msg->header.type = CR_MESSAGE_OPCODES;
+    msg->numOpcodes  = 1;
 
     CRASSERT( thread->netServer.conn );
@@ -272,5 +250,4 @@
             return;
         }
-        pack_spu.swap = server->conn->swap;
     }
     else {
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c	(revision 78190)
@@ -330,8 +330,5 @@
 {
     GET_THREAD(thread);
-    if (pack_spu.swap)
-        crPackCopyPixelsSWAP( x, y, width, height, type );
-    else
-        crPackCopyPixels( x, y, width, height, type );
+    crPackCopyPixels( x, y, width, height, type );
     /* XXX why flush here? */
     packspuFlush( (void *) thread );
@@ -378,9 +375,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexImage1DSWAP( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -411,9 +404,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexImage2DSWAP( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -433,9 +422,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexImage3DEXTSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -456,9 +441,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexImage3DSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -484,9 +465,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexSubImage1DSWAP( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -511,9 +488,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexSubImage2DSWAP( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -533,9 +506,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackTexSubImage3DSWAP( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
-    else
-        crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
-
+    crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
     if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     {
@@ -549,8 +518,5 @@
     GET_CONTEXT(ctx);
     CRClientState *clientState = &(ctx->clientState->client);
-    if (pack_spu.swap)
-        crPackZPixCRSWAP( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
-    else
-        crPackZPixCR( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
+    crPackZPixCR( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
 }
 
@@ -572,9 +538,5 @@
     }
 
-    if (pack_spu.swap)
-        crPackGetTexImageSWAP( target, level, format, type, pixels, &(clientState->pack), &writeback );
-    else
-        crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback );
-
+    crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback );
     if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     {
@@ -601,13 +563,5 @@
     }
 
-    if (pack_spu.swap)
-    {
-        crPackGetCompressedTexImageARBSWAP( target, level, img, &writeback );
-    }
-    else
-    {
-        crPackGetCompressedTexImageARB( target, level, img, &writeback );
-    }
-
+    crPackGetCompressedTexImageARB( target, level, img, &writeback );
     if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     {
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c	(revision 78190)
@@ -11,22 +11,4 @@
 #include "packspu_proto.h"
 
-#if 0
-
-void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags )
-{
-    GET_THREAD(thread);
-    if (pack_spu.swap)
-    {
-        crPackSwapBuffersSWAP( window, flags );
-    }
-    else
-    {
-        crPackSwapBuffers( window, flags );
-    }
-    packspuFlush( (void *) thread );
-}
-
-
-#else
 
 void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags )
@@ -34,12 +16,5 @@
     GET_THREAD(thread);
 
-    if (pack_spu.swap)
-    {
-        crPackSwapBuffersSWAP( window, flags );
-    }
-    else
-    {
-        crPackSwapBuffers( window, flags );
-    }
+    crPackSwapBuffers( window, flags );
     packspuFlush( (void *) thread );
 
@@ -73,12 +48,5 @@
              */
             thread->writeback = 1;
-            if (pack_spu.swap)
-            {
-                crPackWritebackSWAP( (GLint *) &thread->writeback );
-            }
-            else
-            {
-                crPackWriteback( (GLint *) &thread->writeback );
-            }
+            crPackWriteback( (GLint *) &thread->writeback );
             break;
         case 1:
@@ -92,11 +60,5 @@
     /* want to emit a parameter here */
     if (pack_spu.emit_GATHER_POST_SWAPBUFFERS)
-    {
-        if (pack_spu.swap)
-            crPackChromiumParameteriCRSWAP(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
-        else
-            crPackChromiumParameteriCR(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
-    }
+        crPackChromiumParameteriCR(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
 }
 
-#endif
Index: trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c	(revision 78190)
@@ -44,27 +44,12 @@
     GET_THREAD(thread);
     int writeback = 1;
-    unsigned int i;
     if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
     {
         crError( "packspu_GenTextures doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     }
-    if (pack_spu.swap)
-    {
-        crPackGenTexturesSWAP( n, textures, &writeback );
-    }
-    else
-    {
-        crPackGenTextures( n, textures, &writeback );
-    }
+
+    crPackGenTextures( n, textures, &writeback );
     packspuFlush( (void *) thread );
     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
-    if (pack_spu.swap)
-    {
-        for (i = 0 ; i < (unsigned int) n ; i++)
-        {
-            textures[i] = SWAP32(textures[i]);
-        }
-    }
-
     crStateRegTextures(n, textures);
 }
Index: trunk/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu_init.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu_init.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu_init.c	(revision 78190)
@@ -44,12 +44,8 @@
 }
 
-static SPUOptions passthroughSPUOptions[] = {
-   { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
-};
-
 
 int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
 	     SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
-	     SPUOptionsPtr *options, int *flags )
+	     int *flags )
 {
 	*name = "passthrough";
@@ -58,5 +54,4 @@
 	*self = passthroughSPUSelfDispatch;
 	*cleanup = passthroughSPUCleanup;
-	*options = passthroughSPUOptions;
 	*flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
 
Index: trunk/src/VBox/Additions/common/crOpenGL/wgl.c
===================================================================
--- trunk/src/VBox/Additions/common/crOpenGL/wgl.c	(revision 78188)
+++ trunk/src/VBox/Additions/common/crOpenGL/wgl.c	(revision 78190)
@@ -7,5 +7,4 @@
 #include "cr_error.h"
 #include "cr_spu.h"
-#include "cr_environment.h"
 #include "cr_mem.h"
 #include "stub.h"
@@ -19,4 +18,5 @@
 
 #include <iprt/cdefs.h>
+#include <iprt/env.h>
 
 /* Currently host part will misbehave re-creating context with proper visual bits
@@ -83,5 +83,5 @@
      * There are subtle differences in the use of these calls.
      */
-    crSetenv("CR_WGL_DO_NOT_USE_GDI", "yes");
+    RTEnvSet("CR_WGL_DO_NOT_USE_GDI", "yes");
 
     if ( pfd->nSize != sizeof(*pfd) || pfd->nVersion != 1 ) {
