VirtualBox

Changeset 78190 in vbox for trunk


Ignore:
Timestamp:
Apr 18, 2019 12:07:07 AM (6 years ago)
Author:
vboxsync
Message:

Merge first stage of the Chromium cleanup from the branch:

  • r129818 (Remove VBOX_WITH_CR_DISPLAY_LISTS and accompanying code as it was disabled since r108676 and was never brought back (see ​bugref:3456 and ​bugref:8485))
  • r129819 (HostServices/SharedOpenGL: Remove unused main entry point from upstream server process based implementation)
  • r129820 (HostServices/SharedOpenGL: Started eliminating all backends other than HGCM. They are not used and probably wouldn't work anymore anyway)
  • r129821 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crTimer* API as it is not used anywhere)
  • r129822 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill most from cr_process.h apart from two used methods)
  • r129823 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crList* API as it is unused)
  • r129824 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crHullInteriorBox API as it is unused)
  • r129825 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crWarpPoint API as it is unused)
  • r129826 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill CrSa* API as it is unused and not even compiled in)
  • r129827 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill cr_bbox.h as it is unused)
  • r129828 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove a few crParseUrl() two uses)
  • r129829 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove last crParseURL() use)
  • r129830 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove crParseURL())
  • r129831 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove VBOX_WITH_COCOA_QT and related code when not set as it is the default for years now and we don't support anything else anymore)
  • r129832 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_logo.h)
  • r129833 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused crut_api.h and crut_clientapi.h)
  • r129834 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_dmx.h)
  • r129835 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_perf.h)
  • r129836 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove cr_rand.h and friends as it is not actively used anywhere)
  • r129837 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of all the swapped versions in the packer SPU, we never change endianess from guest to host and don't need it)
  • r129838 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129839 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129840 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused pack_pica.c)
  • r129841 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129842 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_endianess.h and friends)
  • r129843 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused lowercase.py)
  • r129844 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_calllists.h and friends)
  • r129845 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of completely unused idpool.c, not even compiled in)
  • r129846 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_debugopcodes.h and friends)
  • r129847 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the cr_mem.h API inline and get rid of the implementation in the util library)
  • r129848 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of SPUOptions and related code as it is of no use for us)
  • r129849 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_environment.h and friends and convert usage to RTEnv* APIs)
  • r129850 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused renderspu_agl.c)
  • r129851 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused code in cr_htable.h)
  • r129853 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Introduce a state paremeter for the unpacker workers instead of reyling on global variables, work in progress)
  • r129854 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Let the caller of crUnpack set up the initial state. This allows to get rid of the global return_ptr and writeback_ptr as they get supplied in the unpacker state by the server)
  • r129855 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the cr_lastDispatch and cr_unpackDispatch as they are of no use now)
  • r129856 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the global cr_unpackData and cr_unpackDataEnd symbols by indtroducing another hack to make it possible for certail server dispatch callbacks to access the data buffer)
  • r129857 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: build fix for release builds)
  • r129858 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the pointer to the unpacker state non const (is required for the access verification))
  • r129859 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: First iteration of the buffer size validation to prevent out of bound read access + added todos for places where additional checks are needed)
  • r129860 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129861 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129871 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129872 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Stop as soon as the unpacker encountered an error)
  • r129876 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129880 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129882 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Fixed some offsets in unpack_texture.c, 3DMark03 renders correctly again)
  • r130013 (HostServices/SharedOpenGL: Convert files to C++ so we can use C99 featuers on Windows with cl.exe)
  • r130014 (HostServices/SharedOpenGL,GuestHost/OpenGL: WIndows build fixes)
  • r130015 (HostServices/SharedOpenGL,GuestHost/OpenGL: More Windows build fixes)
  • r130036 (Config.kmk: Fix linker error on Windows by temporarily disabling the use of VBoxGuestR3DllMinW2K)
  • r130094 (src/VBox/GuestHost/OpenGL: Revert inlining the allocation/free functions in R3 completely as it doesn't work on Windows if memory is allocated and freed across different DLLs which don't share a common CRT, causes crashes in RtlValidtaeHeap())
  • r130095 (src/VBox/GuestHost/OpenGL,src/VBox/Additions/common/crOpenGL/pack: Don't use floating point specifiers in packspu_GetString() to avoid R6002 errors (couldn't fully understand why they occur suddenly after the rework but this gets rid of it))
Location:
trunk
Files:
48 added
91 deleted
93 edited
8 moved

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:mergeinfo
      •  

        old new  
        99/branches/VBox-5.1:112367,115992,116543,116550,116568,116573
        1010/branches/VBox-5.2:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124260,124263,124271,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812
         11/branches/aeichner/vbox-chromium-cleanup:129816,129818-129851,129853-129861,129871-129872,129876,129880,129882,130013-130015,130036,130094-130095
        1112/branches/andy/draganddrop:90781-91268
        1213/branches/andy/guestctrl20:78916,78930
  • trunk/Config.kmk

    r78027 r78190  
    25032503 ifdef VBOX_WITH_WDDM
    25042504  VBOX_WITH_CRHGSMI = 1
    2505  endif
    2506 
    2507  if1of ($(KBUILD_TARGET),darwin)
    2508   #VBOX_WITH_CR_DISPLAY_LISTS = 1
    25092505 endif
    25102506
     
    73377333TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux       = Linux=1 _GNU_SOURCE
    73387334TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.solaris     = SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
    7339 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin      = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE VBOX_WITH_COCOA_QT
     7335TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin      = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
    73407336TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.freebsd     = FreeBSD=1 _GNU_SOURCE
    73417337TEMPLATE_VBOXCROGLR3HOSTDLL_INCS             = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)
     
    73847380#
    73857381TEMPLATE_VBOXCROGLR3GUESTDLL                  = VBox OpenGL Guest DLLs
    7386 if "$(KBUILD_TARGET)" == "win" || defined(VBOX_WITH_MASOCHISTIC_WARNINGS) || defined(VBOX_WITH_NO_GCC_WARNING_POLICY) ## @todo use VBoxGuestR3Dll everywhere
    7387 TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS          = VBoxGuestR3DllMinW2K
    7388 else
     7382# @todo Temporarily disabled, causes linker errors on Windows because VBoxOGLcrutil and VBoxOGLspupacker both drag in RuntimeGuestR3Shared.lib
     7383#if "$(KBUILD_TARGET)" == "win" || defined(VBOX_WITH_MASOCHISTIC_WARNINGS) || defined(VBOX_WITH_NO_GCC_WARNING_POLICY) ## @todo use VBoxGuestR3Dll everywhere
     7384#TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS          = VBoxGuestR3DllMinW2K
     7385#else
    73897386TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS          = VBOXGUESTR3NPDLL
    7390 endif
     7387#endif
    73917388TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS             = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS) CHROMIUM_THREADSAFE VBOX_WITH_HGCM
    73927389TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win         = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.win) WINDOWS=1
    73937390TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux       = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.linux) Linux=1 _GNU_SOURCE
    73947391TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.solaris     = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.solaris) SunOS=1 _GNU_SOURCE #GLEXT_64_TYPES_DEFINED
    7395 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin      = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.darwin) DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE VBOX_WITH_COCOA_QT
     7392TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin      = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.darwin) DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE
    73967393TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.freebsd     = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.freebsd) FreeBSD=1 _GNU_SOURCE
    73977394TEMPLATE_VBOXCROGLR3GUESTDLL_INCS             = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES) $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_INCS)
  • trunk/src/VBox

    • Property svn:mergeinfo
      •  

        old new  
        99/branches/VBox-5.1/src/VBox:112367,116543,116550,116568,116573
        1010/branches/VBox-5.2/src/VBox:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124263,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812,127158-127159,127162-127167,127180
         11/branches/aeichner/vbox-chromium-cleanup/src/VBox:129818-129851,129853-129861,129871-129872,129876,129880,129882,130013-130015,130094-130095
        1112/branches/andy/draganddrop/src/VBox:90781-91268
        1213/branches/andy/guestctrl20/src/VBox:78916,78930
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk

    r76884 r78190  
    119119        wddm/VBoxMPCm.cpp \
    120120        wddm/VBoxMPCr.cpp \
     121        wddm/VBoxMPSa.cpp \
    121122        wddm/VBoxMPMisc.cpp \
    122123        wddm/VBoxWddm.rc \
     
    132133        $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
    133134
    134  VBoxWddm_SOURCES         += \
    135         $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/util/sortarray.cpp
    136 
    137135 if defined(VBOX_WITH_CROGL)
    138136   VBoxWddm_SOURCES       += \
     
    142140        $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c \
    143141        $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer/pack_misc.c \
    144         $(VBOX_PATH_CROGL_GENFILES)/pack_bounds_swap.c \
    145142        $(VBOX_PATH_CROGL_GENFILES)/packer.c \
    146143        wddm/VBoxMPCrUtil.cpp
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h

    r76563 r78190  
    3636#include "VBoxMPVbva.h"
    3737#include "VBoxMPCr.h"
     38#include "VBoxMPSa.h"
    3839#include "VBoxMPVModes.h"
    3940
     
    4142#include <cr_vreg.h>
    4243#endif
    43 
    44 #include <cr_sortarray.h>
    4544
    4645#if 0
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVModes.h

    r76563 r78190  
    2424//#include "../../common/VBoxVideoTools.h"
    2525
    26 #include <cr_sortarray.h>
    27 
     26#include "VBoxMPSa.h"
    2827
    2928#define _CR_TYPECAST(_Type, _pVal) ((_Type*)((void*)(_pVal)))
  • trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_config.c

    r69310 r78190  
    1515}
    1616
    17 /* No SPU options yet.
    18  */
    19 SPUOptions arraySPUOptions[] = {
    20    { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    21 };
    22 
    23 
    2417void arrayspuSetVBoxConfiguration( void )
    2518{
  • trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_init.c

    r69310 r78190  
    1111
    1212extern SPUNamedFunctionTable _cr_array_table[];
    13 
    14 extern SPUOptions arraySPUOptions[];
    1513
    1614static SPUFunctions array_functions = {
     
    7371int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    7472         SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    75          SPUOptionsPtr *options, int *flags )
     73         int *flags )
    7674{
    7775    *name = "array";
     
    8078    *self = arraySPUSelfDispatch;
    8179    *cleanup = arraySPUCleanup;
    82     *options = arraySPUOptions;
    8380    *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
    8481
  • trunk/src/VBox/Additions/common/crOpenGL/context.c

    r69310 r78190  
    2929#include "cr_mem.h"
    3030#include "cr_string.h"
    31 #include "cr_environment.h"
    3231#include "stub.h"
    3332
  • trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h

    r76563 r78190  
    1818
    1919#include "cr_spu.h"
    20 #include "cr_timer.h"
    2120#include "cr_glstate.h"
    2221
     
    5251extern SPUNamedFunctionTable _cr_feedback_table[];
    5352
    54 extern SPUOptions feedbackSPUOptions[];
    55 
    5653extern void feedbackspuGatherConfiguration( void );
    5754
  • trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c

    r63206 r78190  
    66
    77#include "cr_string.h"
    8 #include "cr_environment.h"
    98#include "cr_error.h"
    109#include "cr_mem.h"
     
    2120}
    2221
    23 static void set_default_viewport( void *foo, const char *response )
    24 {
    25    (void) foo;
    26    sscanf( response, "%d", &(feedback_spu.default_viewport) );
    27 }
    28 
    29 /* option, type, nr, default, min, max, title, callback
    30  */
    31 SPUOptions feedbackSPUOptions[] = {
    32 
    33    { "default_viewport", CR_BOOL, 1, "0", "0", "1",
    34      "Return default viewport parameters", (SPUOptionCB)set_default_viewport },
    35 
    36    { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    37 
    38 };
    39 
    4022
    4123void feedbackspuGatherConfiguration( void )
  • trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c

    r69310 r78190  
    66
    77#include "cr_spu.h"
    8 #include "cr_environment.h"
    98#include "cr_string.h"
    109#include "cr_error.h"
     
    7372int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    7473             SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    75              SPUOptionsPtr *options, int *flags )
     74             int *flags )
    7675{
    7776        *name = "feedback";
     
    8079        *self = feedbackSPUSelfDispatch;
    8180        *cleanup = feedbackSPUCleanup;
    82         *options = feedbackSPUOptions;
    8381        *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
    8482
  • trunk/src/VBox/Additions/common/crOpenGL/icd_drv.c

    r76553 r78190  
    2828
    2929#include <iprt/win/windows.h>
     30
     31#include <stdio.h> /*sprintf*/
    3032
    3133/// @todo consider
  • trunk/src/VBox/Additions/common/crOpenGL/load.c

    r76474 r78190  
    1111#include "cr_string.h"
    1212#include "cr_net.h"
    13 #include "cr_environment.h"
    1413#include "cr_process.h"
    15 #include "cr_rand.h"
    1614#include "cr_netserver.h"
    1715#include "stub.h"
     
    1917#include <string.h>
    2018#include <signal.h>
     19#include <stdio.h> /*swprintf*/
    2120#include <iprt/initterm.h>
    2221#include <iprt/thread.h>
    2322#include <iprt/errcore.h>
    2423#include <iprt/asm.h>
     24#include <iprt/env.h>
    2525#ifndef WINDOWS
    2626# include <sys/types.h>
     
    601601
    602602
    603 #if 0 /* unused */
    604 
    605 /**
    606  * Return a free port number for the mothership to use, or -1 if we
    607  * can't find one.
    608  */
    609 static int
    610 GenerateMothershipPort(void)
    611 {
    612     const int MAX_PORT = 10100;
    613     unsigned short port;
    614 
    615     /* generate initial port number randomly */
    616     crRandAutoSeed();
    617     port = (unsigned short) crRandInt(10001, MAX_PORT);
    618 
    619 #ifdef WINDOWS
    620     /* XXX should implement a free port check here */
    621     return port;
    622 #else
    623     /*
    624      * See if this port number really is free, try another if needed.
    625      */
    626     {
    627         struct sockaddr_in servaddr;
    628         int so_reuseaddr = 1;
    629         int sock, k;
    630 
    631         /* create socket */
    632         sock = socket(AF_INET, SOCK_STREAM, 0);
    633         CRASSERT(sock > 2);
    634 
    635         /* deallocate socket/port when we exit */
    636         k = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
    637                                      (char *) &so_reuseaddr, sizeof(so_reuseaddr));
    638         CRASSERT(k == 0);
    639 
    640         /* initialize the servaddr struct */
    641         crMemset(&servaddr, 0, sizeof(servaddr) );
    642         servaddr.sin_family = AF_INET;
    643         servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
    644 
    645         while (port < MAX_PORT) {
    646             /* Bind to the given port number, return -1 if we fail */
    647             servaddr.sin_port = htons((unsigned short) port);
    648             k = bind(sock, (struct sockaddr *) &servaddr, sizeof(servaddr));
    649             if (k) {
    650                 /* failed to create port. try next one. */
    651                 port++;
    652             }
    653             else {
    654                 /* free the socket/port now so mothership can make it */
    655                 close(sock);
    656                 return port;
    657             }
    658         }
    659     }
    660 #endif /* WINDOWS */
    661     return -1;
    662 }
    663 
    664 
    665 /**
    666  * Try to determine which mothership configuration to use for this program.
    667  */
    668 static char **
    669 LookupMothershipConfig(const char *procName)
    670 {
    671     const int procNameLen = crStrlen(procName);
    672     FILE *f;
    673     const char *home;
    674     char configPath[1000];
    675 
    676     /* first, check if the CR_CONFIG env var is set */
    677     {
    678         const char *conf = crGetenv("CR_CONFIG");
    679         if (conf && crStrlen(conf) > 0)
    680             return crStrSplit(conf, " ");
    681     }
    682 
    683     /* second, look up config name from config file */
    684     home = crGetenv("HOME");
    685     if (home)
    686         sprintf(configPath, "%s/%s", home, CONFIG_LOOKUP_FILE);
    687     else
    688         crStrcpy(configPath, CONFIG_LOOKUP_FILE); /* from current dir */
    689     /* Check if the CR_CONFIG_PATH env var is set. */
    690     {
    691         const char *conf = crGetenv("CR_CONFIG_PATH");
    692         if (conf)
    693             crStrcpy(configPath, conf); /* from env var */
    694     }
    695 
    696     f = fopen(configPath, "r");
    697     if (!f) {
    698         return NULL;
    699     }
    700 
    701     while (!feof(f)) {
    702         char line[1000];
    703         char **args;
    704         fgets(line, 999, f);
    705         line[crStrlen(line) - 1] = 0; /* remove trailing newline */
    706         if (crStrncmp(line, procName, procNameLen) == 0 &&
    707             (line[procNameLen] == ' ' || line[procNameLen] == '\t'))
    708         {
    709             crWarning("Using Chromium configuration for %s from %s",
    710                                 procName, configPath);
    711             args = crStrSplit(line + procNameLen + 1, " ");
    712             return args;
    713         }
    714     }
    715     fclose(f);
    716     return NULL;
    717 }
    718 
    719 
    720 static int Mothership_Awake = 0;
    721 
    722 
    723 /**
    724  * Signal handler to determine when mothership is ready.
    725  */
    726 static void
    727 MothershipPhoneHome(int signo)
    728 {
    729     crDebug("Got signal %d: mothership is awake!", signo);
    730     Mothership_Awake = 1;
    731 }
    732 
    733 #endif /* 0 */
    734 
    735603static void stubSetDefaultConfigurationOptions(void)
    736604{
    737     unsigned char key[16]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    738 
    739605    stub.appDrawCursor = 0;
    740606    stub.minChromiumWindowWidth = 0;
     
    752618    stub.matchChromiumWindowCount = 0;
    753619    stub.spu_dir = NULL;
    754     crNetSetRank(0);
    755     crNetSetContextRange(32, 35);
    756     crNetSetNodeRange("iam0", "iamvis20");
    757     crNetSetKey(key,sizeof(key));
    758620    stub.force_pbuffers = 0;
    759621
     
    963825
    964826    /** @todo check if it'd be of any use on other than guests, no use for windows */
    965     app_id = crGetenv( "CR_APPLICATION_ID_NUMBER" );
     827    app_id = RTEnvGet( "CR_APPLICATION_ID_NUMBER" );
    966828
    967829    crNetInit( NULL, NULL );
     
    13471209
    13481210#ifdef VDBG_VEHANDLER
    1349         env = crGetenv("CR_DBG_VEH_ENABLE");
     1211        env = RTEnvGet("CR_DBG_VEH_ENABLE");
    13501212        g_VBoxVehEnable = crStrParseI32(env,
    13511213# ifdef DEBUG_misha
     
    13621224            size_t cChars;
    13631225
    1364             env = crGetenv("CR_DBG_VEH_FLAGS");
     1226            env = RTEnvGet("CR_DBG_VEH_FLAGS");
    13651227            g_VBoxVehFlags = crStrParseI32(env,
    13661228                    0
     
    13721234                    );
    13731235
    1374             env = crGetenv("CR_DBG_VEH_DUMP_DIR");
     1236            env = RTEnvGet("CR_DBG_VEH_DUMP_DIR");
    13751237            if (!env)
    13761238                env = VBOXMD_DUMP_DIR_DEFAULT;
     
    14101272            g_aszwVBoxMdFilePrefix[g_cVBoxMdFilePrefixLen] = L'\0';
    14111273
    1412             env = crGetenv("CR_DBG_VEH_DUMP_TYPE");
     1274            env = RTEnvGet("CR_DBG_VEH_DUMP_TYPE");
    14131275
    14141276            g_enmVBoxMdDumpType = crStrParseI32(env,
  • trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py

    r69310 r78190  
    5353        print('\t__fillin(%3d, "%s", (SPUGenericFunction) packspu_%s);' % (index, func_name, func_name ))
    5454    else:
    55         print('\t__fillin(%3d, "%s", (SPUGenericFunction) (pack_spu.swap ? crPack%sSWAP : crPack%s));' % (index, func_name, func_name, func_name ))
     55        print('\t__fillin(%3d, "%s", (SPUGenericFunction) (crPack%s));' % (index, func_name, func_name ))
    5656print('\t__fillin(%3d, NULL, NULL);' % num_funcs)
    5757print('}')
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h

    r76563 r78190  
    8282typedef struct {
    8383    int id;
    84     int swap;
    8584
    8685    /* config options */
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py

    r69310 r78190  
    4848#endif
    4949
    50     if (pack_spu.swap)
    51     {
    52         crPackBeginSWAP( mode );
    53     }
    54     else
    55     {
    56         crPackBegin( mode );
    57     }
    58 
     50    crPackBegin( mode );
    5951    if ( thread->netServer.conn->Barf ) {
    6052        thread->BeginEndMode = mode;
     
    9991    }
    10092
    101     if (pack_spu.swap)
    102     {
    103         crPackEndSWAP();
    104     }
    105     else
    106     {
    107         crPackEnd();
    108     }
     93    crPackEnd();
    10994}
    11095
     
    166151    print('void PACKSPU_APIENTRY packspu_%s(%s)' % ( func_name, apiutil.MakeDeclarationString(params) ))
    167152    print('{')
    168     print('\tif (pack_spu.swap)')
    169     print('\t{')
    170     print('\t\tcrPack%sSWAP(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
    171     print('\t}')
    172     print('\telse')
    173     print('\t{')
    174     print('\t\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
    175     print('\t}')
     153    print('\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
    176154    print('\tRunState();')
    177155    print('}')
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c

    r69310 r78190  
    140140        crError( "packspu_GenBuffersARB doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    141141    }
    142     if (pack_spu.swap)
    143     {
    144         crPackGenBuffersARBSWAP( n, buffer, &writeback );
    145     }
    146     else
    147     {
    148         crPackGenBuffersARB( n, buffer, &writeback );
    149     }
     142
     143    crPackGenBuffersARB( n, buffer, &writeback );
    150144    packspuFlush( (void *) thread );
    151145    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c

    r69310 r78190  
    1515#if CR_ARB_vertex_buffer_object
    1616    GET_CONTEXT(ctx);
    17     if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    18         if (pack_spu.swap)
    19             crPackFogCoordPointerEXTSWAP( type, stride, pointer );
    20         else
    21             crPackFogCoordPointerEXT( type, stride, pointer );
     17   if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
     18        crPackFogCoordPointerEXT( type, stride, pointer );
    2219    }
    2320#endif
     
    3027    GET_CONTEXT(ctx);
    3128    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    32         if (pack_spu.swap)
    33             crPackColorPointerSWAP( size, type, stride, pointer );
    34         else
    35             crPackColorPointer( size, type, stride, pointer );
     29        crPackColorPointer( size, type, stride, pointer );
    3630    }
    3731#endif
     
    4438    GET_CONTEXT(ctx);
    4539    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    46         if (pack_spu.swap)
    47             crPackSecondaryColorPointerEXTSWAP( size, type, stride, pointer );
    48         else
    49             crPackSecondaryColorPointerEXT( size, type, stride, pointer );
     40        crPackSecondaryColorPointerEXT( size, type, stride, pointer );
    5041    }
    5142#endif
     
    5950    CRASSERT(ctx->clientState->extensions.ARB_vertex_buffer_object);
    6051    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    61         if (pack_spu.swap)
    62             crPackVertexPointerSWAP( size, type, stride, pointer );
    63         else
    64             crPackVertexPointer( size, type, stride, pointer );
     52        crPackVertexPointer( size, type, stride, pointer );
    6553    }
    6654#endif
     
    7361    GET_CONTEXT(ctx);
    7462    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    75         if (pack_spu.swap)
    76             crPackTexCoordPointerSWAP( size, type, stride, pointer );
    77         else
    78             crPackTexCoordPointer( size, type, stride, pointer );
     63        crPackTexCoordPointer( size, type, stride, pointer );
    7964    }
    8065#endif
     
    8772    GET_CONTEXT(ctx);
    8873    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    89         if (pack_spu.swap)
    90             crPackNormalPointerSWAP( type, stride, pointer );
    91         else
    92             crPackNormalPointer( type, stride, pointer );
     74        crPackNormalPointer( type, stride, pointer );
    9375    }
    9476#endif
     
    10183    GET_CONTEXT(ctx);
    10284    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    103         if (pack_spu.swap)
    104             crPackEdgeFlagPointerSWAP( stride, pointer );
    105         else
    106             crPackEdgeFlagPointer( stride, pointer );
     85        crPackEdgeFlagPointer( stride, pointer );
    10786    }
    10887#endif
     
    11594    GET_CONTEXT(ctx);
    11695    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    117         if (pack_spu.swap)
    118             crPackVertexAttribPointerARBSWAP( index, size, type, normalized, stride, pointer );
    119         else
    120             crPackVertexAttribPointerARB( index, size, type, normalized, stride, pointer );
     96        crPackVertexAttribPointerARB( index, size, type, normalized, stride, pointer );
    12197    }
    12298#endif
     
    129105    GET_CONTEXT(ctx);
    130106    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    131         if (pack_spu.swap)
    132             crPackVertexAttribPointerNVSWAP( index, size, type, stride, pointer );
    133         else
    134             crPackVertexAttribPointerNV( index, size, type, stride, pointer );
     107        crPackVertexAttribPointerNV( index, size, type, stride, pointer );
    135108    }
    136109#endif
     
    143116    GET_CONTEXT(ctx);
    144117    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    145         if (pack_spu.swap)
    146             crPackIndexPointerSWAP( type, stride, pointer );
    147         else
    148             crPackIndexPointer( type, stride, pointer );
     118        crPackIndexPointer( type, stride, pointer );
    149119    }
    150120#endif
     
    162132    GET_CONTEXT(ctx);
    163133    if (ctx->clientState->extensions.ARB_vertex_buffer_object) {
    164         if (pack_spu.swap)
    165             crPackInterleavedArraysSWAP( format, stride, pointer );
    166         else
    167             crPackInterleavedArrays( format, stride, pointer );
     134        crPackInterleavedArrays( format, stride, pointer );
    168135    }
    169136#endif
     
    380347
    381348        /* Send the DrawArrays command over the wire */
    382         if (pack_spu.swap)
    383             crPackArrayElementSWAP( index );
    384         else
    385             crPackArrayElement( index );
     349        crPackArrayElement( index );
    386350
    387351        if (cZvaValues)
     
    400364#endif
    401365
    402         if (pack_spu.swap)
    403             crPackExpandArrayElementSWAP( index, clientState, cZvaValues ? aAttrib : NULL );
    404         else
    405             crPackExpandArrayElement( index, clientState, cZvaValues ? aAttrib : NULL );
     366        crPackExpandArrayElement( index, clientState, cZvaValues ? aAttrib : NULL );
    406367
    407368#ifdef CR_FORCE_ZVA_SERVER_ARRAY
     
    529490
    530491        /* Send the DrawArrays command over the wire */
    531         if (pack_spu.swap)
    532             crPackDrawElementsSWAP( mode, count, type, indices );
    533         else
    534             crPackDrawElements( mode, count, type, indices );
     492        crPackDrawElements( mode, count, type, indices );
    535493
    536494        if (cZvaValues)
     
    549507#endif
    550508
    551         if (pack_spu.swap)
    552             crPackExpandDrawElementsSWAP( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
    553         else
    554         {
    555             //packspu_Begin(mode);
    556             crPackExpandDrawElements( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
    557             //packspu_End();
    558         }
     509        //packspu_Begin(mode);
     510        crPackExpandDrawElements( mode, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
     511        //packspu_End();
    559512
    560513#ifdef CR_FORCE_ZVA_SERVER_ARRAY
     
    615568
    616569        /* Send the DrawRangeElements command over the wire */
    617         if (pack_spu.swap)
    618             crPackDrawRangeElementsSWAP( mode, start, end, count, type, indices );
    619         else
    620             crPackDrawRangeElements( mode, start, end, count, type, indices );
     570        crPackDrawRangeElements( mode, start, end, count, type, indices );
    621571
    622572        if (cZvaValues)
     
    634584#endif
    635585
    636         if (pack_spu.swap)
    637             crPackExpandDrawRangeElementsSWAP( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
    638         else
    639         {
    640             crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
    641         }
     586        crPackExpandDrawRangeElements( mode, start, end, count, type, indices, clientState, cZvaValues ? aAttrib : NULL );
    642587
    643588#ifdef CR_FORCE_ZVA_SERVER_ARRAY
     
    709654
    710655        /* Send the DrawArrays command over the wire */
    711         if (pack_spu.swap)
    712             crPackDrawArraysSWAP( mode, first, count );
    713         else
    714             crPackDrawArrays( mode, first, count );
     656        crPackDrawArrays( mode, first, count );
    715657
    716658        if (cZvaValues)
     
    729671#endif
    730672
    731         if (pack_spu.swap)
    732             crPackExpandDrawArraysSWAP( mode, first, count, clientState, cZvaValues ? aAttrib : NULL );
    733         else
    734             crPackExpandDrawArrays( mode, first, count, clientState, cZvaValues ? aAttrib : NULL );
     673        crPackExpandDrawArrays( mode, first, count, clientState, cZvaValues ? aAttrib : NULL );
    735674
    736675#ifdef CR_FORCE_ZVA_SERVER_ARRAY
     
    809748    {
    810749        crStateEnable(cap);
    811 
    812         if (pack_spu.swap)
    813             crPackEnableSWAP(cap);
    814         else
    815             crPackEnable(cap);
     750        crPackEnable(cap);
    816751    }
    817752    else
     
    834769    {
    835770        crStateDisable(cap);
    836 
    837         if (pack_spu.swap)
    838             crPackDisableSWAP(cap);
    839         else
    840             crPackDisable(cap);
     771        crPackDisable(cap);
    841772    }
    842773    else
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_config.c

    r69310 r78190  
    2323
    2424
    25 static void set_emit( void *foo, const char *response )
    26 {
    27     RT_NOREF(foo);
    28     sscanf( response, "%d", &(pack_spu.emit_GATHER_POST_SWAPBUFFERS) );
    29 }
    30 
    31 static void set_swapbuffer_sync( void *foo, const char *response )
    32 {
    33     RT_NOREF(foo);
    34     sscanf( response, "%d", &(pack_spu.swapbuffer_sync) );
    35 }
    36 
    37 
    38 
    39 /* No SPU options yet. Well.. not really..
    40  */
    41 SPUOptions packSPUOptions[] = {
    42     { "emit_GATHER_POST_SWAPBUFFERS", CR_BOOL, 1, "0", NULL, NULL,
    43       "Emit a parameter after SwapBuffers", (SPUOptionCB)set_emit },
    44 
    45     { "swapbuffer_sync", CR_BOOL, 1, "1", NULL, NULL,
    46         "Sync on SwapBuffers", (SPUOptionCB) set_swapbuffer_sync },
    47 
    48     { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    49 };
    50 
    51 
    5225void packspuSetVBoxConfiguration( const SPU *child_spu )
    5326{
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c

    r69310 r78190  
    6969    /* packer setup */
    7070    CRASSERT(thread->packer == NULL);
    71     thread->packer = crPackNewContext( pack_spu.swap );
     71    thread->packer = crPackNewContext();
    7272    CRASSERT(thread->packer);
    7373    crPackInitBuffer( &(thread->buffer), crNetAlloc(thread->netServer.conn),
     
    357357
    358358    /* Pack the command */
    359     if (pack_spu.swap)
    360         crPackCreateContextSWAP( dpyName, visual, shareCtx, &serverCtx, &writeback );
    361     else
    362         crPackCreateContext( dpyName, visual, shareCtx, &serverCtx, &writeback );
     359    crPackCreateContext( dpyName, visual, shareCtx, &serverCtx, &writeback );
    363360
    364361    /* Flush buffer and get return value */
     
    385382        CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    386383
    387         if (pack_spu.swap) {
    388             serverCtx = (GLint) SWAP32(serverCtx);
    389         }
    390384        if (serverCtx < 0) {
    391385#ifdef CHROMIUM_THREADSAFE
     
    472466        }
    473467
    474         if (pack_spu.swap)
    475             crPackDestroyContextSWAP( context->serverCtx );
    476         else
    477             crPackDestroyContext( context->serverCtx );
    478 
     468        crPackDestroyContext( context->serverCtx );
    479469        crStateDestroyContext( context->clientState );
    480470
     
    600590    }
    601591
    602     if (pack_spu.swap)
    603         crPackMakeCurrentSWAP( window, nativeWindow, serverCtx );
    604     else
    605         crPackMakeCurrent( window, nativeWindow, serverCtx );
    606 
     592    crPackMakeCurrent( window, nativeWindow, serverCtx );
    607593    if (serverCtx)
    608594    {
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py

    r69310 r78190  
    3131    print('{')
    3232    print('\tGET_THREAD(thread);')
    33     print('\tif (pack_spu.swap)')
    34     print('\t{')
    35     print('\t\tcrPack%sSWAP(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
    36     print('\t}')
    37     print('\telse')
    38     print('\t{')
    39     print('\t\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
    40     print('\t}')
     33    print('\tcrPack%s(%s);' % ( func_name, apiutil.MakeCallString( params ) ))
    4134    print('\tpackspuFlush( (void *) thread );')
    4235    print('}\n')
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c

    r76553 r78190  
    107107        crError( "packspu_GenFramebuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    108108    }
    109     if (pack_spu.swap)
    110     {
    111         crPackGenFramebuffersEXTSWAP( n, framebuffers, &writeback );
    112     }
    113     else
    114     {
    115         crPackGenFramebuffersEXT( n, framebuffers, &writeback );
    116     }
     109
     110    crPackGenFramebuffersEXT( n, framebuffers, &writeback );
    117111    packspuFlush( (void *) thread );
    118112    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
     
    129123        crError( "packspu_GenRenderbuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    130124    }
    131     if (pack_spu.swap)
    132     {
    133         crPackGenRenderbuffersEXTSWAP( n, renderbuffers, &writeback );
    134     }
    135     else
    136     {
    137         crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
    138     }
     125
     126    crPackGenRenderbuffersEXT( n, renderbuffers, &writeback );
    139127    packspuFlush( (void *) thread );
    140128    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py

    r69310 r78190  
    4949""")
    5050
     51print('#ifdef DEBUG');
    5152from get_sizes import *
    52 
    53 easy_swaps = {
    54     'GenTextures': '(unsigned int) n',
    55     'GetClipPlane': '4',
    56     'GetPolygonStipple': '0'
    57 }
     53print('#endif');
    5854
    5955simple_funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ]
    60 simple_swaps = [ 'SWAP32', 'SWAPFLOAT', 'SWAPDOUBLE', '(GLboolean) SWAP32' ]
    61 
    6256vertattr_get_funcs = [ 'GetVertexAttribdv' 'GetVertexAttribfv' 'GetVertexAttribiv' ]
    63 
    64 hard_funcs = {
    65     'GetLightfv': 'SWAPFLOAT',
    66     'GetLightiv': 'SWAP32',
    67     'GetMaterialfv': 'SWAPFLOAT',
    68     'GetMaterialiv': 'SWAP32',
    69     'GetTexEnvfv': 'SWAPFLOAT',
    70     'GetTexEnviv': 'SWAP32',
    71     'GetTexGendv': 'SWAPDOUBLE',
    72     'GetTexGenfv': 'SWAPFLOAT',
    73     'GetTexGeniv': 'SWAP32',
    74     'GetTexLevelParameterfv': 'SWAPFLOAT',
    75     'GetTexLevelParameteriv': 'SWAP32',
    76     'GetTexParameterfv': 'SWAPFLOAT',
    77     'GetTexParameteriv': 'SWAP32' }
    7857
    7958keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
     
    9372            print('\t%s return_val = (%s) 0;' % (return_type, return_type))
    9473            params.append( ("&return_val", "foo", 0) )
    95         if (func_name in easy_swaps and easy_swaps[func_name] != '0') or func_name in simple_funcs or func_name in hard_funcs:
    96             print('\tunsigned int i;')
    9774        print('\tif (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))')
    9875        print('\t{')
     
    138115               )
    139116            {
     117                unsigned int i = 0;
    140118                %s localparams;
    141119                localparams = (%s) crAlloc(__numValues(pname) * sizeof(*localparams));
     
    193171
    194172        params.append( ("&writeback", "foo", 0) )
    195         print('\tif (pack_spu.swap)')
    196         print('\t{')
    197         print('\t\tcrPack%sSWAP(%s);' % (func_name, apiutil.MakeCallString( params ) ))
    198         print('\t}')
    199         print('\telse')
    200         print('\t{')
    201         print('\t\tcrPack%s(%s);' % (func_name, apiutil.MakeCallString( params ) ))
    202         print('\t}')
     173        print('\tcrPack%s(%s);' % (func_name, apiutil.MakeCallString( params ) ))
    203174        print('\tpackspuFlush( (void *) thread );')
    204175        print('\tCRPACKSPU_WRITEBACK_WAIT(thread, writeback);')
     
    208179        lastParamName = params[-2][0]
    209180        if return_type != 'void':
    210             print('\tif (pack_spu.swap)')
    211             print('\t{')
    212             print('\t\treturn_val = (%s) SWAP32(return_val);' % return_type)
    213             print('\t}')
    214181            print('\treturn return_val;')
    215         if func_name in easy_swaps and easy_swaps[func_name] != '0':
    216             limit = easy_swaps[func_name]
    217             print('\tif (pack_spu.swap)')
    218             print('\t{')
    219             print('\t\tfor (i = 0; i < %s; i++)' % limit)
    220             print('\t\t{')
    221             if params[-2][1].find( "double" ) > -1:
    222                 print('\t\t\t%s[i] = SWAPDOUBLE(%s[i]);' % (lastParamName, lastParamName))
    223             else:
    224                 print('\t\t\t%s[i] = SWAP32(%s[i]);' % (lastParamName, lastParamName))
    225             print('\t\t}')
    226             print('\t}')
    227         for index in range(len(simple_funcs)):
    228             if simple_funcs[index] == func_name:
    229                 print('\tif (pack_spu.swap)')
    230                 print('\t{')
    231                 print('\t\tfor (i = 0; i < __numValues(pname); i++)')
    232                 print('\t\t{')
    233                 if simple_swaps[index] == 'SWAPDOUBLE':
    234                     print('\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName))
    235                 else:
    236                     print('\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, simple_swaps[index], lastParamName))
    237                 print('\t\t}')
    238                 print('\t}')
    239         if func_name in hard_funcs:
    240             print('\tif (pack_spu.swap)')
    241             print('\t{')
    242             print('\t\tfor (i = 0; i < crStateHlpComponentsCount(pname); i++)')
    243             print('\t\t{')
    244             if hard_funcs[func_name] == 'SWAPDOUBLE':
    245                 print('\t\t\t%s[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName))
    246             else:
    247                 print('\t\t\t((GLuint *) %s)[i] = %s(%s[i]);' % (lastParamName, hard_funcs[func_name], lastParamName))
    248             print('\t\t}')
    249             print('\t}')
    250182        print('}\n')
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c

    r69310 r78190  
    1717static GLubyte gpszShadingVersion[255]="";
    1818#endif
     19static uint32_t g_uOpenGlVersMaj = 0;
     20static uint32_t g_uOpenGlVersMin = 0;
     21
    1922
    2023static void GetString(GLenum name, GLubyte *pszStr)
     
    2326    int writeback = 1;
    2427
    25     if (pack_spu.swap)
    26         crPackGetStringSWAP(name, pszStr, &writeback);
    27     else
    28         crPackGetString(name, pszStr, &writeback);
     28    crPackGetString(name, pszStr, &writeback);
    2929    packspuFlush( (void *) thread );
    3030
     
    3232}
    3333
    34 static GLfloat
     34static void
    3535GetVersionString(void)
    3636{
     
    4040    if (!fInitialized)
    4141    {
     42        int iGlVersion = 0;
    4243        GLubyte return_value[100];
    4344
     
    4546        CRASSERT(crStrlen((char *)return_value) < 100);
    4647
    47         version = crStrToFloat((char *) return_value);
    48         version = crStateComputeVersion(version);
     48        iGlVersion = crStrParseGlVersion((const char *) return_value);
     49        g_uOpenGlVersMaj = CR_GLVERSION_GET_MAJOR(iGlVersion);
     50        g_uOpenGlVersMin = CR_GLVERSION_GET_MINOR(iGlVersion);
     51        crStateComputeVersion(&g_uOpenGlVersMaj, &g_uOpenGlVersMin);
    4952
    5053        fInitialized = GL_TRUE;
    5154    }
    52 
    53     return version;
    5455}
    5556
     
    6566        int writeback = 1;
    6667
    67         if (pack_spu.swap)
    68         {
    69             crPackGetStringSWAP( GL_EXTENSIONS, return_value, &writeback );
    70         }
    71         else
    72         {
    73             crPackGetString( GL_EXTENSIONS, return_value, &writeback );
    74         }
     68        crPackGetString( GL_EXTENSIONS, return_value, &writeback );
    7569        packspuFlush( (void *) thread );
    7670
     
    129123            {
    130124                char *oldlocale;
    131                 float version;
    132125
    133126                oldlocale = setlocale(LC_NUMERIC, NULL);
     
    135128                setlocale(LC_NUMERIC, "C");
    136129
    137                 version = GetVersionString();
    138                 sprintf((char*)ctx->glVersion, "%.1f Chromium %s", version, CR_VERSION_STRING);
     130                GetVersionString();
     131                sprintf((char*)ctx->glVersion, "%u.%u Chromium %s", g_uOpenGlVersMaj, g_uOpenGlVersMin, CR_VERSION_STRING);
    139132
    140133                if (oldlocale)
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c

    r76553 r78190  
    3333        crError("packspu_CreateProgram doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!");
    3434    }
    35     if (pack_spu.swap)
    36     {
    37         crPackCreateProgramSWAP(&return_val, &writeback);
    38     }
    39     else
    40     {
    41         crPackCreateProgram(&return_val, &writeback);
    42     }
     35    crPackCreateProgram(&return_val, &writeback);
    4336    packspuFlush((void *) thread);
    4437    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    45     if (pack_spu.swap)
    46     {
    47         return_val = (GLuint) SWAP32(return_val);
    48     }
    49 
    5038    crStateCreateProgram(return_val);
    5139
     
    6250        crError("packspu_GetUniformLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!");
    6351    }
    64     if (pack_spu.swap)
    65     {
    66         crPackGetUniformLocationSWAP(program, name, &return_val, &writeback);
    67     }
    68     else
    69     {
    70         crPackGetUniformLocation(program, name, &return_val, &writeback);
    71     }
     52
     53    crPackGetUniformLocation(program, name, &return_val, &writeback);
    7254    packspuFlush((void *) thread);
    7355    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    74     if (pack_spu.swap)
    75     {
    76         return_val = (GLint) SWAP32(return_val);
    77     }
    7856    return return_val;
    7957}
     
    124102        crError( "packspu_GetAttribLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    125103    }
    126     if (pack_spu.swap)
    127     {
    128         crPackGetAttribLocationSWAP( program, name, &return_val, &writeback );
    129     }
    130     else
    131     {
    132         crPackGetAttribLocation( program, name, &return_val, &writeback );
    133     }
     104
     105    crPackGetAttribLocation( program, name, &return_val, &writeback );
    134106    packspuFlush( (void *) thread );
    135107    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    136     if (pack_spu.swap)
    137     {
    138         return_val = (GLint) SWAP32(return_val);
    139     }
    140108    return return_val;
    141109}
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c

    r69310 r78190  
    135135}
    136136
    137 extern SPUOptions packSPUOptions[];
    138 
    139137int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    140138         SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    141          SPUOptionsPtr *options, int *flags )
     139         int *flags )
    142140{
    143141    *name = "pack";
     
    146144    *self = packSPUSelfDispatch;
    147145    *cleanup = packSPUCleanup;
    148     *options = packSPUOptions;
    149146    *flags = (SPU_HAS_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ONE);
    150147
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r69310 r78190  
    8585    }
    8686
    87     if (pack_spu.swap)
    88         crPackChromiumParametervCRSWAP(target, type, count, values);
    89     else
    90         crPackChromiumParametervCR(target, type, count, values);
     87    crPackChromiumParametervCR(target, type, count, values);
    9188
    9289    if (fFlush)
     
    131128    GLint writeback = CRPACKSPU_IS_WDDM_CRHGSMI() ? 1 : pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network;
    132129
    133     if (pack_spu.swap)
    134     {
    135         crPackFinishSWAP();
    136     }
    137     else
    138     {
    139         crPackFinish();
    140     }
    141 
     130    crPackFinish();
    142131    if (packspuSyncOnFlushes())
    143132    {
    144133        if (writeback)
    145134        {
    146             if (pack_spu.swap)
    147                 crPackWritebackSWAP(&writeback);
    148             else
    149                 crPackWriteback(&writeback);
     135            crPackWriteback(&writeback);
    150136
    151137            packspuFlush( (void *) thread );
     
    277263
    278264    crPackSetContext(thread->packer);
    279 
    280     if (pack_spu.swap)
    281     {
    282         crPackWindowCreateSWAP( dpyName, visBits, &return_val, &writeback );
    283     }
    284     else
    285     {
    286         crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
    287     }
     265    crPackWindowCreate( dpyName, visBits, &return_val, &writeback );
    288266    packspuFlush(thread);
    289267    if (!(thread->netServer.conn->actual_network))
     
    294272    {
    295273        CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    296         if (pack_spu.swap)
    297         {
    298             return_val = (GLint) SWAP32(return_val);
    299         }
    300274        retVal = return_val;
    301275    }
     
    334308    }
    335309
    336     if (pack_spu.swap)
    337     {
    338         crPackAreTexturesResidentSWAP( n, textures, residences, &return_val, &writeback );
    339     }
    340     else
    341     {
    342         crPackAreTexturesResident( n, textures, residences, &return_val, &writeback );
    343     }
     310    crPackAreTexturesResident( n, textures, residences, &return_val, &writeback );
    344311    packspuFlush( (void *) thread );
    345312
     
    373340        crError( "packspu_AreProgramsResidentNV doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    374341    }
    375     if (pack_spu.swap)
    376     {
    377         crPackAreProgramsResidentNVSWAP( n, ids, residences, &return_val, &writeback );
    378     }
    379     else
    380     {
    381         crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback );
    382     }
     342
     343    crPackAreProgramsResidentNV( n, ids, residences, &return_val, &writeback );
    383344    packspuFlush( (void *) thread );
    384345
     
    403364    int writeback = 1;
    404365
    405     if (pack_spu.swap)
    406     {
    407         crPackGetPolygonStippleSWAP( mask, &writeback );
    408     }
    409     else
    410     {
    411         crPackGetPolygonStipple( mask, &writeback );
    412     }
    413 
     366    crPackGetPolygonStipple( mask, &writeback );
    414367#ifdef CR_ARB_pixel_buffer_object
    415368    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     
    426379    int writeback = 1;
    427380
    428     if (pack_spu.swap)
    429     {
    430         crPackGetPixelMapfvSWAP( map, values, &writeback );
    431     }
    432     else
    433     {
    434         crPackGetPixelMapfv( map, values, &writeback );
    435     }
    436 
     381    crPackGetPixelMapfv( map, values, &writeback );
    437382#ifdef CR_ARB_pixel_buffer_object
    438383    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     
    449394    int writeback = 1;
    450395
    451     if (pack_spu.swap)
    452     {
    453         crPackGetPixelMapuivSWAP( map, values, &writeback );
    454     }
    455     else
    456     {
    457         crPackGetPixelMapuiv( map, values, &writeback );
    458     }
     396    crPackGetPixelMapuiv( map, values, &writeback );
    459397
    460398#ifdef CR_ARB_pixel_buffer_object
     
    472410    int writeback = 1;
    473411
    474     if (pack_spu.swap)
    475     {
    476         crPackGetPixelMapusvSWAP( map, values, &writeback );
    477     }
    478     else
    479     {
    480         crPackGetPixelMapusv( map, values, &writeback );
    481     }
    482 
     412    crPackGetPixelMapusv( map, values, &writeback );
    483413#ifdef CR_ARB_pixel_buffer_object
    484414    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     
    558488        crError( "packspu_GetError doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    559489    }
    560     if (pack_spu.swap)
    561     {
    562         crPackGetErrorSWAP( &return_val, &writeback );
    563     }
    564     else
    565     {
    566         crPackGetError( &return_val, &writeback );
    567     }
    568 
     490
     491    crPackGetError( &return_val, &writeback );
    569492    packspuFlush( (void *) thread );
    570493    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    571 
    572     if (pack_spu.swap)
    573     {
    574         return_val = (GLenum) SWAP32(return_val);
    575     }
    576 
    577494    return return_val;
    578495}
     
    619536
    620537        CRASSERT(thread->packer == NULL);
    621         thread->packer = crPackNewContext( pack_spu.swap );
     538        thread->packer = crPackNewContext();
    622539        CRASSERT(thread->packer);
    623540        crPackInitBuffer(&(thread->buffer), crNetAlloc(thread->netServer.conn),
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c

    r69310 r78190  
    9595    CRASSERT( (void *) hdr >= buf->pack );
    9696
    97     if (pack_spu.swap)
    98     {
    99         hdr->header.type = (CRMessageType) SWAP32(CR_MESSAGE_OPCODES);
    100         hdr->numOpcodes  = SWAP32(num_opcodes);
    101     }
    102     else
    103     {
    104         hdr->header.type = CR_MESSAGE_OPCODES;
    105         hdr->numOpcodes  = num_opcodes;
    106     }
     97    hdr->header.type = CR_MESSAGE_OPCODES;
     98    hdr->numOpcodes  = num_opcodes;
    10799
    108100    *len = buf->data_current - (unsigned char *) hdr;
     
    206198       a header */
    207199    len = ((unsigned int *) buf)[-1];
    208     if (pack_spu.swap)
    209     {
    210         /* It's already been swapped, swap it back. */
    211         len = SWAP32(len);
    212     }
    213200    len += 4 + sizeof(CRMessageOpcodes);
    214201
     
    221208
    222209    msg = (CRMessageOpcodes *) src;
    223 
    224     if (pack_spu.swap)
    225     {
    226         msg->header.type = (CRMessageType) SWAP32(CR_MESSAGE_OPCODES);
    227         msg->numOpcodes  = SWAP32(1);
    228     }
    229     else
    230     {
    231         msg->header.type = CR_MESSAGE_OPCODES;
    232         msg->numOpcodes  = 1;
    233     }
     210    msg->header.type = CR_MESSAGE_OPCODES;
     211    msg->numOpcodes  = 1;
    234212
    235213    CRASSERT( thread->netServer.conn );
     
    272250            return;
    273251        }
    274         pack_spu.swap = server->conn->swap;
    275252    }
    276253    else {
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c

    r69310 r78190  
    330330{
    331331    GET_THREAD(thread);
    332     if (pack_spu.swap)
    333         crPackCopyPixelsSWAP( x, y, width, height, type );
    334     else
    335         crPackCopyPixels( x, y, width, height, type );
     332    crPackCopyPixels( x, y, width, height, type );
    336333    /* XXX why flush here? */
    337334    packspuFlush( (void *) thread );
     
    378375    }
    379376
    380     if (pack_spu.swap)
    381         crPackTexImage1DSWAP( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
    382     else
    383         crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
    384 
     377    crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
    385378    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    386379    {
     
    411404    }
    412405
    413     if (pack_spu.swap)
    414         crPackTexImage2DSWAP( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
    415     else
    416         crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
    417 
     406    crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
    418407    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    419408    {
     
    433422    }
    434423
    435     if (pack_spu.swap)
    436         crPackTexImage3DEXTSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
    437     else
    438         crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
    439 
     424    crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
    440425    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    441426    {
     
    456441    }
    457442
    458     if (pack_spu.swap)
    459         crPackTexImage3DSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
    460     else
    461         crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
    462 
     443    crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
    463444    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    464445    {
     
    484465    }
    485466
    486     if (pack_spu.swap)
    487         crPackTexSubImage1DSWAP( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
    488     else
    489         crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
    490 
     467    crPackTexSubImage1D( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
    491468    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    492469    {
     
    511488    }
    512489
    513     if (pack_spu.swap)
    514         crPackTexSubImage2DSWAP( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
    515     else
    516         crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
    517 
     490    crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
    518491    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    519492    {
     
    533506    }
    534507
    535     if (pack_spu.swap)
    536         crPackTexSubImage3DSWAP( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
    537     else
    538         crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
    539 
     508    crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
    540509    if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    541510    {
     
    549518    GET_CONTEXT(ctx);
    550519    CRClientState *clientState = &(ctx->clientState->client);
    551     if (pack_spu.swap)
    552         crPackZPixCRSWAP( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
    553     else
    554         crPackZPixCR( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
     520    crPackZPixCR( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
    555521}
    556522
     
    572538    }
    573539
    574     if (pack_spu.swap)
    575         crPackGetTexImageSWAP( target, level, format, type, pixels, &(clientState->pack), &writeback );
    576     else
    577         crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback );
    578 
     540    crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback );
    579541    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
    580542    {
     
    601563    }
    602564
    603     if (pack_spu.swap)
    604     {
    605         crPackGetCompressedTexImageARBSWAP( target, level, img, &writeback );
    606     }
    607     else
    608     {
    609         crPackGetCompressedTexImageARB( target, level, img, &writeback );
    610     }
    611 
     565    crPackGetCompressedTexImageARB( target, level, img, &writeback );
    612566    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
    613567    {
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c

    r69310 r78190  
    1111#include "packspu_proto.h"
    1212
    13 #if 0
    14 
    15 void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags )
    16 {
    17     GET_THREAD(thread);
    18     if (pack_spu.swap)
    19     {
    20         crPackSwapBuffersSWAP( window, flags );
    21     }
    22     else
    23     {
    24         crPackSwapBuffers( window, flags );
    25     }
    26     packspuFlush( (void *) thread );
    27 }
    28 
    29 
    30 #else
    3113
    3214void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags )
     
    3416    GET_THREAD(thread);
    3517
    36     if (pack_spu.swap)
    37     {
    38         crPackSwapBuffersSWAP( window, flags );
    39     }
    40     else
    41     {
    42         crPackSwapBuffers( window, flags );
    43     }
     18    crPackSwapBuffers( window, flags );
    4419    packspuFlush( (void *) thread );
    4520
     
    7348             */
    7449            thread->writeback = 1;
    75             if (pack_spu.swap)
    76             {
    77                 crPackWritebackSWAP( (GLint *) &thread->writeback );
    78             }
    79             else
    80             {
    81                 crPackWriteback( (GLint *) &thread->writeback );
    82             }
     50            crPackWriteback( (GLint *) &thread->writeback );
    8351            break;
    8452        case 1:
     
    9260    /* want to emit a parameter here */
    9361    if (pack_spu.emit_GATHER_POST_SWAPBUFFERS)
    94     {
    95         if (pack_spu.swap)
    96             crPackChromiumParameteriCRSWAP(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
    97         else
    98             crPackChromiumParameteriCR(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
    99     }
     62        crPackChromiumParameteriCR(GL_GATHER_POST_SWAPBUFFERS_CR, 1);
    10063}
    10164
    102 #endif
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c

    r76553 r78190  
    4444    GET_THREAD(thread);
    4545    int writeback = 1;
    46     unsigned int i;
    4746    if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
    4847    {
    4948        crError( "packspu_GenTextures doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    5049    }
    51     if (pack_spu.swap)
    52     {
    53         crPackGenTexturesSWAP( n, textures, &writeback );
    54     }
    55     else
    56     {
    57         crPackGenTextures( n, textures, &writeback );
    58     }
     50
     51    crPackGenTextures( n, textures, &writeback );
    5952    packspuFlush( (void *) thread );
    6053    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    61     if (pack_spu.swap)
    62     {
    63         for (i = 0 ; i < (unsigned int) n ; i++)
    64         {
    65             textures[i] = SWAP32(textures[i]);
    66         }
    67     }
    68 
    6954    crStateRegTextures(n, textures);
    7055}
  • trunk/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu_init.c

    r69310 r78190  
    4444}
    4545
    46 static SPUOptions passthroughSPUOptions[] = {
    47    { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    48 };
    49 
    5046
    5147int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    5248             SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    53              SPUOptionsPtr *options, int *flags )
     49             int *flags )
    5450{
    5551        *name = "passthrough";
     
    5854        *self = passthroughSPUSelfDispatch;
    5955        *cleanup = passthroughSPUCleanup;
    60         *options = passthroughSPUOptions;
    6156        *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
    6257
  • trunk/src/VBox/Additions/common/crOpenGL/wgl.c

    r69310 r78190  
    77#include "cr_error.h"
    88#include "cr_spu.h"
    9 #include "cr_environment.h"
    109#include "cr_mem.h"
    1110#include "stub.h"
     
    1918
    2019#include <iprt/cdefs.h>
     20#include <iprt/env.h>
    2121
    2222/* Currently host part will misbehave re-creating context with proper visual bits
     
    8383     * There are subtle differences in the use of these calls.
    8484     */
    85     crSetenv("CR_WGL_DO_NOT_USE_GDI", "yes");
     85    RTEnvSet("CR_WGL_DO_NOT_USE_GDI", "yes");
    8686
    8787    if ( pfd->nSize != sizeof(*pfd) || pfd->nVersion != 1 ) {
  • trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk

    r77180 r78190  
    6060endif
    6161VBoxOGLcrutil_SOURCES       = \
    62         util/bbox.c \
    6362        util/bufpool.c \
    64         util/calllists.c \
    65         util/devnull.c \
    6663        util/dll.c \
    67         util/endian.c \
    68         util/environment.c \
    6964        util/error.c \
    70         util/filenet.c \
    7165        util/hash.c \
    72         util/hull.c \
    73         util/list.c \
    7466        util/matrix.c \
    7567        util/mem.c \
     
    7769        util/pixel.c \
    7870        util/process.c \
    79         util/rand.c \
    8071        util/string.c \
    8172        util/threads.c \
    82         util/tcpip.c \
    83         util/udptcpip.c \
    84         util/timer.c \
    85         util/url.c \
    86         util/warp.c \
    8773        util/vreg.cpp \
    8874        util/blitter.cpp \
     
    9076        util/htable.cpp \
    9177        util/bmpscale.cpp \
    92         util/vboxhgcm.c \
    93         $(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c
     78        util/vboxhgcm.c
    9479VBoxOGLcrutil_SOURCES.win = \
    9580        util/VBoxOGLcrutil.rc
     
    123108VBoxOGLcrutil_LIBS.win    += $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger$(VBOX_SUFF_LIB)
    124109endif
    125 VBoxOGLcrutil_CLEAN = \
    126         $(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c
    127110if1of ($(KBUILD_TARGET), linux)
    128111VBoxOGLcrutil_LDFLAGS += -Wl,-z,nodelete
     
    191174# Generate files for VBoxOGLcrutil and VBoxOGLhostcrutil.
    192175#
    193 $(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c: $(PATH_SUB_CURRENT)/util/debug_opcodes.py $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    194         $(call MSG_GENERATE,python,$@,$<)
    195         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI)
    196 
    197176ifdef VBOX_WITH_CRDUMPER
    198177$(VBOX_PATH_CROGL_GENFILES)/dump_gen.cpp: $(PATH_SUB_CURRENT)/state_tracker/dump_gen.py $(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.py $(addprefix $(PATH_SUB_CURRENT)/state_tracker/, state_isenabled.txt state_extensions_isenabled.txt) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     
    235214        packer/pack_lights.c \
    236215        packer/pack_lists.c \
    237         packer/pack_swap_lists.c \
    238216        packer/pack_map.c \
    239217        packer/pack_point.c \
    240         packer/pack_swap_map.c \
    241218        packer/pack_misc.c \
    242219        packer/pack_materials.c \
     
    244221        packer/pack_pixels.c \
    245222        packer/pack_pixelmap.c \
    246         packer/pack_swap_pixelmap.c \
    247223        packer/pack_program.c \
    248224        packer/pack_regcombiner.c \
    249225        packer/pack_stipple.c \
    250226        packer/pack_texture.c \
    251         packer/pack_swap_texture.c \
    252227        packer/pack_visibleregion.c \
    253228        packer/pack_shaders.c \
    254229        packer/pack_framebuffer.c \
    255         $(VBOX_PATH_CROGL_GENFILES)/pack_arrays_swap.c \
    256         $(VBOX_PATH_CROGL_GENFILES)/pack_bounds_swap.c \
    257         $(VBOX_PATH_CROGL_GENFILES)/pack_bufferobject_swap.c \
    258         $(VBOX_PATH_CROGL_GENFILES)/pack_client_swap.c \
    259         $(VBOX_PATH_CROGL_GENFILES)/pack_clipplane_swap.c \
    260         $(VBOX_PATH_CROGL_GENFILES)/pack_fog_swap.c \
    261         $(VBOX_PATH_CROGL_GENFILES)/pack_lights_swap.c \
    262         $(VBOX_PATH_CROGL_GENFILES)/pack_materials_swap.c \
    263         $(VBOX_PATH_CROGL_GENFILES)/pack_matrices_swap.c \
    264         $(VBOX_PATH_CROGL_GENFILES)/pack_misc_swap.c \
    265         $(VBOX_PATH_CROGL_GENFILES)/pack_pixels_swap.c \
    266         $(VBOX_PATH_CROGL_GENFILES)/pack_point_swap.c \
    267         $(VBOX_PATH_CROGL_GENFILES)/pack_program_swap.c \
    268         $(VBOX_PATH_CROGL_GENFILES)/pack_regcombiner_swap.c \
    269         $(VBOX_PATH_CROGL_GENFILES)/pack_stipple_swap.c \
    270230        $(VBOX_PATH_CROGL_GENFILES)/pack_bbox.c \
    271231        $(VBOX_PATH_CROGL_GENFILES)/pack_current.c \
    272232        $(VBOX_PATH_CROGL_GENFILES)/packer.c
    273233VBoxOGLcrpacker_CLEAN = \
    274         $(VBOX_PATH_CROGL_GENFILES)/pack_arrays_swap.c \
    275         $(VBOX_PATH_CROGL_GENFILES)/pack_bounds_swap.c \
    276         $(VBOX_PATH_CROGL_GENFILES)/pack_bufferobject_swap.c \
    277         $(VBOX_PATH_CROGL_GENFILES)/pack_client_swap.c \
    278         $(VBOX_PATH_CROGL_GENFILES)/pack_clipplane_swap.c \
    279         $(VBOX_PATH_CROGL_GENFILES)/pack_fog_swap.c \
    280         $(VBOX_PATH_CROGL_GENFILES)/pack_lights_swap.c \
    281         $(VBOX_PATH_CROGL_GENFILES)/pack_materials_swap.c \
    282         $(VBOX_PATH_CROGL_GENFILES)/pack_matrices_swap.c \
    283         $(VBOX_PATH_CROGL_GENFILES)/pack_misc_swap.c \
    284         $(VBOX_PATH_CROGL_GENFILES)/pack_pixels_swap.c \
    285         $(VBOX_PATH_CROGL_GENFILES)/pack_point_swap.c \
    286         $(VBOX_PATH_CROGL_GENFILES)/pack_program_swap.c \
    287         $(VBOX_PATH_CROGL_GENFILES)/pack_regcombiner_swap.c \
    288         $(VBOX_PATH_CROGL_GENFILES)/pack_stipple_swap.c \
    289234        $(VBOX_PATH_CROGL_GENFILES)/pack_bbox.c \
    290235        $(VBOX_PATH_CROGL_GENFILES)/pack_current.c \
     
    347292        $(call MSG_GENERATE,python,$@,$<)
    348293        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $<
    349 
    350 $(VBOX_PATH_CROGL_GENFILES)/%_swap.c: $(PATH_SUB_CURRENT)/packer/%.c $(PATH_SUB_CURRENT)/packer/pack_swap.py | $$(dir $$@)
    351         $(call MSG_GENERATE,python,$@,$<)
    352         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $(<D)/pack_swap.py $<
    353 
    354294
    355295#
  • trunk/src/VBox/GuestHost/OpenGL/error/errorspu_init.c

    r69392 r78190  
    3838}
    3939
    40 static SPUOptions errorSPUOptions[] = {
    41    { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    42 };
    43 
    4440
    4541int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    4642             SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    47              SPUOptionsPtr *options, int *flags )
     43             int *flags )
    4844{
    4945#ifdef IN_GUEST
     
    5652        *self = errorSPUSelfDispatch;
    5753        *cleanup = errorSPUCleanup;
    58         *options = errorSPUOptions;
    5954        *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
    6055       
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_htable.h

    r76553 r78190  
    4545} CRHTABLE, *PCRHTABLE;
    4646
    47 typedef struct CRHTABLE_ITERATOR
    48 {
    49     PCRHTABLE pTbl;
    50     uint32_t iCur;
    51     uint32_t cLeft;
    52 } VCRHTABLE_ITERATOR, *PCRHTABLE_ITERATOR;
    53 
    5447/*private stuff, not to be used directly */
    5548DECLINLINE(CRHTABLE_HANDLE) crHTableIndex2Handle(uint32_t iIndex)
     
    6154{
    6255    return hHandle-1;
    63 }
    64 
    65 /* public API */
    66 DECLINLINE(void) CrHTableIterInit(PCRHTABLE pTbl, PCRHTABLE_ITERATOR pIter)
    67 {
    68     pIter->pTbl = pTbl;
    69     pIter->iCur = 0;
    70     pIter->cLeft = pTbl->cData;
    71 }
    72 
    73 DECLINLINE(void*) CrHTableIterNext(PCRHTABLE_ITERATOR pIter, CRHTABLE_HANDLE *phHandle)
    74 {
    75     PCRHTABLE pTbl;
    76     uint32_t i;
    77     if (!pIter->cLeft)
    78     {
    79         if (phHandle)
    80             *phHandle = 0;
    81         return NULL;
    82     }
    83 
    84     pTbl = pIter->pTbl;
    85 
    86     for (i = pIter->iCur; i < pTbl->cSize; ++i)
    87     {
    88         if (pTbl->paData[i])
    89         {
    90             pIter->iCur = i+1;
    91             --(pIter->cLeft);
    92             if (phHandle)
    93                 *phHandle = crHTableIndex2Handle(i);
    94             return pTbl->paData[i];
    95         }
    96     }
    97 
    98     crWarning("interator concurent modification!");
    99     return NULL;
    10056}
    10157
     
    11167VBOXHTABLEDECL(CRHTABLE_HANDLE) CrHTablePut(PCRHTABLE pTbl, void *pvData);
    11268VBOXHTABLEDECL(int) CrHTablePutToSlot(PCRHTABLE pTbl, CRHTABLE_HANDLE hHandle, void* pvData);
    113 
    114 /* note: can be called for the element returned with CrHTableIterNext w/o corrupting the iterator */
    11569VBOXHTABLEDECL(void*) CrHTableRemove(PCRHTABLE pTbl, CRHTABLE_HANDLE hHandle);
    11670VBOXHTABLEDECL(void*) CrHTableGet(PCRHTABLE pTbl, CRHTABLE_HANDLE hHandle);
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_mem.h

    r69474 r78190  
    88#define CR_MEM_H
    99
     10#include "cr_error.h"
     11
     12#include <stdlib.h>
    1013#include <iprt/types.h>
     14#include <iprt/mem.h>
     15#include <iprt/string.h>
    1116
    1217#ifdef __cplusplus
     
    1419#endif
    1520
    16 #define DEBUG_MEM 0
     21DECLINLINE(void) crMemcpy( void *dst, const void *src, unsigned int bytes )
     22{
     23        CRASSERT(dst || 0==bytes);
     24        CRASSERT(src || 0==bytes);
     25        (void) memcpy( dst, src, bytes );
     26}
    1727
    18 void *crAllocDebug( unsigned int nbytes, const char *file, int line );
    19 void *crCallocDebug( unsigned int nbytes, const char *file, int line );
    20 #if DEBUG_MEM
    21 #define crAlloc(N) crAllocDebug(N, __FILE__, __LINE__)
    22 #define crCalloc(N) crCallocDebug(N, __FILE__, __LINE__)
    23 #else
     28DECLINLINE(void) crMemset( void *ptr, int value, unsigned int bytes )
     29{
     30        CRASSERT(ptr);
     31        memset( ptr, value, bytes );
     32}
     33
     34DECLINLINE(void) crMemZero( void *ptr, unsigned int bytes )
     35{
     36        CRASSERT(ptr);
     37        memset( ptr, 0, bytes );
     38}
     39
     40DECLINLINE(int) crMemcmp( const void *p1, const void *p2, unsigned int bytes )
     41{
     42        CRASSERT(p1);
     43        CRASSERT(p2);
     44        return memcmp( p1, p2, bytes );
     45}
     46
    2447extern DECLEXPORT(void *) crAlloc( unsigned int nbytes );
    2548extern DECLEXPORT(void *) crCalloc( unsigned int nbytes );
    26 #endif
    2749extern DECLEXPORT(void) crRealloc( void **ptr, unsigned int bytes );
    2850extern DECLEXPORT(void) crFree( void *ptr );
    29 extern DECLEXPORT(void) crMemcpy( void *dst, const void *src, unsigned int bytes );
    30 extern DECLEXPORT(void) crMemset( void *ptr, int value, unsigned int bytes );
    31 extern DECLEXPORT(void) crMemZero( void *ptr, unsigned int bytes );
    32 extern DECLEXPORT(int)  crMemcmp( const void *p1, const void *p2, unsigned int bytes );
    3351
    3452#ifdef __cplusplus
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_net.h

    r69474 r78190  
    88#define CR_NET_H
    99
    10 #ifdef WINDOWS
    11 #define WIN32_LEAN_AND_MEAN
    12 # ifndef VBOX
    13 #pragma warning( push, 3 ) /* shut up about warnings in YOUR OWN HEADER FILES!!! */
    14 #include <winsock.h>
    15 # else
     10#ifdef RT_OS_WINDOWS
    1611# include <iprt/win/winsock.h>
    17 # endif /* VBOX */
    18 #endif
    19 
    20 #include <stdio.h>
    21 
    22 #ifndef WINDOWS
    23 #include <sys/socket.h>
    24 #ifndef DARWIN
    25 #ifdef AF_INET6
    26 /* getaddrinfo & co appeared with ipv6 */
    27 #define ADDRINFO
    28 #endif
    29 #endif
    30 #include <netinet/in.h>
    31 #endif
    32 
    33 #ifdef SunOS
    34 #include <sys/types.h>
    3512#endif
    3613
     
    4623#endif
    4724
    48 #define DEFAULT_SERVER_PORT 7000
    49 
    50 /* If you change this, update DefaultMothershipPort in mothership.py */
    51 #define DEFAULT_MOTHERSHIP_PORT 10000
    52 
    5325typedef struct CRConnection CRConnection;
    5426
    5527typedef enum {
    5628    CR_NO_CONNECTION,
    57     CR_SDP,
    58     CR_TCPIP,
    59     CR_UDPTCPIP,
    60     CR_FILE,
    61     CR_GM,
    62     CR_IB,
    63     CR_TEAC,
    64     CR_TCSCOMM,
    6529    CR_VBOXHGCM,
    6630    CR_DROP_PACKETS
    6731} CRConnectionType;
    68 
    69 #if defined(WINDOWS)
    70 typedef SOCKET CRSocket;
    71 #else
    72 typedef int    CRSocket;
    73 #endif
    7432
    7533typedef void (*CRVoidFunc)( void );
     
    143101    int broker;              /* is connection brokered through mothership? */
    144102    int threaded;            /* is this a threaded connection? */
    145     int endianness, swap;
     103    int swap;
    146104    int actual_network;      /* is this a real network? */
    147105
    148106    unsigned char *userbuf;
    149107    int userbuf_len;
    150 
    151     char *hostname;
    152     int port;
    153108
    154109    /* To allocate a data buffer of size conn->buffer_size bytes */
     
    173128    void  (*HandleNewMessage)( CRConnection *conn, CRMessage *mess, unsigned int len );
    174129    /* To accept a new connection from a client */
    175     void  (*Accept)( CRConnection *conn, const char *hostname, unsigned short port );
     130    void  (*Accept)( CRConnection *conn);
    176131    /* To connect to a server (return 0 if error, 1 if success) */
    177132    int  (*Connect)( CRConnection *conn );
     
    191146    int recv_credits;
    192147
    193     /* TCP/IP */
    194     CRSocket tcp_socket;
    195     int index;
    196 
    197     CRSocket sdp_socket;
    198 
    199     /* UDP/IP */
    200     CRSocket udp_socket;
    201 #ifndef ADDRINFO
    202     struct sockaddr_in remoteaddr;
    203 #else
    204     struct sockaddr_storage remoteaddr;
    205 #endif
    206 
    207     /* UDP/TCP/IP */
    208     unsigned int seq;
    209     unsigned int ack;
    210     void *udp_packet;
    211     int udp_packetlen;
    212 
    213     /* FILE Tracing */
    214     enum { CR_FILE_WRITE, CR_FILE_READ } file_direction;
    215     char *filename;
    216     int fd;
    217 
    218     /* Myrinet GM */
    219     unsigned int gm_node_id;
    220     unsigned int gm_port_num;
    221 
    222     /* Mellanox IB */
    223     unsigned int ib_node_id;
    224     unsigned int ib_port_num;
    225 
    226     /* Quadrics Elan3 (teac) */
    227     int teac_id;
    228     int teac_rank;
    229 
    230     /* Quadrics Elan3 (tcscomm) */
    231     int tcscomm_id;
    232     int tcscomm_rank;
    233 
    234148    /* VBox HGCM */
     149    int      index;
    235150    uint32_t u32ClientID;
    236151    uint8_t  *pBuffer;
     
    275190extern DECLEXPORT(void) crNetFree( CRConnection *conn, void *buf );
    276191
    277 extern DECLEXPORT(void) crNetAccept( CRConnection *conn, const char *hostname, unsigned short port );
     192extern DECLEXPORT(void) crNetAccept( CRConnection *conn );
    278193extern DECLEXPORT(int) crNetConnect( CRConnection *conn );
    279194extern DECLEXPORT(void) crNetDisconnect( CRConnection *conn );
    280195extern DECLEXPORT(void) crNetFreeConnection( CRConnection *conn );
    281 extern DECLEXPORT(void) crCloseSocket( CRSocket sock );
    282196
    283197extern DECLEXPORT(void) crNetSend( CRConnection *conn, void **bufp, const void *start, unsigned int len );
     
    318232extern DECLEXPORT(void) crNetDispatchMessage( CRNetReceiveFuncList *rfl, CRConnection *conn, CRMessage *msg, unsigned int len );
    319233
    320 extern DECLEXPORT(CRConnection *) crNetConnectToServer( const char *server, unsigned short default_port, int mtu, int broker
     234extern DECLEXPORT(CRConnection *) crNetConnectToServer( const char *server, int mtu, int broker
    321235#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    322236                , struct VBOXUHGSMI *pHgsmi
     
    331245
    332246extern DECLEXPORT(void) crNetRecvReadPixels( const CRMessageReadPixels *rp, unsigned int len );
    333 
    334 
    335 /*
    336  * Quadrics stuff
    337  */
    338 #define CR_QUADRICS_DEFAULT_LOW_CONTEXT  32
    339 #define CR_QUADRICS_DEFAULT_HIGH_CONTEXT 35
    340 
    341 extern DECLEXPORT(void) crNetSetRank( int my_rank );
    342 extern DECLEXPORT(void) crNetSetContextRange( int low_context, int high_context );
    343 extern DECLEXPORT(void) crNetSetNodeRange( const char *low_node, const char *high_node );
    344 extern DECLEXPORT(void) crNetSetKey( const unsigned char* key, const int keyLength );
    345247
    346248
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h

    r69474 r78190  
    1212#include "cr_protocol.h"
    1313#include "cr_opcodes.h"
    14 #include "cr_endian.h"
    1514#include "state/cr_statetypes.h"
    1615#include "state/cr_currentpointers.h"
     
    8483    GLvectorf bounds_min, bounds_max;
    8584    int updateBBOX;
    86     int swapping;
    8785    CRPackBuffer *currentBuffer;
    8886#ifdef CHROMIUM_THREADSAFE
     
    122120#endif
    123121
    124 extern DECLEXPORT(CRPackContext *) crPackNewContext(int swapping);
     122extern DECLEXPORT(CRPackContext *) crPackNewContext(void);
    125123extern DECLEXPORT(void) crPackDeleteContext(CRPackContext *pc);
    126124extern DECLEXPORT(void) crPackSetContext( CRPackContext *pc );
     
    164162#ifndef IN_RING0
    165163extern DECLEXPORT(void) crWriteUnalignedDouble( void *buffer, double d );
    166 extern DECLEXPORT(void) crWriteSwappedDouble( void *buffer, double d );
    167164#endif
    168165
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_process.h

    r69474 r78190  
    3333
    3434
    35 extern DECLEXPORT(void) crSleep( unsigned int seconds );
    36 
    37 extern DECLEXPORT(void) crMsleep( unsigned int msec );
    38 
    39 extern DECLEXPORT(CRpid) crSpawn( const char *command, const char *argv[] );
    40 
    41 extern DECLEXPORT(void) crKill( CRpid pid );
    42 
    4335extern DECLEXPORT(void) crGetProcName( char *name, int maxLen );
    44 
    45 extern DECLEXPORT(void) crGetCurrentDir( char *dir, int maxLen );
    4636
    4737extern DECLEXPORT(CRpid) crGetPID(void);
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r69474 r78190  
    1616#include "cr_blitter.h"
    1717#include "cr_htable.h"
     18#include "cr_unpack.h"
    1819#include "spu_dispatch_table.h"
    1920#include "cr_dump.h"
     
    389390    CRNetworkPointer return_ptr;
    390391    CRNetworkPointer writeback_ptr;
     392    /*
     393     * The current active unpacker state, this hack is required for the server dispatch routines
     394     * (see crServerDispatchReadPixels for example) as it needs to read data from the buffer
     395     * but it is not possible to supply the state as a parameter unfortunately.
     396     */
     397    PCrUnpackerState pUnpackerState;
    391398
    392399    CRLimitsState limits; /**< GL limits for any contexts we create */
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_spu.h

    r69474 r78190  
    2121#ifdef DARWIN
    2222# include <OpenGL/OpenGL.h>
    23 # ifdef VBOX_WITH_COCOA_QT
    24 # else
    25 #  include <AGL/agl.h>
    26 # endif
    2723#endif
    2824
     
    5551    SPUNamedFunctionTable *table;
    5652} SPUFunctions;
    57 
    58 /**
    59  * SPU Option callback
    60  * \param spu
    61  * \param response
    62  */
    63 typedef void (*SPUOptionCB)( void *spu, const char *response );
    64 
    65 typedef enum { CR_BOOL, CR_INT, CR_FLOAT, CR_STRING, CR_ENUM } cr_type;
    66 
    67 /**
    68  * SPU Options table
    69  */
    70 typedef struct {
    71     const char *option; /**< Name of the option */
    72     cr_type type;       /**< Type of option */
    73     int numValues;  /**< usually 1 */
    74     const char *deflt;  /**< comma-separated string of [numValues] defaults */
    75     const char *min;    /**< comma-separated string of [numValues] minimums */
    76     const char *max;    /**< comma-separated string of [numValues] maximums */
    77     const char *description; /**< Textual description of the option */
    78     SPUOptionCB cb;     /**< Callback function */
    79 } SPUOptions, *SPUOptionsPtr;
    80 
    8153
    8254/** Init spu */
     
    8759typedef int (*SPUCleanupFuncPtr)(void);
    8860/** Load spu */
    89 typedef int (*SPULoadFunction)(char **, char **, void *, void *, void *,
    90                    SPUOptionsPtr *, int *);
     61typedef int (*SPULoadFunction)(char **, char **, void *, void *, void *, int *);
    9162
    9263
     
    12192    SPUCleanupFuncPtr cleanup;  /**< SPU cleanup func */
    12293    SPUFunctions *function_table;   /**< Function table for spu */
    123     SPUOptions *options;        /**< Options table */
    12494    SPUDispatchTable dispatch_table;
    12595    void *privatePtr;       /**< pointer to SPU-private data */
     
    154124/*@}*/
    155125#elif defined(DARWIN)
    156 # ifndef VBOX_WITH_COCOA_QT
    157 /**
    158  * Apple/AGL
    159  */
    160 /*@{*/
    161 typedef AGLContext (*aglCreateContextFunc_t)( AGLPixelFormat, AGLContext );
    162 typedef GLboolean (*aglDestroyContextFunc_t)( AGLContext );
    163 typedef GLboolean (*aglSetCurrentContextFunc_t)( AGLContext );
    164 typedef void (*aglSwapBuffersFunc_t)( AGLContext );
    165 typedef AGLPixelFormat (*aglChoosePixelFormatFunc_t) (const AGLDevice *, GLint, const GLint *);
    166 typedef GLboolean (*aglDescribePixelFormatFunc_t)( AGLPixelFormat, GLint, GLint * );
    167 /* <--set pixel format */
    168 typedef AGLContext (*aglGetCurrentContextFunc_t)();
    169 /* <--get proc address -- none exists */
    170 typedef void* (*aglGetProcAddressFunc_t)( const GLubyte *name );
    171 
    172 /* These are here just in case */
    173 typedef GLboolean (*aglDescribeRendererFunc_t)( AGLRendererInfo, GLint, GLint * );
    174 typedef void (*aglDestroyPixelFormatFunc_t)( AGLPixelFormat );
    175 typedef void (*aglDestroyRendererInfoFunc_t)( AGLRendererInfo );
    176 typedef AGLDevice* (*aglDevicesOfPixelFormatFunc_t)( AGLPixelFormat, GLint );
    177 typedef GLboolean (*aglDisableFunc_t)( AGLContext, GLenum );
    178 typedef GLboolean (*aglEnableFunc_t)( AGLContext, GLenum );
    179 typedef const GLubyte* (*aglErrorStringFunc_t)( GLenum );
    180 typedef AGLDrawable (*aglGetDrawableFunc_t)( AGLContext );
    181 typedef GLenum (*aglGetErrorFunc_t)();
    182 typedef GLboolean (*aglGetIntegerFunc_t)( AGLContext, GLenum, GLint* );
    183 typedef void (*aglGetVersionFunc_t)( GLint *, GLint * );
    184 typedef GLint (*aglGetVirtualScreenFunc_t)( AGLContext );
    185 typedef GLboolean (*aglIsEnabledFunc_t)( AGLContext, GLenum );
    186 typedef AGLPixelFormat (*aglNextPixelFormatFunc_t)( AGLPixelFormat );
    187 typedef AGLRendererInfo (*aglNextRendererInfoFunc_t)( AGLRendererInfo );
    188 typedef AGLRendererInfo (*aglQueryRendererInfoFunc_t)( const AGLDevice *, GLint );
    189 typedef void (*aglReserLibraryFunc_t)();
    190 typedef GLboolean (*aglSetDrawableFunc_t)( AGLContext, AGLDrawable );
    191 typedef GLboolean (*aglSetFullScreenFunc_t)( AGLContext, GLsizei, GLsizei, GLsizei, GLint );
    192 typedef GLboolean (*aglSetIntegerFunc_t)( AGLContext, GLenum, const GLint * );
    193 typedef GLboolean (*aglSetOffScreenFunc_t)( AGLContext, GLsizei, GLsizei, GLsizei, void * );
    194 typedef GLboolean (*aglSetVirtualScreenFunc_t)( AGLContext, GLint );
    195 typedef GLboolean (*aglUpdateContextFunc_t)( AGLContext );
    196 typedef GLboolean (*aglUseFontFunc_t)( AGLContext, GLint, Style, GLint, GLint, GLint, GLint );
    197 # endif
    198 
    199126typedef const GLubyte *(*glGetStringFunc_t)( GLenum );
    200127/*@}*/
     
    328255    wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT;
    329256#elif defined(DARWIN)
    330 # ifndef VBOX_WITH_COCOA_QT
    331     aglCreateContextFunc_t          aglCreateContext;
    332     aglDestroyContextFunc_t         aglDestroyContext;
    333     aglSetCurrentContextFunc_t      aglSetCurrentContext;
    334     aglSwapBuffersFunc_t            aglSwapBuffers;
    335     aglChoosePixelFormatFunc_t      aglChoosePixelFormat;
    336     aglDestroyPixelFormatFunc_t     aglDestroyPixelFormat;
    337     aglDescribePixelFormatFunc_t    aglDescribePixelFormat;
    338     aglGetCurrentContextFunc_t      aglGetCurrentContext;
    339     aglSetDrawableFunc_t            aglSetDrawable;
    340     aglGetDrawableFunc_t            aglGetDrawable;
    341     aglSetFullScreenFunc_t          aglSetFullScreen;
    342     aglGetProcAddressFunc_t         aglGetProcAddress;
    343     aglUpdateContextFunc_t          aglUpdateContext;
    344     aglUseFontFunc_t                aglUseFont;
    345     aglSetIntegerFunc_t             aglSetInteger;
    346     aglGetErrorFunc_t               aglGetError;
    347     aglGetIntegerFunc_t             aglGetInteger;
    348     aglEnableFunc_t                 aglEnable;
    349     aglDisableFunc_t                aglDisable;
    350 # endif
    351 
    352257    CGLChoosePixelFormatFunc_t      CGLChoosePixelFormat;
    353258    CGLDestroyPixelFormatFunc_t     CGLDestroyPixelFormat;
     
    435340DECLEXPORT(int) SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    436341                    SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    437                     SPUOptionsPtr *options, int *flags );
     342                    int *flags );
    438343
    439344DECLEXPORT(SPU *) crSPULoad( SPU *child, int id, char *name, char *dir, void *server);
     
    444349DECLEXPORT(void) crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src );
    445350DECLEXPORT(void) crSPUChangeInterface( SPUDispatchTable *table, void *origFunc, void *newFunc );
    446 
    447 
    448 DECLEXPORT(void) crSPUSetDefaultParams( void *spu, SPUOptions *options );
    449 DECLEXPORT(int) crSPUGetEnumIndex( const SPUOptions *option, const char *optName, const char *value );
    450351
    451352
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_unpack.h

    r78076 r78190  
    2020#endif
    2121
    22 extern SPUDispatchTable cr_unpackDispatch;
    23 /*extern DLLDATA(const unsigned char *) cr_unpackData;*/
    24 extern DECLEXPORT(const unsigned char *) cr_unpackData;
    25 extern DECLEXPORT(const unsigned char *) cr_unpackDataEnd;
    26 
    27 DECLEXPORT(void) crUnpackSetReturnPointer( CRNetworkPointer *ptr );
    28 DECLEXPORT(void) crUnpackSetWritebackPointer( CRNetworkPointer *ptr );
    29 DECLEXPORT(void) crUnpack( const void *data, const void *data_end, const void *opcodes, unsigned int num_opcodes, SPUDispatchTable *table );
    30 DECLEXPORT(void) crUnpackPush(void);
    31 DECLEXPORT(void) crUnpackPop(void);
     22/**
     23 * Unpacker state.
     24 */
     25typedef struct CrUnpackerState
     26{
     27    /** Opcodes which are going to be unpacked. */
     28    const uint8_t               *pbOpcodes;
     29    /** NUmber of Opcodes to unpack. */
     30    size_t                      cOpcodes;
     31    /** Start of the data buffer to unpack. */
     32    const uint8_t               *pbUnpackData;
     33    /** Number of bytes remaining the inpack buffer. */
     34    size_t                      cbUnpackDataLeft;
     35    /** Return pointer. */
     36    CRNetworkPointer            *pReturnPtr;
     37    /** Writeback pointer. */
     38    CRNetworkPointer            *pWritebackPtr;
     39    /** Pointer to the dispatch table to use. */
     40    SPUDispatchTable            *pDispatchTbl;
     41    /** Status code from the unpacker (mostly returns VERR_BUFFER_OVERFLOW
     42     * on error if one unpacker detected out of bounds buffer access). */
     43    int                         rcUnpack;
     44} CrUnpackerState;
     45/** Pointer to an unpacker state. */
     46typedef CrUnpackerState *PCrUnpackerState;
     47/** Pointer to a const unpacker state. */
     48typedef const CrUnpackerState *PCCrUnpackerState;
     49
     50DECLEXPORT(void) crUnpack(PCrUnpackerState pState);
    3251
    3352typedef enum
     
    4160DECLEXPORT(CR_UNPACK_BUFFER_TYPE) crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes);
    4261
    43 extern CRNetworkPointer * return_ptr;
    44 extern CRNetworkPointer * writeback_ptr;
    45 
    4662#if defined(LINUX) || defined(WINDOWS)
    4763#define CR_UNALIGNED_ACCESS_OKAY
     
    5167DECLEXPORT(double) crReadUnalignedDouble( const void *buffer );
    5268
    53 #define READ_DATA( offset, type ) \
    54     *( (const type *) (cr_unpackData + (offset)))
     69/**
     70 * Paranoid helper for debug builds to make sure the buffer size is validated correctly.
     71 */
     72DECLINLINE(const void *) crUnpackAccessChk(PCCrUnpackerState pState, size_t cbAccessVerified,
     73                                     size_t offAccess, size_t cbType)
     74{
     75    AssertMsg(offAccess + cbType <= cbAccessVerified,
     76             ("CHECK_BUFFER_SIZE_STATIC() has a wrong size given (verified %zu bytes vs tried access %zu)!\n",
     77             cbAccessVerified, offAccess + cbType));
     78    RT_NOREF(cbAccessVerified, cbType);
     79    return pState->pbUnpackData + offAccess;
     80}
     81
     82/**
     83 * Does a one time check whether the buffer has sufficient data to access at least a_cbAccess
     84 * bytes. Sets an error for the state and returns.
     85 *
     86 * @note Should only be used in the prologue of a method.
     87 * @remark The introduction of int_cbAccessVerified makes sure CHECK_BUFFER_SIZE_STATIC() is there in each method for at least
     88  *        some rudimentary sanity check (fails to compile otherwise).
     89 */
     90#define CHECK_BUFFER_SIZE_STATIC(a_pState, a_cbAccess) \
     91    if (RT_UNLIKELY((a_pState)->cbUnpackDataLeft < (a_cbAccess))) \
     92    { \
     93        (a_pState)->rcUnpack = VERR_BUFFER_OVERFLOW; \
     94        return; \
     95    } \
     96    size_t int_cbAccessVerified = (a_cbAccess)
     97
     98#define CHECK_BUFFER_SIZE_STATIC_LAST(a_pState, a_offAccessLast, a_Type) CHECK_BUFFER_SIZE_STATIC(a_pState, (a_offAccessLast) + sizeof( a_Type ))
     99
     100#define CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, a_cbAccess) \
     101    do \
     102    { \
     103        if (RT_UNLIKELY((a_pState)->cbUnpackDataLeft < (a_cbAccess))) \
     104        { \
     105            (a_pState)->rcUnpack = VERR_BUFFER_OVERFLOW; \
     106            return; \
     107        } \
     108        int_cbAccessVerified = (a_cbAccess); \
     109    } \
     110    while (0)
     111
     112#define CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(a_pState, a_offAccessLast, a_Type) CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, (a_offAccessLast) + sizeof( a_Type ))
     113
     114#define CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(a_pState, a_pArrayStart, a_cElements, a_Type) \
     115    CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, ((const uint8_t *)a_pArrayStart - (a_pState)->pbUnpackData) + (a_cElements) * sizeof(a_Type))
     116#define CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(a_pState, a_pArrayStart, a_cElements, a_cbType) \
     117    CHECK_BUFFER_SIZE_STATIC_UPDATE(a_pState, ((const uint8_t *)a_pArrayStart - (a_pState)->pbUnpackData) + (a_cElements) * (a_cbType))
     118
     119
     120DECLINLINE(size_t) crUnpackAcccessChkStrUpdate(PCrUnpackerState pState, const char *psz, size_t *pcbVerified)
     121{
     122    size_t cchStr = 0;
     123    size_t cbChkMax = pState->cbUnpackDataLeft - ((const uint8_t *)psz - pState->pbUnpackData);
     124    void *pv = memchr((void *)psz, '\0', cbChkMax);
     125    if (!pv)
     126    {
     127        pState->rcUnpack = VERR_BUFFER_OVERFLOW;
     128        return SIZE_MAX;
     129    }
     130
     131    cchStr = (uint8_t *)pv - pState->pbUnpackData + 1;
     132    *pcbVerified = cchStr;
     133
     134    return cchStr;
     135}
     136
     137#define CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(a_pState, a_pszStr) crUnpackAcccessChkStrUpdate((a_pState), (a_pszStr), &int_cbAccessVerified);
     138
     139#define CHECK_STRING_FROM_PTR_UPDATE_NO_SZ(a_pState, a_pszStr) \
     140    do \
     141    { \
     142        size_t cchStr = crUnpackAcccessChkStrUpdate((a_pState), (a_pszStr), &int_cbAccessVerified); \
     143        if (RT_UNLIKELY(cchStr == SIZE_MAX)) \
     144            return; \
     145    } \
     146    while (0)
     147
     148/**
     149 * Reads data at the given offset of the given type from the supplied data buffer.
     150 */
     151#define READ_DATA(a_pState, offset, type ) *(const type *)crUnpackAccessChk((a_pState), int_cbAccessVerified, (offset), sizeof( type ))
    55152
    56153#ifdef CR_UNALIGNED_ACCESS_OKAY
    57 #define READ_DOUBLE( offset ) \
    58     READ_DATA( offset, GLdouble )
     154#define READ_DOUBLE(a_pState, offset ) READ_DATA(a_pState, offset, GLdouble )
    59155#else
    60 #define READ_DOUBLE( offset ) \
    61     crReadUnalignedDouble( cr_unpackData + (offset) )
    62 #endif
    63 
    64 #define READ_NETWORK_POINTER( offset ) \
    65     ( cr_unpackData + (offset) )
    66 
    67 /* XXX make this const */
    68 #define DATA_POINTER( offset, type ) \
    69     ( (type *) (cr_unpackData + (offset)) )
    70 
    71 #define DATA_POINTER_CHECK( offset ) \
    72     ( (cr_unpackDataEnd >= cr_unpackData) && (size_t)(cr_unpackDataEnd - cr_unpackData) >= (size_t)(offset) )
    73 
    74 #define INCR_DATA_PTR( delta ) \
    75     cr_unpackData += (delta)
    76 
    77 #define INCR_DATA_PTR_NO_ARGS() \
    78     INCR_DATA_PTR( 4 )
    79 
    80 #define INCR_VAR_PTR() \
    81     INCR_DATA_PTR( *((int *) cr_unpackData ) )
    82 
    83 #define SET_RETURN_PTR( offset ) do { \
    84         CRDBGPTR_CHECKZ(return_ptr); \
    85         if (!DATA_POINTER_CHECK(offset + sizeof(*return_ptr))) \
     156#define READ_DOUBLE(a_pState, offset ) crReadUnalignedDouble(crUnpackAccessChk((a_pState), int_cbAccessVerified, (offset), sizeof( GLdouble ) ))
     157#endif
     158
     159#define READ_NETWORK_POINTER(a_pState, offset ) (uint8_t *)crUnpackAccessChk((a_pState), int_cbAccessVerified, (offset), 0)
     160#define DATA_POINTER(a_pState, offset, type )   ((type *) (crUnpackAccessChk((a_pState), int_cbAccessVerified, (offset), 0)) )
     161
     162#define DATA_POINTER_CHECK(a_pState, offset )   ((offset) < (a_pState)->cbUnpackDataLeft)
     163
     164#define INCR_DATA_PTR(a_pState, delta ) \
     165    do \
     166    { \
     167        if (RT_UNLIKELY((a_pState)->cbUnpackDataLeft < (delta))) \
     168        { \
     169          (a_pState)->rcUnpack = VERR_BUFFER_OVERFLOW; \
     170          return; \
     171        } \
     172        (a_pState)->pbUnpackData     += (delta); \
     173        (a_pState)->cbUnpackDataLeft -= (delta); \
     174    } while(0)
     175
     176#define INCR_DATA_PTR_NO_ARGS(a_pState) INCR_DATA_PTR(a_pState, 4 )
     177
     178#define INCR_VAR_PTR(a_pState) INCR_DATA_PTR(a_pState, *((int *)(a_pState)->pbUnpackData) )
     179
     180#define SET_RETURN_PTR(a_pState, offset ) \
     181    do \
     182    { \
     183        CRDBGPTR_CHECKZ((a_pState)->pReturnPtr); \
     184        if (!DATA_POINTER_CHECK(a_pState, offset + sizeof(*(a_pState)->pReturnPtr))) \
    86185        { \
    87186             crError("%s: SET_RETURN_PTR(%u) offset out of bounds\n", __FUNCTION__, offset); \
    88187             return; \
    89188        } \
    90         crMemcpy( return_ptr, cr_unpackData + (offset), sizeof( *return_ptr ) ); \
    91     } while (0);
    92 
    93 
    94 #define SET_WRITEBACK_PTR( offset ) do { \
    95         CRDBGPTR_CHECKZ(writeback_ptr); \
    96         if (!DATA_POINTER_CHECK(offset + sizeof(*writeback_ptr))) \
    97         { \
    98              crError("%s: SET_WRITEBACK_PTR(%u) offset out of bounds\n", __FUNCTION__, offset); \
     189        crMemcpy((a_pState)->pReturnPtr, crUnpackAccessChk((a_pState), int_cbAccessVerified, (offset), sizeof( *(a_pState)->pReturnPtr )), sizeof( *(a_pState)->pReturnPtr ) ); \
     190    } while (0)
     191
     192#define SET_WRITEBACK_PTR(a_pState, offset ) \
     193    do \
     194    { \
     195        CRDBGPTR_CHECKZ((a_pState)->pWritebackPtr); \
     196        if (!DATA_POINTER_CHECK(a_pState, offset + sizeof(*(a_pState)->pWritebackPtr))) \
     197        { \
     198             crError("%s: SET_RETURN_PTR(%u) offset out of bounds\n", __FUNCTION__, offset); \
    99199             return; \
    100200        } \
    101         crMemcpy( writeback_ptr, cr_unpackData + (offset), sizeof( *writeback_ptr ) ); \
     201        crMemcpy((a_pState)->pWritebackPtr, crUnpackAccessChk((a_pState), int_cbAccessVerified, (offset), sizeof( *(a_pState)->pWritebackPtr )), sizeof( *(a_pState)->pWritebackPtr) ); \
    102202    } while (0);
    103203
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h

    r69474 r78190  
    7676#ifdef CR_OPENGL_VERSION_2_1
    7777# define CR_OPENGL_VERSION_STRING "2.1"
     78# define CR_OPENGL_VERSION_MAJOR  2
     79# define CR_OPENGL_VERSION_MINOR  1
    7880#elif defined(CR_OPENGL_VERSION_2_0)
    7981# define CR_OPENGL_VERSION_STRING "2.0"
     82# define CR_OPENGL_VERSION_MAJOR  2
     83# define CR_OPENGL_VERSION_MINOR  0
    8084#else
    8185# define CR_OPENGL_VERSION_STRING "1.5"
     86# define CR_OPENGL_VERSION_MAJOR  1
     87# define CR_OPENGL_VERSION_MINOR  5
    8288#endif
    8389
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_limits.h

    r69474 r78190  
    272272extern DECLEXPORT(void) crStateLimitsPrint(const CRLimitsState *limits);
    273273
    274 extern DECLEXPORT(GLfloat) crStateComputeVersion(float minVersion);
     274extern DECLEXPORT(void) crStateComputeVersion(uint32_t *puMajorMin, uint32_t *puMinorMin);
    275275
    276276extern DECLEXPORT(GLubyte *) crStateMergeExtensions(GLuint n, const GLubyte **extensions);
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_beginend.c

    r69392 r78190  
    3939}
    4040
    41 void PACK_APIENTRY crPackBeginSWAP( GLenum mode )
    42 {
    43     CR_GET_PACKER_CONTEXT(pc);
    44     unsigned char *data_ptr;
    45     (void) pc;
    46 #ifndef VBOX
    47     if (pc->buffer.canBarf)
    48     {
    49         if (!pc->buffer.holds_BeginEnd)
    50             pc->Flush( pc->flush_arg );
    51         pc->buffer.in_BeginEnd = 1;
    52         pc->buffer.holds_BeginEnd = 1;
    53     }
    54 #endif
    55     CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, 4, GL_FALSE);
    56     pc->current.begin_data = data_ptr;
    57     pc->current.begin_op = pc->buffer.opcode_current;
    58     pc->current.attribsUsedMask = 0;
    59     WRITE_DATA( 0, GLenum, SWAP32(mode) );
    60     WRITE_OPCODE( pc, CR_BEGIN_OPCODE );
    61     CR_UNLOCK_PACKER_CONTEXT(pc);
    62 }
    63 
    6441void PACK_APIENTRY crPackEnd( void )
    6542{
     
    7451}
    7552
    76 void PACK_APIENTRY crPackEndSWAP( void )
    77 {
    78     CR_GET_PACKER_CONTEXT(pc);
    79     unsigned char *data_ptr;
    80     (void) pc;
    81     CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
    82     WRITE_OPCODE( pc, CR_END_OPCODE );
    83     pc->buffer.in_BeginEnd = 0;
    84     CR_CMDBLOCK_END( pc, CRPACKBLOCKSTATE_OP_BEGIN );
    85     CR_UNLOCK_PACKER_CONTEXT(pc);
    86 }
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c

    r69392 r78190  
    2020        ui[0] = ((unsigned int *) &d)[0];
    2121        ui[1] = ((unsigned int *) &d)[1];
    22 }
    23 
    24 void crWriteSwappedDouble( void *buffer, double d )
    25 {
    26         unsigned int *ui = (unsigned int *) buffer;
    27         ui[0] = SWAP32(((unsigned int *) &d)[1]);
    28         ui[1] = SWAP32(((unsigned int *) &d)[0]);
    2922}
    3023
     
    375368        }
    376369
    377         if (pc->swapping)
    378                 crPackBoundsInfoCRSWAP( CR_PACKER_CONTEXT_ARG bounds, payload, length, num_opcodes );
    379         else
    380                 crPackBoundsInfoCR( CR_PACKER_CONTEXT_ARG bounds, payload, length, num_opcodes );
    381 
     370        crPackBoundsInfoCR( CR_PACKER_CONTEXT_ARG bounds, payload, length, num_opcodes );
    382371        pc->buffer.holds_BeginEnd |= src->holds_BeginEnd;
    383372        pc->buffer.in_BeginEnd = src->in_BeginEnd;
     
    462451         */
    463452
    464         if (pc->swapping)
    465         {
    466                 *((unsigned int *) data_ptr) = SWAP32(size);
    467                 crDebug( "Just swapped the length, putting %d on the wire!", *((unsigned int *) data_ptr));
    468         }
    469         else
    470         {
    471                 *((unsigned int *) data_ptr) = size;
    472         }
     453        *((unsigned int *) data_ptr) = size;
    473454#ifndef CHROMIUM_THREADSAFE
    474455        sanityCheckPointer = data_ptr + 4;
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_context.c

    r69392 r78190  
    5050}
    5151
    52 void PACK_APIENTRY
    53 crPackCreateContextSWAP( const char *dpyName, GLint visual, GLint shareCtx,
    54                          GLint *return_value, int *writeback )
    55 {
    56         char displayName[DISPLAY_NAME_LEN];
    57         CR_GET_PACKER_CONTEXT(pc);
    58         unsigned char *data_ptr;
    59         int len = DISPLAY_NAME_LEN + 32;
    60 
    61         /* clear the buffer, to silence valgrind */
    62         crMemZero(displayName, DISPLAY_NAME_LEN);
    63 
    64         if (dpyName) {
    65                 crStrncpy( displayName, dpyName, DISPLAY_NAME_LEN );
    66                 displayName[DISPLAY_NAME_LEN - 1] = 0;
    67         }
    68         else {
    69                 displayName[0] = 0;
    70         }
    71 
    72         CR_GET_BUFFERED_POINTER(pc, len);
    73         WRITE_DATA( 0, GLint, SWAP32(len) );
    74         WRITE_DATA( 4, GLenum, SWAP32(CR_CREATECONTEXT_EXTEND_OPCODE) );
    75         WRITE_BYTES( 8, displayName, DISPLAY_NAME_LEN );
    76         WRITE_DATA( DISPLAY_NAME_LEN + 8, GLenum, SWAP32(visual) );
    77         WRITE_DATA( DISPLAY_NAME_LEN + 12, GLenum, SWAP32(shareCtx) );
    78         WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 16, (void *) return_value );
    79         WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 24, (void *) writeback );
    80         WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    81         CR_CMDBLOCK_CHECK_FLUSH(pc);
    82     CR_UNLOCK_PACKER_CONTEXT(pc);
    83 }
    84 
    85 
    8652void PACK_APIENTRY crPackWindowCreate( const char *dpyName, GLint visBits, GLint *return_value, int *writeback )
    8753{
     
    11379}
    11480
    115 void PACK_APIENTRY crPackWindowCreateSWAP( const char *dpyName, GLint visBits, GLint *return_value, int *writeback )
    116 {
    117         char displayName[DISPLAY_NAME_LEN];
    118         CR_GET_PACKER_CONTEXT(pc);
    119         unsigned char *data_ptr;
    120 
    121         /* clear the buffer, to silence valgrind */
    122         crMemZero(displayName, DISPLAY_NAME_LEN);
    123 
    124         if (dpyName) {
    125                 crStrncpy( displayName, dpyName, DISPLAY_NAME_LEN );
    126                 displayName[DISPLAY_NAME_LEN - 1] = 0;
    127         }
    128         else {
    129                 displayName[0] = 0;
    130         }
    131 
    132         CR_GET_BUFFERED_POINTER(pc, DISPLAY_NAME_LEN + 28 );
    133         WRITE_DATA( 0, GLint, SWAP32(28) );
    134         WRITE_DATA( 4, GLenum, SWAP32(CR_WINDOWCREATE_EXTEND_OPCODE) );
    135         WRITE_BYTES( 8, displayName, DISPLAY_NAME_LEN );
    136         WRITE_DATA( DISPLAY_NAME_LEN + 8, GLint, SWAP32(visBits) );
    137         WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 12, (void *) return_value );
    138         WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 20, (void *) writeback );
    139         WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    140         CR_CMDBLOCK_CHECK_FLUSH(pc);
    141     CR_UNLOCK_PACKER_CONTEXT(pc);
    142 }
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_error.c

    r69392 r78190  
    77
    88#include "cr_error.h"
    9 #include "cr_environment.h"
    109#include "cr_pack.h"
    1110#include "packer.h"
     11
     12#include <iprt/env.h>
    1213
    1314
     
    3233        pc->Error( line, file, error, info );
    3334
    34     if (crGetenv("CR_DEBUG"))
     35    if (RTEnvExist("CR_DEBUG"))
    3536    {
    3637        char *glerr;
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_feedback.c

    r69392 r78190  
    1818}
    1919
    20 void PACK_APIENTRY crPackFeedbackBufferSWAP( GLsizei size, GLenum type, GLfloat *buffer )
    21 {
    22     (void) size;
    23     (void) type;
    24     (void) buffer;
    25 
    26     crWarning("Packer wont pass FeedbackBuffer()\n");
    27     crWarning("Try using the feedbackspu\n");
    28 }
    29 
    3020void PACK_APIENTRY crPackSelectBuffer( GLsizei size, GLuint *buffer )
    3121{
     
    3727}
    3828
    39 void PACK_APIENTRY crPackSelectBufferSWAP( GLsizei size, GLuint *buffer )
    40 {
    41     (void) size;
    42     (void) buffer;
    43 
    44     crWarning("Packer wont pass SelectBuffer()\n");
    45     crWarning("Try using the feedbackspu\n");
    46 }
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_fence.c

    r69392 r78190  
    2424}
    2525
    26 void PACK_APIENTRY crPackDeleteFencesNVSWAP( GLsizei n, const GLuint *fences )
    27 {
    28     unsigned char *data_ptr;
    29     int i;
    30     int packet_length = sizeof(GLenum) + sizeof(n) + n * sizeof(*fences);
    31 
    32     if( !fences )
    33         return;
    34 
    35     data_ptr = (unsigned char *) crPackAlloc( packet_length );
    36     WRITE_DATA(0, GLenum, CR_DELETEFENCESNV_EXTEND_OPCODE);
    37     WRITE_DATA(4, GLsizei, n);
    38     for (i = 0 ; i < n ; i++)
    39     {
    40         WRITE_DATA(i*sizeof(GLuint) + 8, GLuint, SWAP32(fences[i]));
    41     }
    42     crHugePacket(CR_EXTEND_OPCODE, data_ptr);
    43     crPackFree(data_ptr);
    44 }
    45 
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_framebuffer.c

    r76553 r78190  
    5555}
    5656
    57 void PACK_APIENTRY
    58 crPackDeleteRenderbuffersEXTSWAP(GLsizei n, const GLuint * renderbuffers)
    59 {
    60     (void) n;
    61     (void) renderbuffers;
    62     crError ("No swap version");
    63 }
    64 
    65 void PACK_APIENTRY
    66 crPackDeleteFramebuffersEXTSWAP(GLsizei n, const GLuint * framebuffers)
    67 {
    68     (void) n;
    69     (void) framebuffers;
    70     crError ("No swap version");
    71 }
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_header.py

    r69392 r78190  
    6262
    6363                print('void PACK_APIENTRY crPack%s(%s);' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args)))
    64                 print('void PACK_APIENTRY crPack%sSWAP(%s);' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', args)))
    6564
    6665
     
    7978                print('void PACK_APIENTRY crPack%sBBOX(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
    8079                print('void PACK_APIENTRY crPack%sBBOX_COUNT(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
    81                 print('void PACK_APIENTRY crPack%sBBOXSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
    82                 print('void PACK_APIENTRY crPack%sBBOX_COUNTSWAP(%s);' % (func_name, apiutil.MakeDeclarationString(args)))
    8380
    8481
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c

    r69392 r78190  
    2020uint32_t cr_packer_cmd_blocks_enabled = 0;
    2121
    22 CRPackContext *crPackNewContext( int swapping )
     22CRPackContext *crPackNewContext(void)
    2323{
    2424#ifdef CHROMIUM_THREADSAFE
     
    3232#endif
    3333    pc->u32CmdBlockState = 0;
    34     pc->swapping = swapping;
    3534    pc->Flush = NULL;
    3635    pc->SendHuge = NULL;
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c

    r76553 r78190  
    634634}
    635635
    636 void PACK_APIENTRY crPackBindAttribLocationSWAP(GLuint program, GLuint index, const char *name)
    637 {
    638     CR_GET_PACKER_CONTEXT(pc);
    639     (void)program;
    640     (void)index;
    641     (void)name;
    642     (void)pc;
    643     crError ("No swap version");
    644 }
    645 
    646 void PACK_APIENTRY crPackShaderSourceSWAP(GLuint shader, GLsizei count, const char **string, const GLint *length)
    647 {
    648     CR_GET_PACKER_CONTEXT(pc);
    649     (void)shader;
    650     (void)count;
    651     (void)string;
    652     (void)length;
    653     (void)pc;
    654     crError ("No swap version");
    655 }
    656 
    657 void PACK_APIENTRY crPackUniform1fvSWAP(GLint location, GLsizei count, const GLfloat *value)
    658 {
    659     CR_GET_PACKER_CONTEXT(pc);
    660     (void)location;
    661     (void)count;
    662     (void)value;
    663     (void)pc;
    664     crError ("No swap version");
    665 }
    666 
    667 
    668 void PACK_APIENTRY crPackUniform1ivSWAP(GLint location, GLsizei count, const GLint *value)
    669 {
    670     CR_GET_PACKER_CONTEXT(pc);
    671     (void)location;
    672     (void)count;
    673     (void)value;
    674     (void)pc;
    675     crError ("No swap version");
    676 }
    677 
    678 void PACK_APIENTRY crPackUniform2fvSWAP(GLint location, GLsizei count, const GLfloat *value)
    679 {
    680     CR_GET_PACKER_CONTEXT(pc);
    681     (void)location;
    682     (void)count;
    683     (void)value;
    684     (void)pc;
    685     crError ("No swap version");
    686 }
    687 
    688 void PACK_APIENTRY crPackUniform2ivSWAP(GLint location, GLsizei count, const GLint * value)
    689 {
    690     CR_GET_PACKER_CONTEXT(pc);
    691     (void)location;
    692     (void)count;
    693     (void)value;
    694     (void)pc;
    695     crError ("No swap version");
    696 }
    697 
    698 void PACK_APIENTRY crPackUniform3fvSWAP(GLint location, GLsizei count, const GLfloat *value)
    699 {
    700     CR_GET_PACKER_CONTEXT(pc);
    701     (void)location;
    702     (void)count;
    703     (void)value;
    704     (void)pc;
    705     crError ("No swap version");
    706 }
    707 
    708 void PACK_APIENTRY crPackUniform3ivSWAP(GLint location, GLsizei count, const GLint *value)
    709 {
    710     CR_GET_PACKER_CONTEXT(pc);
    711     (void)location;
    712     (void)count;
    713     (void)value;
    714     (void)pc;
    715     crError ("No swap version");
    716 }
    717 
    718 void PACK_APIENTRY crPackUniform4fvSWAP(GLint location, GLsizei count, const GLfloat *value)
    719 {
    720     CR_GET_PACKER_CONTEXT(pc);
    721     (void)location;
    722     (void)count;
    723     (void)value;
    724     (void)pc;
    725     crError ("No swap version");
    726 }
    727 
    728 void PACK_APIENTRY crPackUniform4ivSWAP(GLint location, GLsizei count, const GLint *value)
    729 {
    730     CR_GET_PACKER_CONTEXT(pc);
    731     (void)location;
    732     (void)count;
    733     (void)value;
    734     (void)pc;
    735     crError ("No swap version");
    736 }
    737 
    738 void PACK_APIENTRY crPackUniformMatrix2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    739 {
    740     CR_GET_PACKER_CONTEXT(pc);
    741     (void)location;
    742     (void)count;
    743     (void)transpose;
    744     (void)value;
    745     (void)pc;
    746     crError ("No swap version");
    747 }
    748 
    749 void PACK_APIENTRY crPackUniformMatrix3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    750 {
    751     CR_GET_PACKER_CONTEXT(pc);
    752     (void)location;
    753     (void)count;
    754     (void)transpose;
    755     (void)value;
    756     (void)pc;
    757     crError ("No swap version");
    758 }
    759 
    760 void PACK_APIENTRY crPackUniformMatrix4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    761 {
    762     CR_GET_PACKER_CONTEXT(pc);
    763     (void)location;
    764     (void)count;
    765     (void)transpose;
    766     (void)value;
    767     (void)pc;
    768     crError ("No swap version");
    769 }
    770 
    771 void PACK_APIENTRY crPackUniformMatrix2x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    772 {
    773     CR_GET_PACKER_CONTEXT(pc);
    774     (void)location;
    775     (void)count;
    776     (void)transpose;
    777     (void)value;
    778     (void)pc;
    779     crError ("No swap version");
    780 }
    781 
    782 void PACK_APIENTRY crPackUniformMatrix3x2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    783 {
    784     CR_GET_PACKER_CONTEXT(pc);
    785     (void)location;
    786     (void)count;
    787     (void)transpose;
    788     (void)value;
    789     (void)pc;
    790     crError ("No swap version");
    791 }
    792 
    793 void PACK_APIENTRY crPackUniformMatrix2x4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    794 {
    795     CR_GET_PACKER_CONTEXT(pc);
    796     (void)location;
    797     (void)count;
    798     (void)transpose;
    799     (void)value;
    800     (void)pc;
    801     crError ("No swap version");
    802 }
    803 
    804 void PACK_APIENTRY crPackUniformMatrix4x2fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    805 {
    806     CR_GET_PACKER_CONTEXT(pc);
    807     (void)location;
    808     (void)count;
    809     (void)transpose;
    810     (void)value;
    811     (void)pc;
    812     crError ("No swap version");
    813 }
    814 
    815 void PACK_APIENTRY crPackUniformMatrix3x4fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    816 {
    817     CR_GET_PACKER_CONTEXT(pc);
    818     (void)location;
    819     (void)count;
    820     (void)transpose;
    821     (void)value;
    822     (void)pc;
    823     crError ("No swap version");
    824 }
    825 
    826 void PACK_APIENTRY crPackUniformMatrix4x3fvSWAP(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
    827 {
    828     CR_GET_PACKER_CONTEXT(pc);
    829     (void)location;
    830     (void)count;
    831     (void)transpose;
    832     (void)value;
    833     (void)pc;
    834     crError ("No swap version");
    835 }
    836 
    837 void PACK_APIENTRY crPackDrawBuffersSWAP(GLsizei n, const GLenum *bufs)
    838 {
    839     CR_GET_PACKER_CONTEXT(pc);
    840     (void)n;
    841     (void)bufs;
    842     (void)pc;
    843     crError ("No swap version");
    844 }
    845 
    846 void PACK_APIENTRY crPackGetAttribLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback)
    847 {
    848     CR_GET_PACKER_CONTEXT(pc);
    849     (void)program;
    850     (void)name;
    851     (void)return_value;
    852     (void)writeback;
    853     (void)pc;
    854     crError ("No swap version");
    855 }
    856 
    857 void PACK_APIENTRY crPackGetUniformLocationSWAP(GLuint program, const char * name, GLint * return_value, int * writeback)
    858 {
    859     CR_GET_PACKER_CONTEXT(pc);
    860     (void)program;
    861     (void)name;
    862     (void)return_value;
    863     (void)writeback;
    864     (void)pc;
    865     crError ("No swap version");
    866 }
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c

    r76553 r78190  
    5151}
    5252
    53 void PACK_APIENTRY crPackWindowVisibleRegionSWAP( CR_PACKER_CONTEXT_ARGDECL  GLint window, GLint cRects, const GLint * pRects )
    54 {
    55     RT_NOREF3(window, cRects, pRects); CR_PACKER_CONTEXT_ARG_NOREF();
    56     crError( "crPackWindowVisibleRegionSWAP unimplemented and shouldn't be called" );
    57 }
    58 
  • trunk/src/VBox/GuestHost/OpenGL/packer/packer.py

    r69392 r78190  
    1313
    1414
    15 def WriteData( offset, arg_type, arg_name, is_swapped ):
     15def WriteData( offset, arg_type, arg_name ):
    1616    """Return a string to write a variable to the packing buffer."""
    1717    retval = 9
     
    1919        retval = "\tWRITE_NETWORK_POINTER(%d, (void *) %s);" % (offset, arg_name )
    2020    else:   
    21         if is_swapped:
    22             if arg_type == "GLfloat" or arg_type == "GLclampf":
    23                 retval = "\tWRITE_DATA(%d, GLuint, SWAPFLOAT(%s));" % (offset, arg_name)
    24             elif arg_type == "GLdouble" or arg_type == "GLclampd":
    25                 retval = "\tWRITE_SWAPPED_DOUBLE(%d, %s);" % (offset, arg_name)
    26             elif apiutil.sizeof(arg_type) == 1:
    27                 retval = "\tWRITE_DATA(%d, %s, %s);" % (offset, arg_type, arg_name)
    28             elif apiutil.sizeof(arg_type) == 2:
    29                 retval = "\tWRITE_DATA(%d, %s, SWAP16(%s));" % (offset, arg_type, arg_name)
    30             elif apiutil.sizeof(arg_type) == 4:
    31                 retval = "\tWRITE_DATA(%d, %s, SWAP32(%s));" % (offset, arg_type, arg_name)
     21        if arg_type == "GLdouble" or arg_type == "GLclampd":
     22            retval = "\tWRITE_DOUBLE(%d, %s);" % (offset, arg_name)
    3223        else:
    33             if arg_type == "GLdouble" or arg_type == "GLclampd":
    34                 retval = "\tWRITE_DOUBLE(%d, %s);" % (offset, arg_name)
    35             else:
    36                 retval = "\tWRITE_DATA(%d, %s, %s);" % (offset, arg_type, arg_name)
     24            retval = "\tWRITE_DATA(%d, %s, %s);" % (offset, arg_type, arg_name)
    3725    if retval == 9:
    3826        print >>sys.stderr, "no retval for %s %s" % (arg_name, arg_type)
     
    113101
    114102
    115 def PrintFunc( func_name, params, is_swapped, can_have_pointers ):
     103def PrintFunc( func_name, params, can_have_pointers ):
    116104    """Emit a packer function."""
    117     if is_swapped:
    118         print('void PACK_APIENTRY crPack%sSWAP(%s)' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params)))
    119     else:
    120         print('void PACK_APIENTRY crPack%s(%s)' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params)))
     105    print('void PACK_APIENTRY crPack%s(%s)' % (func_name, apiutil.MakeDeclarationStringWithContext('CR_PACKER_CONTEXT', params)))
    121106    print('{')
    122107    print('\tCR_GET_PACKER_CONTEXT(pc);')
     
    184169    if is_extended:
    185170        counter = 8
    186         print(WriteData( 0, 'GLint', packet_length, is_swapped ))
    187         print(WriteData( 4, 'GLenum', apiutil.ExtendedOpcodeName( func_name ), is_swapped ))
     171        print(WriteData( 0, 'GLint', packet_length ))
     172        print(WriteData( 4, 'GLenum', apiutil.ExtendedOpcodeName( func_name )))
    188173    else:
    189174        counter = 0
     
    197182            for i in range(0, vecSize):
    198183                print(WriteData( counter + i * apiutil.sizeof(ptrType),
    199                                  ptrType, "%s[%d]" % (name, i), is_swapped ))
     184                                 ptrType, "%s[%d]" % (name, i)))
    200185            # XXX increment counter here?
    201186        else:
    202             print(WriteData( counter, type, name, is_swapped ))
     187            print(WriteData( counter, type, name))
    203188            if apiutil.IsPointer(type):
    204189                counter += apiutil.PointerSize()
     
    267252        print('#ifndef IN_RING0')
    268253       
    269     PrintFunc( func_name, params, 0, pointers_ok )
    270     PrintFunc( func_name, params, 1, pointers_ok )
    271    
     254    PrintFunc( func_name, params, pointers_ok )
     255
    272256    if not func_name in r0_funcs:
    273257        print('#endif')
  • trunk/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py

    r69392 r78190  
    6666""")
    6767
    68 def WriteData( offset, arg_type, arg_name, is_swapped ):
     68def WriteData( offset, arg_type, arg_name ):
    6969        if arg_type.find('*') != -1:
    7070                retval = "\tWRITE_NETWORK_POINTER(%d, (void *) %s);" % (offset, arg_name )
    7171        else:   
    72                 if is_swapped:
    73                         if arg_type == "GLfloat" or arg_type == "GLclampf":
    74                                 retval = "\tWRITE_DATA(%d, GLuint, SWAPFLOAT(%s));" % (offset, arg_name)
    75                         elif arg_type == "GLdouble" or arg_type == "GLclampd":
    76                                 retval = "\tWRITE_SWAPPED_DOUBLE(%d, %s);" % (offset, arg_name)
    77                         elif apiutil.sizeof(arg_type) == 1:
    78                                 retval = "\tWRITE_DATA(%d, %s, %s);" % (offset, arg_type, arg_name)
    79                         elif apiutil.sizeof(arg_type) == 2:
    80                                 retval = "\tWRITE_DATA(%d, %s, SWAP16(%s));" % (offset, arg_type, arg_name)
    81                         elif apiutil.sizeof(arg_type) == 4:
    82                                 retval = "\tWRITE_DATA(%d, %s, SWAP32(%s));" % (offset, arg_type, arg_name)
    83                 else:
    84                         if arg_type == "GLdouble" or arg_type == "GLclampd":
    85                                 retval = "\tWRITE_DOUBLE(%d, %s);" % (offset, arg_name)
    86                         else:
    87                                 retval = "\tWRITE_DATA(%d, %s, %s);" % (offset, arg_type, arg_name)
     72                if arg_type == "GLdouble" or arg_type == "GLclampd":
     73                        retval = "\tWRITE_DOUBLE(%d, %s);" % (offset, arg_name)
     74                else:
     75                        retval = "\tWRITE_DATA(%d, %s, %s);" % (offset, arg_type, arg_name)
    8876        return retval
    8977
    9078
    9179def PrintFunction( func_name, extSuffix, num_coords, argtype,
    92                                    do_swapped, do_count, do_vector ):
     80                                   do_count, do_vector ):
    9381        """
    9482        Generate all the functions named crPackVertex[234][dfis][v]BBOX() and
     
    10290        else:
    10391                countSuffix = ""
    104 
    105         if do_swapped:
    106                 swapSuffix = "SWAP"
    107         else:
    108                 swapSuffix = ""
    10992
    11093        if func_name[0:12] == "VertexAttrib":
     
    146129        params = apiutil.Parameters(func_name + extSuffix)
    147130
    148         print('void PACK_APIENTRY crPack%sBBOX%s%s(%s)' % (func_name + extSuffix, countSuffix,
    149                          swapSuffix, apiutil.MakeDeclarationString(params)))
     131        print('void PACK_APIENTRY crPack%sBBOX%s(%s)' % (func_name + extSuffix, countSuffix,
     132                         apiutil.MakeDeclarationString(params)))
    150133        print('{')
    151134
     
    229212        if do_vector:
    230213                if isVertexAttrib:
    231                         if do_swapped:
    232                                 print("\tWRITE_DATA(0, GLuint, SWAP32(index));")
    233                         else:
    234                                 print("\tWRITE_DATA(0, GLuint, index);")
     214                        print("\tWRITE_DATA(0, GLuint, index);")
    235215                        counter += 4
    236216                        argname = params[1][0]  # skip 'index' parameter
     
    239219
    240220                for index in range(num_coords):
    241                         print(WriteData( counter, vector_type, "%s[%d]" % (argname, index), do_swapped ))
     221                        print(WriteData( counter, vector_type, "%s[%d]" % (argname, index)))
    242222                        counter += apiutil.sizeof(vector_type)
    243223
     
    253233                for index in range(0,len(params)):
    254234                        (name, type, vecSize) = params[index]
    255                         print(WriteData( counter, type, name, do_swapped ))
     235                        print(WriteData( counter, type, name))
    256236                        counter += apiutil.sizeof(type)
    257237
     
    272252        for argtype in ['d', 'f', 'i', 's']:
    273253                func_name = 'Vertex%d%s' % (num_coords, argtype)
    274                 for swap in range(0, 2):
    275                         for count in range(0, 2):
    276                                 for vec in range(0, 2):
    277                                         PrintFunction( func_name, "", num_coords, argtype, swap,
    278                                                                    count, vec )
     254                for count in range(0, 2):
     255                        for vec in range(0, 2):
     256                                PrintFunction( func_name, "", num_coords, argtype,
     257                                                           count, vec )
    279258
    280259for num_coords in [1,2,3,4]:
    281260        for argtype in ['d', 'f', 's']:
    282261                func_name = 'VertexAttrib%d%s' % (num_coords, argtype)
    283                 for swap in range(0, 2):
    284                         for count in range(0, 2):
    285                                 for vec in range(0, 2):
    286                                         PrintFunction( func_name, "ARB", num_coords, argtype, swap,
    287                                                                    count, vec )
     262                for count in range(0, 2):
     263                        for vec in range(0, 2):
     264                                PrintFunction( func_name, "ARB", num_coords, argtype,
     265                                                           count, vec )
    288266
    289267# Special vector functions
     
    303281        vec = 2  # special, hacked value
    304282        num_coords = 4
    305         for swap in range(0, 2):
    306                 for count in range(0, 2):
    307                         PrintFunction( func_name, "ARB", num_coords, argtype, swap, count, vec )
     283        for count in range(0, 2):
     284                PrintFunction( func_name, "ARB", num_coords, argtype, count, vec )
    308285
    309286# Special non-vector functions
     
    312289        vec = 0
    313290        num_coords = 4
    314         for swap in range(0, 2):
    315                 for count in range(0, 2):
    316                         PrintFunction( func_name, "ARB", num_coords, argtype, swap, count, vec )
     291        for count in range(0, 2):
     292                PrintFunction( func_name, "ARB", num_coords, argtype, count, vec )
     293
  • trunk/src/VBox/GuestHost/OpenGL/packer/packer_defs.py

    r69392 r78190  
    2121        if apiutil.CanPack(func_name):
    2222                print "crPack%s" % func_name
    23                 print "crPack%sSWAP" % func_name
    2423
    2524functions = [
     
    171170for func_name in functions:
    172171    print "%s" % func_name
    173     print "%sSWAP" % func_name
    174172
    175173
  • trunk/src/VBox/GuestHost/OpenGL/spu_loader/glloader.py

    r69392 r78190  
    2121#include "cr_string.h"
    2222#include "cr_error.h"
    23 #include "cr_environment.h"
     23
     24#include <iprt/env.h>
    2425
    2526#include <stdio.h>
     
    3637#define SYSTEM_GL "libGL.dylib"
    3738#define SYSTEM_CGL "OpenGL"
    38 # ifndef VBOX_WITH_COCOA_QT
    39 #  define SYSTEM_AGL "AGL"
    40 # endif
    4139#include <string.h> /* VBOX */
    4240#elif defined(IRIX) || defined(IRIX64) || defined(Linux) || defined(FreeBSD) || defined(AIX) || defined(SunOS) || defined(OSF1)
     
    5957#define SYSTEM_CGL_DIR  "/System/Library/Frameworks/OpenGL.framework"
    6058static CRDLL *cglDll = NULL;
    61 # ifndef VBOX_WITH_COCOA_QT
    62 #  define SYSTEM_AGL_DIR  "/System/Library/Frameworks/AGL.framework"
    63 static CRDLL *aglDll = NULL;
    64 # endif
    6559#endif
    6660
     
    263257        crDLLClose( cglDll );
    264258        cglDll = NULL;
    265 
    266 # ifndef VBOX_WITH_COCOA_QT
    267         crDLLClose( aglDll );
    268         aglDll = NULL;
    269 # endif
    270259#endif
    271260}
     
    294283        int i;
    295284
    296         const char *env_syspath = crGetenv( "CR_SYSTEM_GL_PATH" );
    297 #ifdef DARWIN
    298         const char *env_cgl_syspath = crGetenv( "CR_SYSTEM_CGL_PATH" );
    299 # ifndef VBOX_WITH_COCOA_QT
    300         const char *env_agl_syspath = crGetenv( "CR_SYSTEM_AGL_PATH" );
    301 # endif
     285        const char *env_syspath = RTEnvGet( "CR_SYSTEM_GL_PATH" );
     286#ifdef DARWIN
     287        const char *env_cgl_syspath = RTEnvGet( "CR_SYSTEM_CGL_PATH" );
    302288#endif
    303289
     
    326312
    327313        crDebug( "Found it in %s.", !env_cgl_syspath ? "default path" : env_cgl_syspath );
    328 
    329 # ifndef VBOX_WITH_COCOA_QT
    330         crDebug( "Looking for the system's AGL library..." );
    331         aglDll = __findSystemGL( env_agl_syspath, SYSTEM_AGL_DIR, SYSTEM_AGL );
    332         if (!aglDll)
    333         {
    334                 crError("Unable to find system AGL!");
    335                 return 0;
    336         }
    337 
    338         crDebug( "Found it in %s.", !env_agl_syspath ? "default path" : env_agl_syspath );
    339 # endif
    340314#endif
    341315""")
     
    466440
    467441print('#elif defined(DARWIN)')
    468 print('# ifndef VBOX_WITH_COCOA_QT')
    469 for fun in useful_agl_functions:
    470         print('\tinterface->%s = (%sFunc_t) crDLLGetNoError(aglDll, "%s");' % (fun,fun,fun))
    471 print('# endif')
    472 
    473442for fun in useful_cgl_functions:
    474443        print('\tinterface->%s = (%sFunc_t) crDLLGetNoError(cglDll, "%s");' % (fun, fun,fun))
     
    580549        static CRDLL *osMesaDll = NULL;
    581550
    582         const char *env_syspath = crGetenv( "CR_SYSTEM_GL_PATH" );
     551        const char *env_syspath = RTEnvGet( "CR_SYSTEM_GL_PATH" );
    583552
    584553        crDebug( "Looking for the system's OSMesa library..." );
  • trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuinit.c

    r69392 r78190  
    2828}
    2929
    30 #if 0 /* unused */
    31 
    32 static int validate_int( const char *response,
    33              const char *min,
    34              const char *max )
    35 {
    36     int i, imin, imax;   
    37     if (sscanf(response, "%d", &i) != 1)
    38         return 0;
    39     if (min && sscanf(min, "%d", &imin) == 1 && imin > i)
    40         return 0;
    41     if (max && sscanf(max, "%d", &imax) == 1 && imax < i)
    42         return 0;
    43     return 1;
    44 }
    45 
    46 static int validate_float( const char *response,
    47              const char *min,
    48              const char *max )
    49 {
    50     float f, fmin, fmax;
    51     if (sscanf(response, "%f", &f) != 1)
    52         return 0;
    53     if (min && sscanf(min, "%f", &fmin) == 1 && fmin > f)
    54         return 0;
    55     if (max && sscanf(max, "%f", &fmax) == 1 && fmax < f)
    56         return 0;
    57     return 1;
    58 }
    59 
    60 static int validate_one_option( const SPUOptions *opt,
    61                 const char *response,
    62                 const char *min,
    63                 const char *max )
    64 {
    65     switch (opt->type) {
    66     case CR_BOOL:
    67         return validate_int( response, "0", "1" );
    68     case CR_INT:
    69         return validate_int( response, min, max );
    70     case CR_FLOAT:
    71         return validate_float( response, min, max );
    72     case CR_ENUM:
    73         /* Make sure response string is present in the min string.
    74          * For enums, the min string is a comma-separated list of valid values.
    75          */
    76         CRASSERT(opt->numValues == 1); /* an enum limitation for now */
    77         {
    78             const char *p = crStrstr(min, response);
    79             if (!p)
    80                 return 0;  /* invalid value! */
    81             if (p[-1] != '\'')
    82                 return 0;  /* right substring */
    83             if (p[crStrlen(response)] != '\'')
    84                 return 0;  /* left substring */
    85             return 1;
    86         }
    87     default:
    88         return 0;
    89     }
    90 }
    91 
    92 
    93 /**
    94  * Make sure the response matches the opt's parameters (right number
    95  * and type of values, etc.)
    96  * Return 1 if OK, 0 if error.
    97  */
    98 static int validate_option( const SPUOptions *opt, const char *response )
    99 {
    100     const char *min = opt->min;
    101     const char *max = opt->max;
    102     int i = 0;
    103     int retval;
    104 
    105     if (opt->type == CR_STRING)
    106         return 1;
    107    
    108     CRASSERT(opt->numValues > 0);
    109 
    110     /* skip leading [ for multi-value options */
    111     if (opt->numValues > 1) {
    112         /* multi-valued options must be enclosed in brackets */
    113         if (*response != '[')
    114             return 0;
    115         response++; /* skip [ */
    116         /* make sure min and max are bracketed as well */
    117         if (min) {
    118             CRASSERT(*min == '[');  /* error in <foo>spu_config.c code!!! */
    119             min++;
    120         }
    121         if (max) {
    122             CRASSERT(*max == '[');  /* error in <foo>spu_config.c code!!! */
    123             max++;
    124         }
    125     }
    126 
    127     for (;;)
    128     {
    129         if (!validate_one_option( opt, response, min, max ))
    130         {
    131             retval = 0;
    132             break;
    133         }
    134         if (++i == opt->numValues)
    135         {
    136             retval = 1; /* all done! */
    137             break;
    138         }
    139         /* advance pointers to next item */
    140         if (min)
    141         {
    142             while (*min != ' ' && *min)
    143                 min++;
    144             while (*min == ' ')
    145                 min++;
    146         }
    147         if (max)
    148         {
    149             while (*max != ' ' && *max)
    150                 max++;
    151             while (*max == ' ')
    152                 max++;
    153         }
    154         if (response)
    155         {
    156             while (*response != ' ' && *response)
    157                 response++;
    158             while (*response == ' ')
    159                 response++;
    160         }
    161     }
    162 
    163     return retval;
    164 }
    165 
    166 #endif /* unused */
    167 
    168 /** Use the default values for all the options:
    169  */
    170 void crSPUSetDefaultParams( void *spu, SPUOptions *options )
    171 {
    172     int i;
    173    
    174     for (i = 0 ; options[i].option ; i++)
    175     {
    176         SPUOptions *opt = &options[i];
    177         opt->cb( spu, opt->deflt );
    178     }
    179 }
    180 
    181 
    182 /**
    183  * Find the index of the given enum value in the SPUOption's list of
    184  * possible enum values.
    185  * Return the enum index, or -1 if not found.
    186  */
    187 int crSPUGetEnumIndex( const SPUOptions *options, const char *optName, const char *value )
    188 {
    189     const SPUOptions *opt;
    190     const int valueLen = crStrlen(value);
    191 
    192     /* first, find the right option */
    193     for (opt = options; opt->option; opt++) {
    194         if (crStrcmp(opt->option, optName) == 0) {
    195             char **values;
    196             int i;
    197 
    198             CRASSERT(opt->type == CR_ENUM);
    199 
    200             /* break into array of strings */
    201             /* min string should be of form "'enum1', 'enum2', 'enum3', etc" */
    202             values = crStrSplit(opt->min, ",");
    203 
    204             /* search the array */
    205             for (i = 0; values[i]; i++) {
    206                 /* find leading quote */
    207                 const char *e = crStrchr(values[i], '\'');
    208                 CRASSERT(e);
    209                 if (e) {
    210                     /* test for match */
    211                     if (crStrncmp(value, e + 1, valueLen) == 0 &&   e[valueLen + 1] == '\'') {
    212                         crFreeStrings(values);
    213                         return i;
    214                     }
    215                 }
    216             }
    217 
    218             /* enum value not found! */
    219             crFreeStrings(values);
    220             return -1;
    221         }
    222     }
    223 
    224     return -1;
    225 }
  • trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuload.c

    r69392 r78190  
    66
    77#include "cr_mem.h"
    8 #include "cr_environment.h"
    98#include "cr_string.h"
    109#include "cr_dll.h"
     
    120119                                   &(the_spu->init), &(the_spu->self),
    121120                                   &(the_spu->cleanup),
    122                                    &(the_spu->options),
    123121                                   &(the_spu->spu_flags)) )
    124122        {
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump.cpp

    r76553 r78190  
    2020#include "cr_error.h"
    2121#include "cr_net.h"
    22 #include "cr_rand.h"
    2322#include "cr_mem.h"
    2423#include "cr_string.h"
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py

    r63939 r78190  
    4040#include "cr_error.h"
    4141#include "cr_net.h"
    42 #include "cr_rand.h"
    4342#include "cr_mem.h"
    4443#include "cr_string.h"
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_error.c

    r69392 r78190  
    99#include "state.h"
    1010#include "cr_error.h"
    11 #include "cr_environment.h"
    1211#include <stdarg.h>
    1312#include <stdio.h>
     13
     14#include <iprt/env.h>
    1415
    1516void crStateError( int line, const char *file, GLenum error, const char *format, ... )
     
    2526
    2627#ifndef DEBUG_misha
    27         if (crGetenv("CR_DEBUG"))
     28        if (RTEnvExist("CR_DEBUG"))
    2829#endif
    2930        {
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c

    r76553 r78190  
    2323#include "cr_mem.h"
    2424#include "cr_string.h"
     25
     26#include <stdio.h> /*sprintf*/
    2527
    2628static CRGLSLShader* crStateGetShaderObj(GLuint id)
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_limits.c

    r69392 r78190  
    174174 * compute the version number supported by Chromium.
    175175 */
    176 GLfloat crStateComputeVersion(float minVersion)
    177 {
    178         const GLfloat crVersion = crStrToFloat(CR_OPENGL_VERSION_STRING);
    179         if (crVersion < minVersion)
    180                 minVersion = crVersion;
    181         return minVersion;
     176void crStateComputeVersion(uint32_t *puMajorMin, uint32_t *puMinorMin)
     177{
     178        if (*puMajorMin > CR_OPENGL_VERSION_MAJOR)
     179        {
     180                *puMajorMin = CR_OPENGL_VERSION_MAJOR;
     181                *puMinorMin = CR_OPENGL_VERSION_MINOR;
     182                return;
     183        }
     184
     185        if (*puMinorMin > CR_OPENGL_VERSION_MINOR)
     186                *puMinorMin = CR_OPENGL_VERSION_MINOR;
     187
     188        return;
    182189}
    183190
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_occlude.c

    r76802 r78190  
    1010#include "state_internals.h"
    1111#include "cr_mem.h"
    12 
    13 #if !defined(IN_GUEST)
    14 #include "cr_unpack.h"
    15 #endif
    1612
    1713void
     
    6359                return;
    6460        }
    65 
    66     if (n <= 0 || n >= (GLsizei)(INT32_MAX / sizeof(GLuint)))
    67     {
    68         crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
    69                      "glDeleteQueriesARB: parameter 'n' is out of range");
    70         return;
    71     }
    72 
    73 #if !defined(IN_GUEST)
    74     if (!DATA_POINTER_CHECK(n * sizeof(GLuint)))
    75     {
    76         crError("glDeleteQueriesARB: parameter 'n' is out of range");
    77         return;
    78     }
    79 #endif
    8061
    8162    for (i = 0; i < n; i++) {
  • trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp

    r78116 r78190  
    3434# include "cr_error.h"
    3535# include "cr_net.h"
    36 # include "cr_rand.h"
    3736# include "cr_mem.h"
    3837# include "cr_string.h"
  • trunk/src/VBox/GuestHost/OpenGL/util/error.c

    r76553 r78190  
    2525#include <iprt/buildconfig.h>
    2626
     27
    2728#include <VBox/log.h>
     29#include <iprt/env.h>
    2830
    2931#ifdef RT_OS_WINDOWS
    3032# include <iprt/win/windows.h>
    31 # include "cr_environment.h"
    3233# include "cr_error.h"
    3334# include "VBox/VBoxGuestLib.h"
     
    100101    /* Log last error on windows. */
    101102    dwLastErr = GetLastError();
    102     if (dwLastErr != 0 && crGetenv("CR_WINDOWS_ERRORS") != NULL)
     103    if (dwLastErr != 0 && RTEnvGet("CR_WINDOWS_ERRORS") != NULL)
    103104    {
    104105        LPTSTR pszWindowsMessage;
  • trunk/src/VBox/GuestHost/OpenGL/util/htable.cpp

    r76553 r78190  
    2828#include "cr_error.h"
    2929#include "cr_net.h"
    30 #include "cr_rand.h"
    3130#include "cr_mem.h"
    3231#include "cr_string.h"
  • trunk/src/VBox/GuestHost/OpenGL/util/net.c

    r69392 r78190  
    2222#include "cr_error.h"
    2323#include "cr_string.h"
    24 #include "cr_url.h"
    2524#include "cr_net.h"
    2625#include "cr_netserver.h"
    2726#include "cr_pixeldata.h"
    28 #include "cr_environment.h"
    29 #include "cr_endian.h"
    3027#include "cr_bufpool.h"
    3128#include "cr_threads.h"
     
    4744
    4845    /* Number of connections using each type of interface: */
    49     int                  use_tcpip;
    50     int                  use_ib;
    51     int                  use_file;
    52     int                  use_udp;
    53     int                  use_gm;
    54     int                  use_sdp;
    55     int                  use_teac;
    56     int                  use_tcscomm;
    5746    int                  use_hgcm;
    5847
     
    6049
    6150#ifdef CHROMIUM_THREADSAFE
    62     CRmutex          mutex;
    63 #endif
    64     int                  my_rank;  /* Teac/TSComm only */
     51    CRmutex              mutex;
     52#endif
    6553} cr_net;
    6654
     
    7361 */
    7462static void
    75 InitConnection(CRConnection *conn, const char *protocol, unsigned int mtu
     63InitConnection(CRConnection *conn
    7664#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    7765                , struct VBOXUHGSMI *pHgsmi
     
    7967        )
    8068{
    81     if (!crStrcmp(protocol, "devnull"))
    82     {
    83         crDevnullInit(cr_net.recv_list, cr_net.close_list, mtu);
    84         crDevnullConnection(conn);
    85     }
    86     else if (!crStrcmp(protocol, "file"))
    87     {
    88         cr_net.use_file++;
    89         crFileInit(cr_net.recv_list, cr_net.close_list, mtu);
    90         crFileConnection(conn);
    91     }
    92     else if (!crStrcmp(protocol, "swapfile"))
    93     {
    94         /* file with byte-swapping */
    95         cr_net.use_file++;
    96         crFileInit(cr_net.recv_list, cr_net.close_list, mtu);
    97         crFileConnection(conn);
    98         conn->swap = 1;
    99     }
    100     else if (!crStrcmp(protocol, "tcpip"))
    101     {
    102         cr_net.use_tcpip++;
    103         crTCPIPInit(cr_net.recv_list, cr_net.close_list, mtu);
    104         crTCPIPConnection(conn);
    105     }
    106     else if (!crStrcmp(protocol, "udptcpip"))
    107     {
    108         cr_net.use_udp++;
    109         crUDPTCPIPInit(cr_net.recv_list, cr_net.close_list, mtu);
    110         crUDPTCPIPConnection(conn);
    111     }
    11269#ifdef VBOX_WITH_HGCM
    113     else if (!crStrcmp(protocol, "vboxhgcm"))
    114     {
    115         cr_net.use_hgcm++;
    116         crVBoxHGCMInit(cr_net.recv_list, cr_net.close_list, mtu);
    117         crVBoxHGCMConnection(conn
    118 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    119                     , pHgsmi
    120 #endif
    121                 );
    122     }
    123 #endif
    124 #ifdef GM_SUPPORT
    125     else if (!crStrcmp(protocol, "gm"))
    126     {
    127         cr_net.use_gm++;
    128         crGmInit(cr_net.recv_list, cr_net.close_list, mtu);
    129         crGmConnection(conn);
    130     }
    131 #endif
    132 #ifdef TEAC_SUPPORT
    133     else if (!crStrcmp(protocol, "quadrics"))
    134     {
    135         cr_net.use_teac++;
    136         crTeacInit(cr_net.recv_list, cr_net.close_list, mtu);
    137         crTeacConnection(conn);
    138     }
    139 #endif
    140 #ifdef TCSCOMM_SUPPORT
    141     else if (!crStrcmp(protocol, "quadrics-tcscomm"))
    142     {
    143         cr_net.use_tcscomm++;
    144         crTcscommInit(cr_net.recv_list, cr_net.close_list, mtu);
    145         crTcscommConnection(conn);
    146     }
    147 #endif
    148 #ifdef SDP_SUPPORT
    149     else if (!crStrcmp(protocol, "sdp"))
    150     {
    151         cr_net.use_sdp++;
    152         crSDPInit(cr_net.recv_list, cr_net.close_list, mtu);
    153         crSDPConnection(conn);
    154     }
    155 #endif
    156 #ifdef IB_SUPPORT
    157     else if (!crStrcmp(protocol, "ib"))
    158     {
    159         cr_net.use_ib++;
    160         crDebug("Calling crIBInit()");
    161         crIBInit(cr_net.recv_list, cr_net.close_list, mtu);
    162         crIBConnection(conn);
    163         crDebug("Done Calling crIBInit()");
    164     }
    165 #endif
    166 #ifdef HP_MULTICAST_SUPPORT
    167     else if (!crStrcmp(protocol, "hpmc"))
    168     {
    169         cr_net.use_hpmc++;
    170         crHPMCInit(cr_net.recv_list, cr_net.close_list, mtu);
    171         crHPMCConnection(conn);
    172     }
    173 #endif
    174     else
    175     {
    176         crError("Unknown protocol: \"%s\"", protocol);
    177     }
     70    cr_net.use_hgcm++;
     71    crVBoxHGCMInit(cr_net.recv_list, cr_net.close_list);
     72    crVBoxHGCMConnection(conn
     73#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     74                         , pHgsmi
     75#endif
     76                         );
     77#endif
    17878}
    17979
     
    19292 *                the mothership
    19393 */
    194 CRConnection * crNetConnectToServer( const char *server, unsigned short default_port, int mtu, int broker
     94CRConnection * crNetConnectToServer( const char *server, int mtu, int broker
    19595#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    19696                , struct VBOXUHGSMI *pHgsmi
     
    19898)
    19999{
    200     char hostname[4096], protocol[4096];
    201     unsigned short port;
    202100    CRConnection *conn;
    203101
    204     crDebug( "In crNetConnectToServer( \"%s\", port=%d, mtu=%d, broker=%d )",
    205                      server, default_port, mtu, broker );
     102    crDebug( "In crNetConnectToServer( \"%s\", mtu=%d, broker=%d )",
     103                     server, mtu, broker );
    206104
    207105    CRASSERT( cr_net.initialized );
     
    212110                         "but the minimum MTU is %d", server, mtu, CR_MINIMUM_MTU );
    213111    }
    214 
    215     /* Tear the URL apart into relevant portions. */
    216     if ( !crParseURL( server, protocol, hostname, &port, default_port ) ) {
    217          crError( "Malformed URL: \"%s\"", server );
    218     }
    219 
    220     /* If the host name is "localhost" replace it with the _real_ name
    221      * of the localhost.  If we don't do this, there seems to be
    222      * confusion in the mothership as to whether or not "localhost" and
    223      * "foo.bar.com" are the same machine.
    224      */
    225     if (crStrcmp(hostname, "localhost") == 0) {
    226         int rv = crGetHostname(hostname, 4096);
    227         CRASSERT(rv == 0);
    228         (void) rv;
    229     }
    230 
    231     /* XXX why is this here???  I think it could be moved into the
    232      * crTeacConnection() function with no problem. I.e. change the
    233      * connection's port, teac_rank and tcscomm_rank there.  (BrianP)
    234      */
    235     if ( !crStrcmp( protocol, "quadrics" ) ||
    236          !crStrcmp( protocol, "quadrics-tcscomm" ) ) {
    237       /* For Quadrics protocols, treat "port" as "rank" */
    238       if ( port > CR_QUADRICS_HIGHEST_RANK ) {
    239         crWarning( "Invalid crserver rank, %d, defaulting to %d\n",
    240                port, CR_QUADRICS_LOWEST_RANK );
    241         port = CR_QUADRICS_LOWEST_RANK;
    242       }
    243     }
    244     crDebug( "Connecting to %s on port %d, with protocol %s",
    245                      hostname, port, protocol );
    246 
    247 #ifdef SDP_SUPPORT
    248     /* This makes me ill, but we need to "fix" the hostname for sdp. MCH */
    249     if (!crStrcmp(protocol, "sdp")) {
    250         char* temp;
    251         temp = strtok(hostname, ".");
    252         crStrcat(temp, crGetSDPHostnameSuffix());
    253         crStrcpy(hostname, temp);
    254         crDebug("SDP rename hostname: %s", hostname);   
    255     }
    256 #endif
    257112
    258113    conn = (CRConnection *) crCalloc( sizeof(*conn) );
     
    263118    conn->type               = CR_NO_CONNECTION; /* we don't know yet */
    264119    conn->recv_credits       = CR_INITIAL_RECV_CREDITS;
    265     conn->hostname           = crStrdup( hostname );
    266     conn->port               = port;
    267120    conn->mtu                = mtu;
    268121    conn->buffer_size        = mtu;
    269122    conn->broker             = broker;
    270     conn->endianness         = crDetermineEndianness();
    271     /* XXX why are these here??? Move them into the crTeacConnection()
    272      * and crTcscommConnection() functions.
    273      */
    274     conn->teac_id            = -1;
    275     conn->teac_rank          = port;
    276     conn->tcscomm_id         = -1;
    277     conn->tcscomm_rank       = port;
    278123
    279124    crInitMessageList(&conn->messageList);
    280125
    281126    /* now, just dispatch to the appropriate protocol's initialization functions. */
    282     InitConnection(conn, protocol, mtu
     127    InitConnection(conn
    283128#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    284129                , pHgsmi
     
    311156)
    312157{
    313     /*
    314     unsigned int len = sizeof(CRMessageNewClient);
    315     CRMessageNewClient msg;
    316 
    317     CRASSERT( conn );
    318 
    319     if (conn->swap)
    320         msg.header.type = (CRMessageType) SWAP32(CR_MESSAGE_NEWCLIENT);
    321     else
    322         msg.header.type = CR_MESSAGE_NEWCLIENT;
    323 
    324     crNetSend( conn, NULL, &msg, len );
    325     */
    326 
    327158    crNetServerConnect( ns
    328159#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     
    349180    CRConnection *conn;
    350181
     182    RT_NOREF(hostname);
    351183    CRASSERT( cr_net.initialized );
    352184
     
    358190    conn->type               = CR_NO_CONNECTION; /* we don't know yet */
    359191    conn->recv_credits       = CR_INITIAL_RECV_CREDITS;
    360     conn->port               = port;
    361192    conn->mtu                = mtu;
    362193    conn->buffer_size        = mtu;
    363194    conn->broker             = broker;
    364     conn->endianness         = crDetermineEndianness();
    365     conn->teac_id            = -1;
    366     conn->teac_rank          = -1;
    367     conn->tcscomm_id         = -1;
    368     conn->tcscomm_rank       = -1;
    369195
    370196    crInitMessageList(&conn->messageList);
     
    374200                    protocol, (int) port, (int) mtu);
    375201
    376     /* special case */
    377     if ( !crStrncmp( protocol, "file", crStrlen( "file" ) ) ||
    378              !crStrncmp( protocol, "swapfile", crStrlen( "swapfile" ) ) )
    379     {
    380         char filename[4096];
    381     char protocol_only[4096];
    382 
    383         cr_net.use_file++;
    384         if (!crParseURL(protocol, protocol_only, filename, NULL, 0))
    385         {
    386             crError( "Malformed URL: \"%s\"", protocol );
    387         }
    388         conn->hostname = crStrdup( filename );
    389 
    390     /* call the protocol-specific init routines */  /* ktd (add) */
    391     InitConnection(conn, protocol_only, mtu
     202    /* call the protocol-specific init routines */
     203      InitConnection(conn
    392204#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    393205                , NULL
    394206#endif
    395             );       /* ktd (add) */
    396     }
    397     else {
    398     /* call the protocol-specific init routines */
    399       InitConnection(conn, protocol, mtu
    400 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    401                 , NULL
    402 #endif
    403207              );
    404     }
    405 
    406     crNetAccept( conn, hostname, port );
     208
     209    crNetAccept(conn);
    407210    return conn;
    408211}
     
    416219{
    417220    conn->Disconnect(conn);
    418     crFree( conn->hostname );
    419221    #ifdef CHROMIUM_THREADSAFE
    420222        crFreeMutex( &conn->messageList.lock );
     
    440242    else
    441243    {
    442 #ifdef WINDOWS
    443         /** @todo do we actually need that WSA stuff with VBox at all? */
    444         WORD wVersionRequested = MAKEWORD(2, 0);
    445         WSADATA wsaData;
    446         int err;
    447 
    448         err = WSAStartup(wVersionRequested, &wsaData);
    449         if (err != 0)
    450             crError("Couldn't initialize sockets on WINDOWS");
    451 #endif
    452 
    453         cr_net.use_gm      = 0;
    454         cr_net.use_udp     = 0;
    455         cr_net.use_tcpip   = 0;
    456         cr_net.use_sdp     = 0;
    457         cr_net.use_tcscomm = 0;
    458         cr_net.use_teac    = 0;
    459         cr_net.use_file    = 0;
    460244        cr_net.use_hgcm    = 0;
    461245        cr_net.num_clients = 0;
     
    555339    CRConnection **c;
    556340
    557     c = crTCPIPDump( num );
    558     if ( c ) return c;
    559 
    560     c = crDevnullDump( num );
    561     if ( c ) return c;
    562 
    563     c = crFileDump( num );
    564     if ( c ) return c;
    565 
    566341#ifdef VBOX_WITH_HGCM
    567342    c = crVBoxHGCMDump( num );
    568     if ( c ) return c;
    569 #endif
    570 #ifdef GM_SUPPORT
    571     c = crGmDump( num );
    572     if ( c ) return c;
    573 #endif
    574 #ifdef IB_SUPPORT
    575     c = crIBDump( num );
    576     if ( c ) return c;
    577 #endif
    578 #ifdef SDP_SUPPORT
    579     c = crSDPDump( num );
    580343    if ( c ) return c;
    581344#endif
     
    866629)
    867630{
    868     ns->conn = crNetConnectToServer( ns->name, DEFAULT_SERVER_PORT,
     631    ns->conn = crNetConnectToServer( ns->name,
    869632                                     ns->buffer_size, 0
    870633#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     
    890653{
    891654    conn->Disconnect( conn );
    892     crFree( conn->hostname );
    893655#ifdef CHROMIUM_THREADSAFE
    894656    crFreeMutex( &conn->messageList.lock );
     
    902664 * Apparently, this is only called from the crNetConnectToServer function.
    903665 */
    904 void crNetAccept( CRConnection *conn, const char *hostname, unsigned short port )
    905 {
    906     conn->Accept( conn, hostname, port );
     666void crNetAccept( CRConnection *conn)
     667{
     668    conn->Accept( conn);
    907669}
    908670
     
    916678void crNetSingleRecv( CRConnection *conn, void *buf, unsigned int len )
    917679{
    918     if (conn->type != CR_TCPIP)
    919     {
    920         crError( "Can't do a crNetSingleReceive on anything other than TCPIP." );
    921     }
     680    /** @todo Remove after users have been identified and eliminated .*/
     681    crError( "Can't do a crNetSingleReceive on anything other than TCPIP." );
    922682    conn->Recv( conn, buf, len );
    923683}
     
    987747{
    988748    CRASSERT( len == sizeof(CRMessageFlowControl) );
    989     conn->send_credits += (conn->swap ? SWAP32(msg->credits) : msg->credits);
     749    conn->send_credits += msg->credits;
    990750    conn->InstantReclaim( conn, (CRMessage *) msg );
    991751}
     
    1095855        case CR_MESSAGE_OPCODES:
    1096856        case CR_MESSAGE_OOB:
    1097             {
    1098                 /*CRMessageOpcodes *ops = (CRMessageOpcodes *) msg;
    1099                  *unsigned char *data_ptr = (unsigned char *) ops + sizeof( *ops) + ((ops->numOpcodes + 3 ) & ~0x03);
    1100                  *crDebugOpcodes( stdout, data_ptr-1, ops->numOpcodes ); */
    1101             }
    1102857            break;
    1103858        case CR_MESSAGE_READ_PIXELS:
     
    12511006void crNetReadline( CRConnection *conn, void *buf )
    12521007{
    1253     char *temp, c;
     1008    RT_NOREF(buf);
    12541009
    12551010    if (!conn || conn->type == CR_NO_CONNECTION)
    12561011        return;
    12571012
    1258     if (conn->type != CR_TCPIP)
    1259     {
    1260         crError( "Can't do a crNetReadline on anything other than TCPIP (%d).",conn->type );
    1261     }
    1262     temp = (char*)buf;
    1263     for (;;)
    1264     {
    1265         conn->Recv( conn, &c, 1 );
    1266         if (c == '\n')
    1267         {
    1268             *temp = '\0';
    1269             return;
    1270         }
    1271         *(temp++) = c;
    1272     }
     1013    /** @todo Remove after users have been found and eliminated. */
     1014    crError( "Can't do a crNetReadline on anything other than TCPIP (%d).",conn->type );
    12731015}
    12741016
     
    13011043    int found_work = 0;
    13021044
    1303     if ( cr_net.use_tcpip )
    1304         found_work += crTCPIPRecv();
    13051045#ifdef VBOX_WITH_HGCM
    13061046    if ( cr_net.use_hgcm )
     
    13111051                );
    13121052#endif
    1313 #ifdef SDP_SUPPORT
    1314     if ( cr_net.use_sdp )
    1315         found_work += crSDPRecv();
    1316 #endif
    1317 #ifdef IB_SUPPORT
    1318     if ( cr_net.use_ib )
    1319         found_work += crIBRecv();
    1320 #endif
    1321     if ( cr_net.use_udp )
    1322         found_work += crUDPTCPIPRecv();
    1323    
    1324     if ( cr_net.use_file )
    1325         found_work += crFileRecv();
    1326 
    1327 #ifdef GM_SUPPORT
    1328     if ( cr_net.use_gm )
    1329         found_work += crGmRecv();
    1330 #endif
    1331 
    1332 #ifdef TEAC_SUPPORT
    1333     if ( cr_net.use_teac )
    1334         found_work += crTeacRecv();
    1335 #endif
    1336 
    1337 #ifdef TCSCOMM_SUPPORT
    1338     if ( cr_net.use_tcscomm )
    1339         found_work += crTcscommRecv();
    1340 #endif
    13411053
    13421054    return found_work;
    13431055}
    13441056
    1345 
    1346 /**
    1347  * Teac/TSComm only
    1348  */
    1349 void
    1350 crNetSetRank( int my_rank )
    1351 {
    1352     cr_net.my_rank = my_rank;
    1353 #ifdef TEAC_SUPPORT
    1354     crTeacSetRank( cr_net.my_rank );
    1355 #endif
    1356 #ifdef TCSCOMM_SUPPORT
    1357     crTcscommSetRank( cr_net.my_rank );
    1358 #endif
    1359 }
    1360 
    1361 /**
    1362  * Teac/TSComm only
    1363  */
    1364 void
    1365 crNetSetContextRange( int low_context, int high_context )
    1366 {
    1367 #if !defined(TEAC_SUPPORT) && !defined(TCSCOMM_SUPPORT)
    1368     (void)low_context; (void)high_context;
    1369 #endif
    1370 #ifdef TEAC_SUPPORT
    1371     crTeacSetContextRange( low_context, high_context );
    1372 #endif
    1373 #ifdef TCSCOMM_SUPPORT
    1374     crTcscommSetContextRange( low_context, high_context );
    1375 #endif
    1376 }
    1377 
    1378 /**
    1379  * Teac/TSComm only
    1380  */
    1381 void
    1382 crNetSetNodeRange( const char *low_node, const char *high_node )
    1383 {
    1384 #if !defined(TEAC_SUPPORT) && !defined(TCSCOMM_SUPPORT)
    1385     (void)low_node; (void)high_node;
    1386 #endif
    1387 #ifdef TEAC_SUPPORT
    1388     crTeacSetNodeRange( low_node, high_node );
    1389 #endif
    1390 #ifdef TCSCOMM_SUPPORT
    1391     crTcscommSetNodeRange( low_node, high_node );
    1392 #endif
    1393 }
    1394 
    1395 /**
    1396  * Teac/TSComm only
    1397  */
    1398 void
    1399 crNetSetKey( const unsigned char* key, const int keyLength )
    1400 {
    1401 #ifdef TEAC_SUPPORT
    1402     crTeacSetKey( key, keyLength );
    1403 #else
    1404     (void)key; (void)keyLength;
    1405 #endif
    1406 }
  • trunk/src/VBox/GuestHost/OpenGL/util/net_internals.h

    r63199 r78190  
    1010
    1111/*
    12  * DevNull network interface
    13  */
    14 extern void crDevnullInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    15 extern void crDevnullConnection( CRConnection *conn );
    16 extern int crDevnullRecv( void );
    17 extern CRConnection** crDevnullDump( int *num );
    18 
    19 
    20 /*
    21  * File network interface
    22  */
    23 extern void crFileInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    24 extern void crFileConnection( CRConnection *conn );
    25 extern int crFileRecv( void );
    26 extern CRConnection** crFileDump( int *num );
    27 
    28 
    29 /*
    30  * TCP/IP network interface
    31  */
    32 typedef enum {
    33     CRTCPIPMemory,
    34     CRTCPIPMemoryBig
    35 } CRTCPIPBufferKind;
    36 
    37 #define CR_TCPIP_BUFFER_MAGIC 0x89134532
    38 
    39 typedef struct CRTCPIPBuffer {
    40     unsigned int          magic;
    41     CRTCPIPBufferKind     kind;
    42     unsigned int          len;
    43     unsigned int          allocated;
    44     unsigned int          pad;  /* may be clobbered by crTCPIPSend() */
    45 } CRTCPIPBuffer;
    46 
    47 typedef struct {
    48     int                  initialized;
    49     int                  num_conns;
    50     CRConnection         **conns;
    51     CRBufferPool         *bufpool;
    52 #ifdef CHROMIUM_THREADSAFE
    53     CRmutex              mutex;
    54     CRmutex              recvmutex;
    55 #endif
    56     CRNetReceiveFuncList *recv_list;
    57     CRNetCloseFuncList *close_list;
    58     CRSocket             server_sock;
    59 } cr_tcpip_data;
    60 
    61 extern cr_tcpip_data cr_tcpip;
    62 
    63 extern void crTCPIPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    64 extern void crTCPIPConnection( CRConnection *conn );
    65 extern int crTCPIPRecv( void );
    66 extern CRConnection** crTCPIPDump( int *num );
    67 extern int crTCPIPDoConnect( CRConnection *conn );
    68 extern void crTCPIPDoDisconnect( CRConnection *conn );
    69 extern int crTCPIPErrno( void );
    70 extern char *crTCPIPErrorString( int err );
    71 extern void crTCPIPAccept( CRConnection *conn, const char *hostname, unsigned short port );
    72 extern void crTCPIPWriteExact( CRConnection *conn, const void *buf, unsigned int len );
    73 extern void crTCPIPFree( CRConnection *conn, void *buf );
    74 extern void *crTCPIPAlloc( CRConnection *conn );
    75 extern void crTCPIPReadExact( CRConnection *conn, void *buf, unsigned int len );
    76 extern int __tcpip_write_exact( CRSocket sock, const void *buf, unsigned int len );
    77 extern int __tcpip_read_exact( CRSocket sock, void *buf, unsigned int len );
    78 extern void __tcpip_dead_connection( CRConnection *conn );
    79 extern int __crSelect( int n, fd_set *readfds, int sec, int usec );
    80 
    81 
    82 /*
    83  * UDP network interface
    84  */
    85 extern void crUDPTCPIPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    86 extern void crUDPTCPIPConnection( CRConnection *conn );
    87 extern int crUDPTCPIPRecv( void );
    88 
    89 /*
    9012 * VirtualBox HGCM
    9113 */
    9214#ifdef VBOX_WITH_HGCM
    93 extern void crVBoxHGCMInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
     15extern void crVBoxHGCMInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl);
    9416extern void crVBoxHGCMConnection( CRConnection *conn
    9517#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     
    11133#endif
    11234
    113 /*
    114  * TEAC network interface
    115  */
    116 #ifdef TEAC_SUPPORT
    117 extern void crTeacInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl,
    118             unsigned int mtu );
    119 extern void crTeacConnection( CRConnection *conn );
    120 extern int crTeacRecv( void );
    121 extern void crTeacSetRank( int );
    122 extern void crTeacSetContextRange( int, int );
    123 extern void crTeacSetNodeRange( const char *, const char * );
    124 extern void crTeacSetKey( const unsigned char *key, const int keyLength );
    125 #endif /* TEAC_SUPPORT */
    126 
    127 
    128 /*
    129  * Tcscomm network interface
    130  */
    131 #ifdef TCSCOMM_SUPPORT
    132 extern void crTcscommInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl,
    133                            unsigned int mtu );
    134 extern void crTcscommConnection( CRConnection *conn );
    135 extern int crTcscommRecv( void );
    136 #endif /* TCSCOMM_SUPPORT */
    137 
    138 
    139 /*
    140  * SDP network interface
    141  */
    142 #ifdef SDP_SUPPORT
    143 extern const char *crGetSDPHostnameSuffix(void);
    144 extern void crSDPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    145 extern void crSDPConnection( CRConnection *conn );
    146 extern int crSDPRecv( void );
    147 extern CRConnection** crSDPDump( int *num );
    148 #endif /* SDP_SUPPORT */
    149 
    150 
    151 /*
    152  * Infiniband network interface
    153  */
    154 #ifdef IB_SUPPORT
    155 extern void crIBInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    156 extern void crIBConnection( CRConnection *conn );
    157 extern int crIBRecv( void );
    158 extern CRConnection** crIBDump( int *num );
    159 #endif /* IB_SUPPORT */
    160 
    161 
    162 /*
    163  * GM network interface
    164  */
    165 #ifdef GM_SUPPORT
    166 extern void crGmInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
    167 extern void crGmConnection( CRConnection *conn );
    168 extern int crGmRecv( void );
    169 extern CRConnection** crGmDump( int *num );
    170 extern int crGmDoConnect( CRConnection *conn );
    171 extern void crGmDoDisconnect( CRConnection *conn );
    172 extern int crGmErrno( void );
    173 extern char *crGmErrorString( int err );
    174 extern void crGmAccept( CRConnection *conn, const char *hostname, unsigned short port );
    175 extern void crGmSendExact( CRConnection *conn, const void *buf, unsigned int len );
    176 extern void crGmFree( CRConnection *conn, void *buf );
    177 extern void *crGmAlloc( CRConnection *conn );
    178 extern void crGmReadExact( CRConnection *conn, void *buf, unsigned int len );
    179 extern void crGmBogusRecv( CRConnection *conn, void *buf, unsigned int len );
    180 extern void crGmHandleNewMessage( CRConnection *conn, CRMessage *msg, unsigned int len );
    181 extern void crGmInstantReclaim( CRConnection *conn, CRMessage *msg );
    182 extern unsigned int crGmNodeId( void );
    183 extern unsigned int crGmPortNum( void );
    184 #endif /* GM_SUPPORT */
    185 
    186 
    18735extern CRConnection** crNetDump( int *num );
    18836
  • trunk/src/VBox/GuestHost/OpenGL/util/process.c

    r63199 r78190  
    2222#define snprintf _snprintf
    2323#endif
    24 
    25 /**
    26  * Sleep/pause for the given number of seconds.
    27  */
    28 void crSleep( unsigned int seconds )
    29 {
    30 #ifdef WINDOWS
    31   Sleep(seconds*1000); /* milliseconds */
    32 #else
    33   sleep(seconds);
    34 #endif
    35 }
    36 
    37 /**
    38  * Sleep/pause for the given number of milliseconds.
    39  */
    40 void crMsleep( unsigned int msec )
    41 {
    42 #ifdef WINDOWS
    43      Sleep(msec);
    44 #else
    45      usleep(msec*1000); /* usecs */
    46 #endif
    47 }
    48 
    49 
    50 /*
    51  * Spawn (i.e. fork/exec) a new process.
    52  */
    53 CRpid crSpawn( const char *command, const char *argv[] )
    54 {
    55 #ifdef WINDOWS
    56         char newargv[1000];
    57         int i;
    58         STARTUPINFO si;
    59         PROCESS_INFORMATION pi;
    60 
    61         (void) command;
    62 
    63         ZeroMemory( &si, sizeof(si) );
    64         si.cb = sizeof(si);
    65         ZeroMemory( &pi, sizeof(pi) );
    66 
    67         crStrncpy(newargv, argv[0], 1000 );
    68         for (i = 1; argv[i]; i++) {
    69                 crStrcat(newargv, " ");
    70                 crStrcat(newargv, argv[i]);
    71         }
    72 
    73         if ( !CreateProcess(NULL, newargv, NULL, NULL, FALSE, 0, NULL,
    74                                 NULL, &si, &pi) )
    75         {
    76                 crWarning("crSpawn failed, %d", GetLastError());
    77                 return 0;
    78         }
    79         return pi.hProcess;
    80 #else
    81         pid_t pid;
    82         if ((pid = fork()) == 0)
    83         {
    84                 /* I'm the child */
    85                 int err = execvp(command, (char * const *) argv);
    86                 crWarning("crSpawn failed (return code: %d)", err);
    87                 return 0;
    88         }
    89         return (unsigned long) pid;
    90 #endif
    91 }
    92 
    93 
    94 /*
    95  * Kill the named process.
    96  */
    97 void crKill( CRpid pid )
    98 {
    99 #ifdef WINDOWS
    100         TerminateProcess( pid, 0 );
    101 #else
    102         kill((pid_t) pid, SIGKILL);
    103 #endif
    104 }
    105 
    10624
    10725/*
     
    208126
    209127
    210 /*
    211  * Return current directory string.
    212  */
    213 void crGetCurrentDir( char *dir, int maxLen )
    214 {
    215 #ifdef WINDOWS
    216   if (!GetCurrentDirectory(maxLen, dir))
    217         dir[0] = 0;
    218 #else
    219   if (!getcwd(dir, maxLen))
    220         dir[0] = 0;
    221 #endif
    222 }
    223 
    224 
    225128/**
    226129 * Return current process ID number.
  • trunk/src/VBox/GuestHost/OpenGL/util/util.def

    r69392 r78190  
    1212crDebug
    1313crInfo
    14 crParseURL
    15 crAlloc
    16 crCalloc
    17 crAllocDebug
    18 crCallocDebug
    19 crRealloc
    20 crMemset
    21 crFree
    2214crStrSplit
    2315crStrSplitn
     
    4335crBytesToString
    4436crWordsToString
    45 crGetHostname
    4637crGetPID
    4738crNetAcceptClient
     
    7465crImageSize
    7566crTextureSize
    76 crGetenv
    77 crSetenv
    7867crHashtableAdd
    7968crHashtableDelete
     
    9079crFreeHashtableEx
    9180crHashtableGetDataKey
    92 crDetermineEndianness
    93 SWAPDOUBLE
    9481crBufferPoolInit
    9582crBufferPoolPush
    9683crBufferPoolPop
    9784crBufferPoolFree
    98 crTimerNewTimer
    9985crBufferPoolGetNumBuffers
    10086crBufferPoolGetMaxBuffers
    101 crDestroyTimer
    102 crStartTimer
    103 crStopTimer
    104 crResetTimer
    105 crTimerTime
    106 crMemcpy
    107 crMemcmp
    108 crMemZero
    109 crCalloc
    11087crSetTSD
    11188crGetTSD
     
    129106crGetTSD
    130107crFreeTSD
    131 crRandFloat
    132 crRandInt
    133 crRandSeed
    134 crRandAutoSeed
    135 crTransformBBox
    136 crProjectBBox
    137 crRectiUnion
    138 crWarpPoint
    139 crHullInteriorBox
    140 crNetSetNodeRange
    141 crNetSetContextRange
    142 crNetSetRank
    143 crNetSetKey
    144 crSleep
    145 crSpawn
    146 crKill
    147108crGetProcName
    148 crGetCurrentDir
    149109crHashtableAllocKeys
    150110crHashtableDeleteBlock
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r76553 r78190  
    3232#include "cr_mem.h"
    3333#include "cr_string.h"
    34 #include "cr_endian.h"
    3534#include "cr_threads.h"
    3635#include "net_internals.h"
     
    11851184 * Called on host side only, to "accept" client connection
    11861185 */
    1187 static void crVBoxHGCMAccept( CRConnection *conn, const char *hostname, unsigned short port )
    1188 {
    1189     RT_NOREF(hostname, port);
     1186static void crVBoxHGCMAccept( CRConnection *conn)
     1187{
    11901188    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
    11911189    CRASSERT(conn && conn->pHostBuffer);
     
    20672065 * Called on host side only, to "accept" client connection
    20682066 */
    2069 static void crVBoxHGSMIAccept( CRConnection *conn, const char *hostname, unsigned short port )
     2067static void crVBoxHGSMIAccept( CRConnection *conn)
    20702068{
    20712069    VBOXCRHGSMIPROFILE_FUNC_PROLOGUE();
     
    21862184#endif
    21872185
    2188 void crVBoxHGCMInit(CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu)
    2189 {
    2190     (void) mtu;
    2191 
     2186void crVBoxHGCMInit(CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl)
     2187{
    21922188    g_crvboxhgcm.recv_list = rfl;
    21932189    g_crvboxhgcm.close_list = cfl;
  • trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk

    r78086 r78190  
    2929        $(VBOX_PATH_CROGL_GENFILES)/
    3030endif
    31 
    32 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    33  LIBRARIES += VBoxOGLcrdlm
    34  DLLS      += VBoxOGLexpandospu
    35 endif # VBOX_WITH_CR_DISPLAY_LISTS
    3631
    3732ifeq ($(KBUILD_TARGET),darwin)
     
    9792VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI
    9893endif
    99 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    100 VBoxSharedCrOpenGL_LIBS += $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB)
    101 endif
    10294
    10395#
     
    116108        $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
    117109
    118 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    119 VBoxOGLcrserverlib_INTERMEDIATES += $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h
    120 endif
    121 
    122110VBoxOGLcrserverlib_SOURCES := \
    123         crserverlib/server_main.c \
    124         crserverlib/server_boundsinfo.c \
    125         crserverlib/server_bufferobject.c \
    126         crserverlib/server_clear.c \
    127         crserverlib/server_clip.c \
    128         crserverlib/server_config.c \
    129         crserverlib/server_context.c \
    130         crserverlib/server_gentextures.c \
    131         crserverlib/server_getmap.c \
    132         crserverlib/server_getstring.c \
    133         crserverlib/server_getpointer.c \
    134         crserverlib/server_getpixelmap.c \
    135         crserverlib/server_getteximage.c \
    136         crserverlib/server_lists.c \
    137         crserverlib/server_misc.c \
    138         crserverlib/server_occlude.c \
    139         crserverlib/server_papi.c \
    140         crserverlib/server_projmatrix.c \
    141         crserverlib/server_readpixels.c \
    142         crserverlib/server_stream.c \
    143         crserverlib/server_viewport.c \
    144         crserverlib/server_window.c \
    145         crserverlib/server_winpos.c \
    146         crserverlib/server_writeback.c \
    147         crserverlib/server_getshaders.c \
    148         crserverlib/server_framebuffer.c \
    149         crserverlib/server_glsl.c \
     111        crserverlib/server_main.cpp \
     112        crserverlib/server_boundsinfo.cpp \
     113        crserverlib/server_bufferobject.cpp \
     114        crserverlib/server_clear.cpp \
     115        crserverlib/server_clip.cpp \
     116        crserverlib/server_config.cpp \
     117        crserverlib/server_context.cpp \
     118        crserverlib/server_gentextures.cpp \
     119        crserverlib/server_getmap.cpp \
     120        crserverlib/server_getstring.cpp \
     121        crserverlib/server_getpointer.cpp \
     122        crserverlib/server_getpixelmap.cpp \
     123        crserverlib/server_getteximage.cpp \
     124        crserverlib/server_lists.cpp \
     125        crserverlib/server_misc.cpp \
     126        crserverlib/server_occlude.cpp \
     127        crserverlib/server_papi.cpp \
     128        crserverlib/server_projmatrix.cpp \
     129        crserverlib/server_readpixels.cpp \
     130        crserverlib/server_stream.cpp \
     131        crserverlib/server_viewport.cpp \
     132        crserverlib/server_window.cpp \
     133        crserverlib/server_winpos.cpp \
     134        crserverlib/server_writeback.cpp \
     135        crserverlib/server_getshaders.cpp \
     136        crserverlib/server_framebuffer.cpp \
     137        crserverlib/server_glsl.cpp \
    150138        crserverlib/server_muralfbo.cpp \
    151         crserverlib/server_texture.c \
     139        crserverlib/server_texture.cpp \
    152140        crserverlib/presenter/server_presenter.cpp \
    153141        crserverlib/presenter/display_base.cpp \
     
    158146        crserverlib/presenter/display_vrdp.cpp \
    159147        crserverlib/server_rpw.cpp \
    160         $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
    161         $(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
    162         $(VBOX_PATH_CROGL_GENFILES)/server_get.c \
    163         $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c
     148        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp \
     149        $(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp \
     150        $(VBOX_PATH_CROGL_GENFILES)/server_get.cpp \
     151        $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp
    164152VBoxOGLcrserverlib_CLEAN = \
    165         $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
    166         $(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
    167         $(VBOX_PATH_CROGL_GENFILES)/server_get.c \
    168         $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c \
     153        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp \
     154        $(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp \
     155        $(VBOX_PATH_CROGL_GENFILES)/server_get.cpp \
     156        $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp \
    169157        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h
    170 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    171 VBoxOGLcrserverlib_DEFS += VBOX_WITH_CR_DISPLAY_LISTS
    172 endif
    173158ifdef VBOXCR_LOGFPS
    174159VBoxOGLcrserverlib_DEFS += VBOXCR_LOGFPS
     
    192177        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    193178
    194 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_dispatch.py server_special) $(VBOX_CROGL_API_FILES) $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/state_tracker/state_special | $$(dir $$@)
    195         $(call MSG_GENERATE,python,$@,$<)
    196         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    197 
    198 $(VBOX_PATH_CROGL_GENFILES)/server_retval.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_retval.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    199         $(call MSG_GENERATE,python,$@,$<)
    200         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    201 
    202 $(VBOX_PATH_CROGL_GENFILES)/server_get.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_get.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    203         $(call MSG_GENERATE,python,$@,$<)
    204         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    205 
    206 $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_simpleget.py get_sizes.py) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     179$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_dispatch.py server_special) $(VBOX_CROGL_API_FILES) $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/state_tracker/state_special | $$(dir $$@)
     180        $(call MSG_GENERATE,python,$@,$<)
     181        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     182
     183$(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_retval.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     184        $(call MSG_GENERATE,python,$@,$<)
     185        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     186
     187$(VBOX_PATH_CROGL_GENFILES)/server_get.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_get.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     188        $(call MSG_GENERATE,python,$@,$<)
     189        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     190
     191$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_simpleget.py get_sizes.py) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    207192        $(call MSG_GENERATE,python,$@,$<)
    208193        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     
    223208        $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
    224209VBoxOGLcrunpacker_SOURCES  = \
    225         unpacker/unpack_arrays.c \
    226         unpacker/unpack_bounds.c \
    227         unpacker/unpack_bufferobject.c \
    228         unpacker/unpack_calllists.c \
    229         unpacker/unpack_clipplane.c \
    230         unpacker/unpack_context.c \
    231         unpacker/unpack_drawpixels.c \
    232         unpacker/unpack_fence.c \
    233         unpacker/unpack_fog.c \
    234         unpacker/unpack_lights.c \
    235         unpacker/unpack_map.c \
    236         unpacker/unpack_materials.c \
    237         unpacker/unpack_matrices.c \
    238         unpacker/unpack_misc.c \
    239         unpacker/unpack_pixelmap.c \
    240         unpacker/unpack_point.c \
    241         unpacker/unpack_program.c \
    242         unpacker/unpack_readpixels.c \
    243         unpacker/unpack_regcombiner.c \
    244         unpacker/unpack_stipple.c \
    245         unpacker/unpack_texture.c \
    246         unpacker/unpack_writeback.c \
    247         unpacker/unpack_visibleregion.c \
    248         unpacker/unpack_shaders.c \
    249         unpacker/unpack_framebuffer.c \
     210        unpacker/unpack_arrays.cpp \
     211        unpacker/unpack_bounds.cpp \
     212        unpacker/unpack_bufferobject.cpp \
     213        unpacker/unpack_calllists.cpp \
     214        unpacker/unpack_clipplane.cpp \
     215        unpacker/unpack_context.cpp \
     216        unpacker/unpack_drawpixels.cpp \
     217        unpacker/unpack_fence.cpp \
     218        unpacker/unpack_fog.cpp \
     219        unpacker/unpack_lights.cpp \
     220        unpacker/unpack_map.cpp \
     221        unpacker/unpack_materials.cpp \
     222        unpacker/unpack_matrices.cpp \
     223        unpacker/unpack_misc.cpp \
     224        unpacker/unpack_pixelmap.cpp \
     225        unpacker/unpack_point.cpp \
     226        unpacker/unpack_program.cpp \
     227        unpacker/unpack_readpixels.cpp \
     228        unpacker/unpack_regcombiner.cpp \
     229        unpacker/unpack_stipple.cpp \
     230        unpacker/unpack_texture.cpp \
     231        unpacker/unpack_writeback.cpp \
     232        unpacker/unpack_visibleregion.cpp \
     233        unpacker/unpack_shaders.cpp \
     234        unpacker/unpack_framebuffer.cpp \
    250235        $(VBOX_PATH_CROGL_GENFILES)/unpack.cpp
    251236VBoxOGLcrunpacker_CLEAN = \
     
    270255        $(call MSG_GENERATE,python,$@,$<)
    271256        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    272 
    273 
    274 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    275 #
    276 # VBoxOGLcrdlm
    277 #
    278 
    279 VBoxOGLcrdlm_TEMPLATE       = VBOXCROGLR3HOSTLIB
    280 VBoxOGLcrdlm_INCS           = \
    281         dlm
    282 VBoxOGLcrdlm_INTERMEDIATES  = \
    283         $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
    284         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
    285 
    286 VBoxOGLcrdlm_SOURCES  = \
    287         dlm/dlm.c \
    288         dlm/dlm_arrays.c \
    289         dlm/dlm_state.c \
    290         dlm/dlm_checklist.c \
    291         dlm/dlm_error.c \
    292         dlm/dlm_lists.c \
    293         dlm/dlm_pointers.c \
    294         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c
    295 
    296 VBoxOGLcrdlm_CLEAN = \
    297         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c \
    298         $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
    299         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
    300 #
    301 # Generate files for VBoxOGLcrdlm.
    302 #
    303 $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h: \
    304                 $(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_header.py) \
    305                 $(VBOX_CROGL_API_FILES) \
    306                 | $$(dir $$@)
    307         $(call MSG_GENERATE,python,$@,$<)
    308         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< header $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
    309 
    310 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h: \
    311                 $(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
    312                 $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
    313                 $(VBOX_CROGL_API_FILES) \
    314                 | $$(dir $$@)
    315         $(call MSG_GENERATE,python,$@,$<)
    316         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< headers $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
    317 
    318 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c: \
    319                 $(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
    320                 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h \
    321                 $(VBOX_CROGL_API_FILES) \
    322                 | $$(dir $$@)
    323         $(call MSG_GENERATE,python,$@,$<)
    324         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< source $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
    325 
    326 
    327 #
    328 # VBoxOGLexpandospu
    329 #
    330 VBoxOGLexpandospu_TEMPLATE       = VBOXCROGLR3HOSTDLL
    331 VBoxOGLexpandospu_INCS           = \
    332         expando
    333 VBoxOGLexpandospu_SOURCES  = \
    334         expando/expandospu.c \
    335         expando/expandospu_config.c \
    336         expando/expandospu_init.c \
    337         $(VBOX_PATH_CROGL_GENFILES)/expando.c
    338 VBoxOGLexpandospu_CLEAN = \
    339         $(VBOX_PATH_CROGL_GENFILES)/expando.c
    340 VBoxOGLexpandospu_CLEAN = \
    341         $(VBOX_PATH_CROGL_GENFILES)/expando.c
    342 VBoxOGLexpandospu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLexpandospu.dylib
    343 VBoxOGLexpandospu_LIBS = \
    344         $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB) \
    345         $(PATH_STAGE_LIB)/VBoxOGLhostcrstate$(VBOX_SUFF_LIB) \
    346         $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
    347         $(VBOX_LIB_OGL_HOSTCRUTIL) \
    348         $(LIB_RUNTIME) \
    349         $(LIB_VMM)
    350 #
    351 # Generate files for VBoxOGLexpandospu.
    352 #
    353 $(VBOX_PATH_CROGL_GENFILES)/expando.c: \
    354                 $(addprefix $(PATH_SUB_CURRENT)/expando/, expando.py expando_special) \
    355                 $(VBOX_CROGL_API_FILES) \
    356                 | $$(dir $$@)
    357         $(call MSG_GENERATE,python,$@,$<)
    358         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) > $@
    359 endif
    360257
    361258
  • trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp

    r76553 r78190  
    2626#include <ApplicationServices/ApplicationServices.h>
    2727#include <OpenGL/gl.h>
    28 #ifdef VBOX_WITH_COCOA_QT
    29 # include <OpenGL/glu.h>
    30 #endif
     28#include <OpenGL/glu.h>
    3129
    3230#include <iprt/env.h>
     
    143141            GLboolean isSupported = GL_TRUE;
    144142
    145 #ifdef VBOX_WITH_COCOA_QT
    146143            /*
    147144             * In the Cocoa port we depend on the GL_EXT_framebuffer_object &
     
    160157            else
    161158                LogRel(("OpenGL Info: 3D test found that GL_EXT_framebuffer_object extension not supported.\n"));
    162 #endif /* VBOX_WITH_COCOA_QT */
    163159
    164160            CGLDestroyContext(pCglContext);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h

    r76553 r78190  
    2424#include "cr_error.h"
    2525#include "cr_net.h"
    26 #include "cr_rand.h"
    2726#include "server_dispatch.h"
    2827#include "server.h"
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r71607 r78190  
    9292} CRServerProgram;
    9393
    94 void crServerSetVBoxConfiguration();
    9594void crServerSetVBoxConfigurationHGCM();
    9695void crServerInitDispatch(void);
     
    107106void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum );
    108107void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural );
    109 
    110 GLboolean crServerInitializeBucketing(CRMuralInfo *mural);
    111108
    112109void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py

    r78116 r78190  
    110110        print('\t{')
    111111        print('\t\tcr_server.head_spu->dispatch_table.%s(%s);' % (func_name, apiutil.MakeCallStringForDispatcher(params) ))
    112         print("\t\tcr_server.current.c.%s.%s%s = cr_unpackData;" % (name,type,array))
     112        print("\t\tcr_server.current.c.%s.%s%s = cr_server.pUnpackerState->pbUnpackData;" % (name,type,array))
    113113        print('\t}')
    114114        print('}\n')
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getpixelmap.cpp

    r78189 r78190  
    7070        pbo_offset = (GLfloat*) ((uintptr_t) *((GLint*)values));
    7171
    72         cr_server.head_spu->dispatch_table.GetPixelMapfv( map, pbo_offset );
     72        cr_server.head_spu->dispatch_table.GetPixelMapfv( map, (GLfloat *)pbo_offset );
    7373    }
    7474    else
     
    9797        pbo_offset = (GLuint*) ((uintptr_t) *((GLint*)values));
    9898
    99         cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, pbo_offset );
     99        cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, (GLuint *)pbo_offset );
    100100    }
    101101    else
     
    124124        pbo_offset = (GLushort*) ((uintptr_t) *((GLint*)values));
    125125
    126         cr_server.head_spu->dispatch_table.GetPixelMapusv( map, pbo_offset );
     126        cr_server.head_spu->dispatch_table.GetPixelMapusv( map, (GLushort *)pbo_offset );
    127127    }
    128128    else
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_papi.cpp

    r78189 r78190  
    1212
    1313#define DEBUG_BARRIERS 1
     14#ifdef DEBUG_BARRIERS
     15# include <stdio.h>
     16#endif
    1417
    1518void SERVER_DISPATCH_APIENTRY crServerDispatchBarrierCreateCR( GLuint name, GLuint count )
     
    165168        }
    166169
    167         sema = crHashtableSearch(cr_server.semaphores, name);
     170        sema = (CRServerSemaphore *)crHashtableSearch(cr_server.semaphores, name);
    168171        if (sema)
    169172                return; /* already created */
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py

    r74890 r78190  
    3030        if (cr_server.bIsInLoadingState)
    3131            return;
    32 
    33         if (cr_server.curClient->conn->type == CR_FILE)
    34         {
    35             return;
    36         }
    3732
    3833        if (payload_len >= INT32_MAX - sizeof( *rb ))
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r69390 r78190  
    55 */
    66
    7 #include "cr_environment.h"
    87#include "cr_string.h"
    98#include "cr_error.h"
    109#include "cr_mem.h"
    1110#include "cr_spu.h"
    12 #include "cr_environment.h"
    1311#include "renderspu.h"
    1412#include "cr_extstring.h"
     
    1614#include <iprt/asm.h>
    1715
     16#include <stdio.h> /*sprintf*/
     17
    1818uint32_t renderspuContextRelease(ContextInfo *context);
    1919uint32_t renderspuContextRetain(ContextInfo *context);
     
    2626    out.header.type = CR_MESSAGE_OOB;
    2727
    28     if (render_spu.is_swap_master)
    29     {
    30         int a;
    31 
    32         for (a = 0; a < render_spu.num_swap_clients; a++)
    33         {
    34             crNetGetMessage( render_spu.swap_conns[a], &in );
    35             crNetFree( render_spu.swap_conns[a], in);
    36         }
    37 
    38         for (a = 0; a < render_spu.num_swap_clients; a++)
    39             crNetSend( render_spu.swap_conns[a], NULL, &out, sizeof(CRMessage));
    40     }
    41     else
    42     {
    43         crNetSend( render_spu.swap_conns[0], NULL, &out, sizeof(CRMessage));
    44 
    45         crNetGetMessage( render_spu.swap_conns[0], &in );
    46         crNetFree( render_spu.swap_conns[0], in);
    47     }
     28    crNetSend( render_spu.swap_conns[0], NULL, &out, sizeof(CRMessage));
     29
     30    crNetGetMessage( render_spu.swap_conns[0], &in );
     31    crNetFree( render_spu.swap_conns[0], in);
    4832}
    4933
     
    13611345        DrawCursor( render_spu.cursorX, render_spu.cursorY );
    13621346
    1363     if (render_spu.swap_master_url)
    1364         DoSync();
    1365 
    13661347    renderspu_SystemSwapBuffers( w, flags );
    13671348}
     
    15701551                switch (render_spu.server->clients[client_num]->conn->type)
    15711552                {
    1572                     case CR_TCPIP:
    1573                         crDebug("Render SPU: AcceptClient from %s on %d",
    1574                             render_spu.server->clients[client_num]->conn->hostname, render_spu.gather_port);
    1575                         render_spu.gather_conns[client_num] =
    1576                                 crNetAcceptClient("tcpip", NULL, port, 1024*1024,  1);
    1577                         break;
    1578 
    1579                     case CR_GM:
    1580                         render_spu.gather_conns[client_num] =
    1581                                 crNetAcceptClient("gm", NULL, port, 1024*1024,  1);
    1582                         break;
    1583 
    15841553                    default:
    15851554                        crError("Render SPU: Unknown Network Type to Open Gather Connection");
     
    16001569                if (render_spu.gather_conns[client_num])
    16011570                {
    1602                     crDebug("Render SPU: success! from %s", render_spu.gather_conns[client_num]->hostname);
     1571                    crDebug("Render SPU: success!");
    16031572                }
    16041573            }
     
    16291598         * in SwapBuffers above] is not necessary -- karl
    16301599         */
    1631 
    1632         if (render_spu.swap_master_url)
    1633             DoSync();
    1634 
    16351600        for (client_num=0; client_num< render_spu.server->numClients; client_num++)
    16361601            crNetSend(render_spu.gather_conns[client_num], NULL, &pingback,
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h

    r70851 r78190  
    1414#define snprintf _snprintf
    1515#elif defined(DARWIN)
    16 # ifndef VBOX_WITH_COCOA_QT
    17 #  include <AGL/AGL.h>
    18 # else
    19 #  include "renderspu_cocoa_helper.h"
    20 # endif
     16# include "renderspu_cocoa_helper.h"
    2117#define RENDER_APIENTRY
    2218#else
     
    4743#define MAX_VISUALS 32
    4844
    49 #ifdef RT_OS_DARWIN
    50 # ifndef VBOX_WITH_COCOA_QT
    51 enum
    52 {
    53     /* Event classes */
    54     kEventClassVBox         = 'vbox',
    55     /* Event kinds */
    56     kEventVBoxShowWindow    = 'swin',
    57     kEventVBoxHideWindow    = 'hwin',
    58     kEventVBoxMoveWindow    = 'mwin',
    59     kEventVBoxResizeWindow  = 'rwin',
    60     kEventVBoxDisposeWindow = 'dwin',
    61     kEventVBoxUpdateDock    = 'udck',
    62     kEventVBoxUpdateContext = 'uctx',
    63     kEventVBoxBoundsChanged = 'bchg'
    64 };
    65 pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef event, void* userData);
    66 # endif
    67 #endif /* RT_OS_DARWIN */
    68 
    6945/**
    7046 * Visual info
     
    7652//    HDC device_context;
    7753#elif defined(DARWIN)
    78 # ifndef VBOX_WITH_COCOA_QT
    79     WindowRef window;
    80 # endif
    8154#elif defined(GLX)
    8255    Display *dpy;
     
    12194    HRGN hRgn;
    12295#elif defined(DARWIN)
    123 # ifndef VBOX_WITH_COCOA_QT
    124     WindowRef window;
    125     WindowRef nativeWindow; /**< for render_to_app_window */
    126     WindowRef appWindow;
    127     EventHandlerUPP event_handler;
    128     GLint bufferName;
    129     AGLContext dummyContext;
    130     RgnHandle hVisibleRegion;
    131     /* unsigned long context_ptr; */
    132 # else
    13396    NativeNSViewRef window;
    13497    NativeNSViewRef nativeWindow; /**< for render_to_app_window */
    13598    NativeNSOpenGLContextRef *currentCtx;
    136 # endif
    13799#elif defined(GLX)
    138100    Window window;
     
    163125    HGLRC hRC;
    164126#elif defined(DARWIN)
    165 # ifndef VBOX_WITH_COCOA_QT
    166     AGLContext context;
    167 # else
    168127    NativeNSOpenGLContextRef context;
    169 # endif
    170128#elif defined(GLX)
    171129    GLXContext context;
     
    288246    CRHashTable *barrierHash;
    289247
    290     int is_swap_master, num_swap_clients;
    291     int swap_mtu;
    292     char *swap_master_url;
     248    int num_swap_clients;
    293249    CRConnection **swap_conns;
    294250
     
    329285
    330286#ifdef RT_OS_DARWIN
    331 # ifdef VBOX_WITH_COCOA_QT
    332287    PFNDELETE_OBJECT pfnDeleteObject;
    333288    PFNGET_ATTACHED_OBJECTS pfnGetAttachedObjects;
     
    338293
    339294    CR_GLSL_CACHE GlobalShaders;
    340 # else
    341     RgnHandle hRootVisibleRegion;
    342     RTSEMFASTMUTEX syncMutex;
    343     EventHandlerUPP hParentEventHandler;
    344     WindowGroupRef pParentGroup;
    345     WindowGroupRef pMasterGroup;
    346     GLint currentBufferName;
    347     uint64_t uiDockUpdateTS;
    348     bool fInit;
    349 # endif
    350295#endif /* RT_OS_DARWIN */
    351296    /* If TRUE, render should tell window server to prevent artificial content
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_config.c

    r70852 r78190  
    1010#include "cr_mem.h"
    1111#include "cr_error.h"
    12 #include "cr_environment.h"
    13 #include "cr_url.h"
    1412
    15 
    16 static void set_window_geometry( RenderSPU *render_spu, const char *response )
    17 {
    18     int x, y, w, h;
    19     CRASSERT(response[0] == '[');
    20     sscanf( response, "[ %d, %d, %d, %d ]", &x, &y, &w, &h );
    21     render_spu->defaultX = (int) x;
    22     render_spu->defaultY = (int) y;
    23     render_spu->defaultWidth = (unsigned int) w;
    24     render_spu->defaultHeight = (unsigned int) h;
    25 }
    26 
    27 static void set_default_visual( RenderSPU *render_spu, const char *response )
    28 {
    29     if (crStrlen(response) > 0) {
    30         if (crStrstr(response, "rgb"))
    31                 render_spu->default_visual |= CR_RGB_BIT;
    32         if (crStrstr(response, "alpha"))
    33                 render_spu->default_visual |= CR_ALPHA_BIT;
    34         if (crStrstr(response, "z") || crStrstr(response, "depth"))
    35                 render_spu->default_visual |= CR_DEPTH_BIT;
    36         if (crStrstr(response, "stencil"))
    37                 render_spu->default_visual |= CR_STENCIL_BIT;
    38         if (crStrstr(response, "accum"))
    39                 render_spu->default_visual |= CR_ACCUM_BIT;
    40         if (crStrstr(response, "stereo"))
    41                 render_spu->default_visual |= CR_STEREO_BIT;
    42         if (crStrstr(response, "multisample"))
    43                 render_spu->default_visual |= CR_MULTISAMPLE_BIT;
    44         if (crStrstr(response, "double"))
    45                 render_spu->default_visual |= CR_DOUBLE_BIT;
    46         if (crStrstr(response, "pbuffer"))
    47                 render_spu->default_visual |= CR_PBUFFER_BIT;
    48     }
    49 }
    50 
    51 static void set_display_string( RenderSPU *render_spu, const char *response )
    52 {
    53     if (!crStrcmp(response, "DEFAULT")) {
    54         const char *display = crGetenv("DISPLAY");
    55         if (display)
    56             crStrncpy(render_spu->display_string,
    57                                 display,
    58                                 sizeof(render_spu->display_string));
    59         else
    60             crStrcpy(render_spu->display_string, ""); /* empty string */
    61     }
    62     else {
    63         crStrncpy(render_spu->display_string,
    64                             response,
    65                             sizeof(render_spu->display_string));
    66     }
    67 }
    68 
    69 static void set_fullscreen( RenderSPU *render_spu, const char *response )
    70 {
    71     sscanf( response, "%d", &(render_spu->fullscreen) );
    72 }
    73 
    74 static void set_on_top( RenderSPU *render_spu, const char *response )
    75 {
    76     sscanf( response, "%d", &(render_spu->ontop) );
    77 }
    78 
    79 static void set_system_gl_path( RenderSPU *render_spu, const char *response )
    80 {
    81     if (crStrlen(response) > 0)
    82         crSetenv( "CR_SYSTEM_GL_PATH", response );
    83 }
    84 
    85 static void set_title( RenderSPU *render_spu, const char *response )
    86 {
    87     crFree( render_spu->window_title );
    88     render_spu->window_title = crStrdup( response );
    89 }
    90 
    91 #if defined(GLX)
    92 static void set_try_direct( RenderSPU *render_spu, const char *response )
    93 {
    94     sscanf( response, "%d", &(render_spu->try_direct) );
    95 }
    96 
    97 static void set_force_direct( RenderSPU *render_spu, const char *response )
    98 {
    99     sscanf( response, "%d", &(render_spu->force_direct) );
    100 }
    101 #endif /* GLX */
    102 
    103 static void render_to_app_window( RenderSPU *render_spu, const char *response )
    104 {
    105     sscanf( response, "%d", &(render_spu->render_to_app_window) );
    106 }
    107 
    108 static void render_to_crut_window( RenderSPU *render_spu, const char *response )
    109 {
    110     sscanf( response, "%d", &(render_spu->render_to_crut_window) );
    111 }
    112 
    113 static void resizable( RenderSPU *render_spu, const char *response )
    114 {
    115     sscanf( response, "%d", &(render_spu->resizable) );
    116 }
    117 
    118 static void set_borderless( RenderSPU *render_spu, const char *response )
    119 {
    120     sscanf( response, "%d", &(render_spu->borderless) );
    121 }
    122 
    123 static void set_cursor( RenderSPU *render_spu, const char *response )
    124 {
    125     sscanf( response, "%d", &(render_spu->drawCursor) );
    126 }
    127 
    128 static void gather_url( RenderSPU *render_spu, const char *response )
    129 {
    130     char protocol[4096], hostname[4096];
    131     unsigned short port;
    132    
    133     if (!crParseURL(response, protocol, hostname, &port, 0))
    134     {
    135         crError( "Malformed URL: \"%s\"", response );
    136     }
    137 
    138     render_spu->gather_port = port;
    139 }
    140 
    141 static void gather_userbuf( RenderSPU *render_spu, const char *response )
    142 {
    143     sscanf( response, "%d", &(render_spu->gather_userbuf_size) );
    144 }
    145 
    146 static void set_lut8( RenderSPU *render_spu, const char *response )
    147 {
    148     int a; 
    149     char **lut;
    150    
    151     if (!response[0]) return;
    152 
    153     lut = crStrSplit(response, ",");
    154     if (!lut) return;
    155 
    156     for (a=0; a<256; a++)
    157     {
    158         render_spu->lut8[0][a]  = crStrToInt(lut[a]);
    159         render_spu->lut8[1][a]  = crStrToInt(lut[256+a]);
    160         render_spu->lut8[2][a]  = crStrToInt(lut[512+a]);
    161     }
    162 
    163     crFreeStrings(lut);
    164 
    165     render_spu->use_lut8 = 1;
    166 }
    167 
    168 static void set_master_url ( RenderSPU *render_spu, char *response )
    169 {
    170     if (response[0])
    171         render_spu->swap_master_url = crStrdup( response );
    172     else
    173         render_spu->swap_master_url = NULL;
    174 }
    175 
    176 static void set_is_master ( RenderSPU *render_spu, char *response )
    177 {
    178     render_spu->is_swap_master = crStrToInt( response );
    179 }
    180 
    181 static void set_num_clients ( RenderSPU *render_spu, char *response )
    182 {
    183     render_spu->num_swap_clients = crStrToInt( response );
    184 }
    185 
    186 static void set_use_osmesa ( RenderSPU *render_spu, char *response )
    187 {
    188     int val = crStrToInt( response );
    189 #ifdef USE_OSMESA
    190     render_spu->use_osmesa = val;
    191 #else
    192     if (val != 0)
    193         crError( "renderspu with Conf(use_osmesa, 1) but not compiled with -DUSE_OSMESA");
    194 #endif
    195 }
    196 
    197 static void set_nv_swap_group( RenderSPU *render_spu, char *response )
    198 {
    199     render_spu->nvSwapGroup = crStrToInt( response );
    200     if (render_spu->nvSwapGroup < 0)
    201         render_spu->nvSwapGroup = 0;
    202 }
    203 
    204 static void set_ignore_papi( RenderSPU *render_spu, char *response )
    205 {
    206     render_spu->ignore_papi = crStrToInt( response );
    207 }
    208 
    209 static void set_ignore_window_moves( RenderSPU *render_spu, char *response )
    210 {
    211     render_spu->ignore_window_moves = crStrToInt( response );
    212 }
    213 
    214 static void set_pbuffer_size( RenderSPU *render_spu, const char *response )
    215 {
    216     CRASSERT(response[0] == '[');
    217     sscanf( response, "[ %d, %d ]",
    218                     &render_spu->pbufferWidth, &render_spu->pbufferHeight);
    219 }
    220 
    221 static void set_use_glxchoosevisual( RenderSPU *render_spu, char *response )
    222 {
    223     render_spu->use_glxchoosevisual = crStrToInt( response );
    224 }
    225 
    226 static void set_draw_bbox( RenderSPU *render_spu, char *response )
    227 {
    228     render_spu->draw_bbox = crStrToInt( response );
    229 }
    230 
    231 
    232 
    233 /* option, type, nr, default, min, max, title, callback
    234  */
    235 SPUOptions renderSPUOptions[] = {
    236     { "title", CR_STRING, 1, "Chromium Render SPU", NULL, NULL,
    237         "Window Title", (SPUOptionCB)set_title },
    238 
    239     { "window_geometry", CR_INT, 4, "[0, 0, 256, 256]", "[0, 0, 1, 1]", NULL,
    240         "Default Window Geometry (x,y,w,h)", (SPUOptionCB)set_window_geometry },
    241 
    242     { "fullscreen", CR_BOOL, 1, "0", NULL, NULL,
    243         "Full-screen Window", (SPUOptionCB)set_fullscreen },
    244 
    245     { "resizable", CR_BOOL, 1, "0", NULL, NULL,
    246         "Resizable Window", (SPUOptionCB)resizable },
    247 
    248     { "on_top", CR_BOOL, 1, "0", NULL, NULL,
    249         "Display on Top", (SPUOptionCB)set_on_top },
    250 
    251     { "borderless", CR_BOOL, 1, "0", NULL, NULL,
    252         "Borderless Window", (SPUOptionCB) set_borderless },
    253 
    254     { "default_visual", CR_STRING, 1, "rgb, double, depth", NULL, NULL,
    255         "Default GL Visual", (SPUOptionCB) set_default_visual },
    256 
    257 #if defined(GLX)
    258     { "try_direct", CR_BOOL, 1, "1", NULL, NULL,
    259         "Try Direct Rendering", (SPUOptionCB)set_try_direct  },
    260 
    261     { "force_direct", CR_BOOL, 1, "0", NULL, NULL,
    262         "Force Direct Rendering", (SPUOptionCB)set_force_direct },
    263 #endif
    264 
    265     { "render_to_app_window", CR_BOOL, 1, "0", NULL, NULL,
    266         "Render to Application window", (SPUOptionCB)render_to_app_window },
    267 
    268     { "render_to_crut_window", CR_BOOL, 1, "0", NULL, NULL,
    269         "Render to CRUT window", (SPUOptionCB)render_to_crut_window },
    270 
    271     { "show_cursor", CR_BOOL, 1, "0", NULL, NULL,
    272         "Show Software Cursor", (SPUOptionCB) set_cursor },
    273 
    274     { "system_gl_path", CR_STRING, 1, "", NULL, NULL,
    275         "System GL Path", (SPUOptionCB)set_system_gl_path },
    276 
    277     { "display_string", CR_STRING, 1, "DEFAULT", NULL, NULL,
    278         "X Display String", (SPUOptionCB)set_display_string },
    279 
    280     { "gather_url", CR_STRING, 1, "", NULL, NULL,
    281         "Gatherer URL", (SPUOptionCB)gather_url},
    282 
    283     { "gather_userbuf_size", CR_INT, 1, "0", NULL, NULL,
    284         "Size of Buffer to Allocate for Gathering", (SPUOptionCB)gather_userbuf},
    285 
    286     { "lut8", CR_STRING, 1, "", NULL, NULL,
    287         "8 bit RGB LUT", (SPUOptionCB)set_lut8},
    288 
    289     { "swap_master_url", CR_STRING, 1, "", NULL, NULL,
    290         "The URL to the master swapper", (SPUOptionCB)set_master_url },
    291 
    292     { "is_swap_master", CR_BOOL, 1, "0", NULL, NULL,
    293         "Is this the swap master", (SPUOptionCB)set_is_master },
    294 
    295     { "num_swap_clients", CR_INT, 1, "1", NULL, NULL,
    296         "How many swaps to wait on", (SPUOptionCB)set_num_clients },
    297 
    298     { "use_osmesa", CR_BOOL, 1, "0", NULL, NULL,
    299         "Use offscreen rendering with Mesa", (SPUOptionCB)set_use_osmesa },
    300      
    301     { "nv_swap_group", CR_INT, 1, "0", NULL, NULL,
    302         "NVIDIA Swap Group Number", (SPUOptionCB) set_nv_swap_group },
    303 
    304     { "ignore_papi", CR_BOOL, 1, "0", NULL, NULL,
    305         "Ignore Barrier and Semaphore calls", (SPUOptionCB) set_ignore_papi },
    306 
    307     { "ignore_window_moves", CR_BOOL, 1, "0", NULL, NULL,
    308         "Ignore crWindowPosition calls", (SPUOptionCB) set_ignore_window_moves },
    309 
    310     { "pbuffer_size", CR_INT, 2, "[0, 0]", "[0, 0]", NULL,
    311         "Maximum PBuffer Size", (SPUOptionCB) set_pbuffer_size },
    312 
    313     { "use_glxchoosevisual", CR_BOOL, 1, "1", NULL, NULL,
    314         "Use glXChooseVisual", (SPUOptionCB) set_use_glxchoosevisual },
    315 
    316     { "draw_bbox", CR_BOOL, 1, "0", NULL, NULL,
    317         "Draw Bounding Boxes", (SPUOptionCB) set_draw_bbox },
    318     { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    319 };
     13#include <iprt/env.h>
    32014
    32115
    32216void renderspuSetVBoxConfiguration( RenderSPU *render_spu )
    32317{
     18    const char *display = NULL;
    32419    int a;
    32520
     
    33227    render_spu->use_lut8 = 0;
    33328
    334     set_title(render_spu, "Chromium Render SPU");
    335     set_window_geometry(render_spu, "[0, 0, 0, 0]");
    336     set_fullscreen(render_spu, "0");
    337     resizable(render_spu, "0");
    338     set_on_top(render_spu, "1");
    339     set_borderless(render_spu, "1");
    340     set_default_visual(render_spu, "rgb, double, depth");
     29    crFree( render_spu->window_title );
     30    render_spu->window_title = crStrdup("Chromium Render SPU");
     31    render_spu->defaultX = 0;
     32    render_spu->defaultY = 0;
     33    render_spu->defaultWidth = 0;
     34    render_spu->defaultHeight = 0;
     35    render_spu->fullscreen = 0;
     36    render_spu->resizable = 0;
     37    render_spu->ontop = 1;
     38    render_spu->borderless = 1;
     39    render_spu->default_visual = CR_RGB_BIT | CR_DOUBLE_BIT | CR_DEPTH_BIT;
    34140#if defined(GLX)
    342     set_try_direct(render_spu, "1");
    343     set_force_direct(render_spu, "0");
     41    render_spu->try_direct = 1;
     42    render_spu->force_direct = 0;
    34443#endif
    345     render_to_app_window(render_spu, "0");
    346     render_to_crut_window(render_spu, "0");
    347     set_cursor(render_spu, "0");
    348     set_system_gl_path(render_spu, "");
    349     set_display_string(render_spu, "DEFAULT");
    350     gather_url(render_spu, "");
    351     gather_userbuf(render_spu, "0");
    352     set_lut8(render_spu, "");
    353     set_master_url(render_spu, "");
    354     set_is_master(render_spu, "0");
    355     set_num_clients(render_spu, "1");
    356     set_use_osmesa(render_spu, "0");
    357     set_nv_swap_group(render_spu, "0");
    358     set_ignore_papi(render_spu, "0");
    359     set_ignore_window_moves(render_spu, "0");
    360     set_pbuffer_size(render_spu, "[0, 0]");
    361     set_use_glxchoosevisual(render_spu, "1");
    362     set_draw_bbox(render_spu, "0");
     44    render_spu->render_to_app_window = 0;
     45    render_spu->render_to_crut_window = 0;
     46    render_spu->drawCursor = 0;
     47    render_spu->gather_userbuf_size = 0;
     48    render_spu->use_lut8 = 0;
     49    render_spu->num_swap_clients = 1;
     50    render_spu->nvSwapGroup = 0;
     51    render_spu->ignore_papi = 0;
     52    render_spu->ignore_window_moves = 0;
     53    render_spu->pbufferWidth = 0;
     54    render_spu->pbufferHeight = 0;
     55    render_spu->use_glxchoosevisual = 1;
     56    render_spu->draw_bbox = 0;
    36357
    364     render_spu->swap_mtu = 1024 * 500;
     58    display = RTEnvGet("DISPLAY");
     59    if (display)
     60        crStrncpy(render_spu->display_string, display, sizeof(render_spu->display_string));
     61    else
     62        crStrcpy(render_spu->display_string, ""); /* empty string */
    36563
    36664    /* Some initialization that doesn't really have anything to do
     
    37674    /* Config of "render force present main thread" (currently implemented by glx and wgl). */
    37775    {
    378         const char *forcePresent = crGetenv("CR_RENDER_FORCE_PRESENT_MAIN_THREAD");
     76        const char *forcePresent = RTEnvGet("CR_RENDER_FORCE_PRESENT_MAIN_THREAD");
    37977        if (forcePresent)
    38078            render_spu->force_present_main_thread = crStrToInt(forcePresent) ? 1 : 0;
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c

    r70851 r78190  
    44 * See the file LICENSE.txt for information on redistributing this software.
    55 */
    6 #if 00 /*TEMPORARY*/
    7 #include <unistd.h>
    8 #include "cr_rand.h"
    9 #endif
    10 
    116#include <GL/glx.h>
    127#include <X11/Xlib.h>
     
    1813#include <stdio.h>
    1914
    20 #include "cr_environment.h"
    2115#include "cr_error.h"
    2216#include "cr_string.h"
     
    2418#include "cr_process.h"
    2519#include "renderspu.h"
    26 
    2720
    2821/*
     
    948941    flags = CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
    949942
    950     /*
    951      * We pass the VNC's desktop windowID via an environment variable.
    952      * If we don't find one, we're not on a 3D-capable vncviewer, or
    953      * if we do find one, then create the renderspu subwindow as a
    954      * child of the vncviewer's desktop window.
    955      *
    956      * This is purely for the replicateSPU.
    957      *
    958      * NOTE: This is crufty, and will do for now. FIXME.
    959      */
    960     vncWin = crStrToInt( crGetenv("CRVNCWINDOW") );
    961     if (vncWin)
    962         parent = (Window) vncWin;
    963     else
    964         parent = RootWindow(dpy, visual->visual->screen);
    965 
     943    parent = RootWindow(dpy, visual->visual->screen);
    966944    if (render_spu_parent_window_id>0)
    967945    {
     
    19891967    CRASSERT(w);
    19901968
    1991 #if 00 /*TEMPORARY - FOR TESTING SWAP LOCK*/
    1992     if (1) {
    1993         /* random delay */
    1994         int k = crRandInt(1000 * 100, 750*1000);
    1995         static int first = 1;
    1996         if (first) {
    1997              crRandAutoSeed();
    1998              first = 0;
    1999         }
    2000         usleep(k);
    2001     }
    2002 #endif
    2003 
    20041969    /* render_to_app_window:
    20051970     * w->nativeWindow will only be non-zero if the
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c

    r69390 r78190  
    99#include "cr_error.h"
    1010#include "cr_string.h"
    11 #include "cr_url.h"
    12 #include "cr_environment.h"
    1311#include "renderspu.h"
    1412#include <stdio.h>
     13
     14#include <iprt/env.h>
    1515
    1616#ifdef RT_OS_DARWIN
     
    3232CRtsd _RenderTSD;
    3333#endif
    34 
    35 static void swapsyncConnect(void)
    36 {
    37     char hostname[4096], protocol[4096];
    38     unsigned short port;
    39 
    40     crNetInit(NULL, NULL);
    41 
    42     if (!crParseURL( render_spu.swap_master_url, protocol, hostname,
    43                     &port, 9876))
    44         crError( "Bad URL: %s", render_spu.swap_master_url );
    45 
    46     if (render_spu.is_swap_master)
    47     {
    48         int a;
    49 
    50         render_spu.swap_conns = (CRConnection **)crAlloc(
    51                         render_spu.num_swap_clients*sizeof(CRConnection *));
    52         for (a=0; a<render_spu.num_swap_clients; a++)
    53         {
    54             render_spu.swap_conns[a] = crNetAcceptClient( protocol, hostname, port,
    55                                                         render_spu.swap_mtu, 1);
    56         }
    57     }
    58     else
    59     {
    60         render_spu.swap_conns = (CRConnection **)crAlloc(sizeof(CRConnection *));
    61 
    62         render_spu.swap_conns[0] = crNetConnectToServer(render_spu.swap_master_url,
    63                                     port, render_spu.swap_mtu, 1);
    64         if (!render_spu.swap_conns[0])
    65             crError("Failed connection");
    66     }
    67 }
    6834
    6935#ifdef RT_OS_WINDOWS
     
    195161    renderspuSetVBoxConfiguration(&render_spu);
    196162
    197     if (render_spu.swap_master_url)
    198         swapsyncConnect();
    199 
    200 
    201163    /* Get our special functions. */
    202164    numSpecial = renderspuCreateFunctions( _cr_render_table );
     
    234196    render_spu.dummyWindowTable = crAllocHashtable();
    235197
    236     pcpwSetting = crGetenv("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT");
     198    pcpwSetting = RTEnvGet("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT");
    237199    if (pcpwSetting)
    238200    {
     
    271233    }
    272234#endif
    273 
    274 #ifdef DARWIN
    275 # ifdef VBOX_WITH_COCOA_QT
    276 # else /* VBOX_WITH_COCOA_QT */
    277     render_spu.hRootVisibleRegion = 0;
    278     render_spu.currentBufferName = 1;
    279     render_spu.uiDockUpdateTS = 0;
    280     /* Create a mutex for synchronizing events from the main Qt thread & this
    281        thread */
    282     RTSemFastMutexCreate(&render_spu.syncMutex);
    283     /* Create our window groups */
    284     CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &render_spu.pMasterGroup);
    285     CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &render_spu.pParentGroup);
    286     /* Make the correct z-layering */
    287     SendWindowGroupBehind (render_spu.pParentGroup, render_spu.pMasterGroup);
    288     /* and set the gParentGroup as parent for gMasterGroup. */
    289     SetWindowGroupParent (render_spu.pMasterGroup, render_spu.pParentGroup);
    290     /* Install the event handlers */
    291     EventTypeSpec eventList[] =
    292     {
    293         {kEventClassVBox, kEventVBoxUpdateContext}, /* Update the context after show/size/move events */
    294         {kEventClassVBox, kEventVBoxBoundsChanged}  /* Clip/Pos the OpenGL windows when the main window is changed in pos/size */
    295     };
    296     /* We need to process events from our main window */
    297     render_spu.hParentEventHandler = NewEventHandlerUPP(windowEvtHndlr);
    298     InstallApplicationEventHandler (render_spu.hParentEventHandler,
    299                                     GetEventTypeCount(eventList), eventList,
    300                                     NULL, NULL);
    301     render_spu.fInit = true;
    302 # endif /* VBOX_WITH_COCOA_QT */
    303 #endif /* DARWIN */
    304235
    305236    rc = renderspuDefaultCtxInit();
     
    536467    renderspuCleanupBase(true);
    537468
    538 #ifdef RT_OS_DARWIN
    539 # ifndef VBOX_WITH_COCOA_QT
    540     render_spu.fInit = false;
    541     DisposeEventHandlerUPP(render_spu.hParentEventHandler);
    542     ReleaseWindowGroup(render_spu.pMasterGroup);
    543     ReleaseWindowGroup(render_spu.pParentGroup);
    544     if (render_spu.hRootVisibleRegion)
    545     {
    546         DisposeRgn(render_spu.hRootVisibleRegion);
    547         render_spu.hRootVisibleRegion = 0;
    548     }
    549     render_spu.currentBufferName = 1;
    550     render_spu.uiDockUpdateTS = 0;
    551     RTSemFastMutexDestroy(render_spu.syncMutex);
    552 # else /* VBOX_WITH_COCOA_QT */
    553 # endif /* VBOX_WITH_COCOA_QT */
    554 #endif /* RT_OS_DARWIN */
    555 
    556469#ifdef RT_OS_WINDOWS
    557470    if (render_spu.dwWinThreadId)
     
    600513
    601514
    602 extern SPUOptions renderSPUOptions[];
    603 
    604515int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    605516         SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    606          SPUOptionsPtr *options, int *flags )
     517         int *flags )
    607518{
    608519    *name = "render";
     
    611522    *self = renderSPUSelfDispatch;
    612523    *cleanup = renderSPUCleanup;
    613     *options = renderSPUOptions;
    614524    *flags = (SPU_NO_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ZERO);
    615525
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c

    r70871 r78190  
    1313#include <memory.h>
    1414
    15 #include "cr_environment.h"
    1615#include "cr_error.h"
    1716#include "cr_string.h"
     
    1918#include "cr_mem.h"
    2019
     20#include <iprt/env.h>
    2121
    2222/* IAT patcher stuff */
     
    664664     */
    665665#ifdef VBOX_CR_SERVER_FORCE_WGL
    666     if (crGetenv( "CR_WGL_DO_NOT_USE_GDI" ) != NULL)
     666    if (RTEnvGet( "CR_WGL_DO_NOT_USE_GDI" ) != NULL)
    667667    {
    668668        pixelformat = render_spu.ws.wglChoosePixelFormat( hdc, ppfd );
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.def

    r69390 r78190  
    55EXPORTS
    66crUnpack
    7 crUnpackPush
    8 crUnpackPop
    97crUnpackSetReturnPointer
    108crUnpackSetWritebackPointer
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py

    r78116 r78190  
    2727DECLEXPORT(const unsigned char *) cr_unpackData = NULL;
    2828DECLEXPORT(const unsigned char *) cr_unpackDataEnd = NULL;
    29 SPUDispatchTable cr_unpackDispatch;
    30 
    31 static void crUnpackExtend(void);
    32 static void crUnpackExtendDbg(void);
     29
     30static void crUnpackExtend(PCrUnpackerState pState);
     31static void crUnpackExtendDbg(PCrUnpackerState pState);
    3332
    3433#if 0 //def DEBUG_misha
     
    7271    argument out of the buffer's operand area."""
    7372    if arg_type == "GLdouble" or arg_type == "GLclampd":
    74         retval = "READ_DOUBLE(%d)" % offset
    75     else:
    76         retval = "READ_DATA(%d, %s)" % (offset, arg_type)
     73        retval = "READ_DOUBLE(pState, %d)" % offset
     74    else:
     75        retval = "READ_DATA(pState, %d, %s)" % (offset, arg_type)
    7776    return retval
    7877
     
    8382    arg_len = apiutil.PacketLength( params )
    8483    if (return_type != 'void'):
    85         print('\tSET_RETURN_PTR(%d);' % (arg_len + 8)) # extended opcode plus packet length
     84        print('\tSET_RETURN_PTR(pState, %d);' % (arg_len + 8)) # extended opcode plus packet length
    8685    else:
    8786        paramList = [ ('foo', 'void *', 0) ]
    88         print('\tSET_RETURN_PTR(%d);' % (arg_len + 8 - apiutil.PacketLength(paramList)))
    89 
    90 
    91 def FindWritebackPointer( return_type, params ):
    92     """Emit a SET_WRITEBACK_PTR call."""
     87        print('\tSET_RETURN_PTR(pState, %d);' % (arg_len + 8 - apiutil.PacketLength(paramList)))
     88
     89
     90def getWritebackPointerOffset(return_type, params):
     91    """Returns the offset of the writeback pointer"""
    9392    arg_len = apiutil.PacketLength( params )
    9493    if return_type != 'void':
     
    9695        arg_len += apiutil.PacketLength( paramList )
    9796
    98     print('\tSET_WRITEBACK_PTR(%d);' % (arg_len + 8)) # extended opcode plus packet length
     97    return arg_len + 8 # extended opcode plus packet length
     98
     99def FindWritebackPointer( return_type, params ):
     100    """Emit a SET_WRITEBACK_PTR call."""
     101    print('\tSET_WRITEBACK_PTR(pState, %d);' % getWritebackPointerOffset(return_type, params))
    99102
    100103
     
    122125    else:
    123126        print("\t", end="")
    124     print("cr_unpackDispatch.%s(%s);" % (func_name, apiutil.MakeCallStringForDispatcher(params)))
     127    print("pState->pDispatchTbl->%s(%s);" % (func_name, apiutil.MakeCallStringForDispatcher(params)))
    125128
    126129
     
    134137    if arg_type == "GLdouble" or arg_type == "GLclampd":
    135138        print("#ifdef CR_UNALIGNED_ACCESS_OKAY")
    136         print("\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType))
     139        print("\tpState->pDispatchTbl->%s((%s) pState->pbUnpackData);" % (vec_func, vecType))
    137140        print("#else")
    138141        for index in range(0, vecSize):
    139             print("\tGLdouble v" + repr(index) + " = READ_DOUBLE(" + repr(index * 8) + ");")
     142            print("\tGLdouble v" + repr(index) + " = READ_DOUBLE(pState, " + repr(index * 8) + ");")
    140143        if return_type != "void":
    141             print("\t(void) cr_unpackDispatch.%s(" % func_name, end="")
     144            print("\t(void) pState->pDispatchTbl->%s(" % func_name, end="")
    142145        else:
    143             print("\tcr_unpackDispatch.%s(" % func_name, end="")
     146            print("\tpState->pDispatchTbl->%s(" % func_name, end="")
    144147        for index in range(0, vecSize):
    145148            print("v" + repr(index), end="")
     
    149152        print("#endif")
    150153    else:
    151         print("\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType))
     154        print("\tpState->pDispatchTbl->%s((%s) pState->pbUnpackData);" % (vec_func, vecType))
    152155
    153156
     
    166169    params = apiutil.Parameters(func_name)
    167170    return_type = apiutil.ReturnType(func_name)
    168    
    169     print("static void crUnpack%s(void)" % func_name)
     171
     172    packet_length = apiutil.PacketLength( params )
     173    print("static void crUnpack%s(PCrUnpackerState pState)" % func_name)
    170174    print("{")
    171 
    172     # Verify that the provided buffer length is what we expect.
    173     packet_length = apiutil.PacketLength( params )
    174     if packet_length > 0:
    175         print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
    176         print("\t{");
    177         print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
    178         print("\t\treturn;");
    179         print("\t}");
     175    if ("get" in apiutil.Properties(func_name)):
     176        print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % getWritebackPointerOffset(return_type, params));
     177    elif packet_length != 0:
     178        print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % packet_length);
    180179
    181180    vector_func = apiutil.VectorFunction(func_name)
     
    185184        MakeNormalCall( return_type, func_name, params )
    186185    if packet_length == 0:
    187         print("\tINCR_DATA_PTR_NO_ARGS( );")
    188     else:
    189         print("\tINCR_DATA_PTR(%d);" % packet_length)
     186        print("\tINCR_DATA_PTR_NO_ARGS(pState);")
     187    else:
     188        print("\tINCR_DATA_PTR(pState, %d);" % packet_length)
    190189    print("}\n")
    191190
     
    195194#
    196195print("""
    197 typedef struct __dispatchNode {
    198     const unsigned char *unpackData;
    199     struct __dispatchNode *next;
    200 } DispatchNode;
    201 
    202 static DispatchNode *unpackStack = NULL;
    203 
    204 static SPUDispatchTable *cr_lastDispatch = NULL;
    205 
    206 void crUnpackPush(void)
    207 {
    208     DispatchNode *node = (DispatchNode*)crAlloc( sizeof( *node ) );
    209     node->next = unpackStack;
    210     unpackStack = node;
    211     node->unpackData = cr_unpackData;
    212 }
    213 
    214 void crUnpackPop(void)
    215 {
    216     DispatchNode *node = unpackStack;
    217 
    218     if (!node)
    219     {
    220         crError( "crUnpackPop called with an empty stack!" );
    221     }
    222     unpackStack = node->next;
    223     cr_unpackData = node->unpackData;
    224     crFree( node );
    225 }
    226 
    227196CR_UNPACK_BUFFER_TYPE crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes)
    228197{
     
    249218}
    250219
    251 void crUnpack( const void *data, const void *data_end, const void *opcodes,
    252         unsigned int num_opcodes, SPUDispatchTable *table )
     220void crUnpack(PCrUnpackerState pState)
    253221{
    254222    unsigned int i;
    255     const unsigned char *unpack_opcodes;
    256     if (table != cr_lastDispatch)
    257     {
    258         crSPUCopyDispatchTable( &cr_unpackDispatch, table );
    259         cr_lastDispatch = table;
    260     }
    261 
    262     unpack_opcodes = (const unsigned char *)opcodes;
    263     cr_unpackData = (const unsigned char *)data;
    264     cr_unpackDataEnd = (const unsigned char *)data_end;
    265223
    266224#if defined(CR_UNPACK_DEBUG_OPCODES) || defined(CR_UNPACK_DEBUG_LAST_OPCODES)
    267     crDebug("crUnpack: %d opcodes", num_opcodes);
    268 #endif
    269 
    270     for (i = 0; i < num_opcodes; i++)
     225    crDebug("crUnpack: %d opcodes", pState->cOpcodes);
     226#endif
     227
     228    for (i = 0; i < pState->cOpcodes && RT_SUCCESS(pState->rcUnpack); i++)
    271229    {
    272230   
    273         CRDBGPTR_CHECKZ(writeback_ptr);
    274         CRDBGPTR_CHECKZ(return_ptr);
     231        CRDBGPTR_CHECKZ(pState->pWritebackPtr);
     232        CRDBGPTR_CHECKZ(pState->pReturnPtr);
    275233   
    276         /*crDebug(\"Unpacking opcode \%d\", *unpack_opcodes);*/
     234        /*crDebug(\"Unpacking opcode \%d\", *pState->pbOpcodes);*/
    277235#ifdef CR_UNPACK_DEBUG_PREV_OPCODES
    278         g_VBoxDbgCrPrevOpcode = *unpack_opcodes;
    279 #endif
    280         switch( *unpack_opcodes )
     236        g_VBoxDbgCrPrevOpcode = *pState->pbOpcodes;
     237#endif
     238        switch( *pState->pbOpcodes )
    281239        {""")
    282240
     
    295253                crDebug("Unpack: %s");
    296254#endif """ % apiutil.OpcodeName(func_name))
    297         print('\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name)
     255        print('\t\t\t\tcrUnpack%s(pState); \n\t\t\t\tbreak;' % func_name)
    298256
    299257print("""       
    300258            case CR_EXTEND_OPCODE:
    301259                #ifdef CR_UNPACK_DEBUG_OPCODES
    302                     crUnpackExtendDbg();
     260                    crUnpackExtendDbg(pState);
    303261                #else
    304262                # ifdef CR_UNPACK_DEBUG_LAST_OPCODES
    305                     if (i==(num_opcodes-1)) crUnpackExtendDbg();
     263                    if (i==(num_opcodes-1)) crUnpackExtendDbg(pState);
    306264                    else
    307265                # endif
    308                     crUnpackExtend();
     266                    crUnpackExtend(pState);
    309267                #endif
    310268                break;
     
    313271            case CR_CMDBLOCKFLUSH_OPCODE:
    314272            case CR_NOP_OPCODE:
    315                 INCR_DATA_PTR_NO_ARGS( );
     273                INCR_DATA_PTR_NO_ARGS(pState);
    316274                break;
    317275            default:
    318                 crError( "Unknown opcode: %d", *unpack_opcodes );
     276                crError( "Unknown opcode: %d", *pState->pbOpcodes );
    319277                break;
    320278        }
    321        
    322         CRDBGPTR_CHECKZ(writeback_ptr);
    323         CRDBGPTR_CHECKZ(return_ptr);
    324        
    325         unpack_opcodes--;
     279
     280        CRDBGPTR_CHECKZ(pState->pWritebackPtr);
     281        CRDBGPTR_CHECKZ(pState->pReturnPtr);
     282        pState->pbOpcodes--;
    326283    }
    327284}""")
     
    336293            return_type = apiutil.ReturnType(func_name)
    337294            params = apiutil.Parameters(func_name)
    338             print('static void crUnpackExtend%s(void)' % func_name)
     295            print('static void crUnpackExtend%s(PCrUnpackerState pState)' % func_name)
    339296            print('{')
    340 
    341             # Verify that the provided buffer length is what we expect.
    342             packet_length = apiutil.PacketLength( params )
    343             if packet_length > 0:
    344                 print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
    345                 print("\t{");
    346                 print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
    347                 print("\t\treturn;");
    348                 print("\t}");
    349 
     297            if ("get" in apiutil.Properties(func_name)):
     298                print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % (8 + getWritebackPointerOffset(return_type, params)));
     299            else:
     300                print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % (8 + apiutil.PacketLength( params )));
    350301            MakeNormalCall( return_type, func_name, params, 8 )
    351302            print('}\n')
    352303
    353 print('static void crUnpackExtend(void)')
     304print('static void crUnpackExtend(PCrUnpackerState pState)')
    354305print('{')
     306print('\tCHECK_BUFFER_SIZE_STATIC_LAST(pState, 4, GLenum);');
    355307print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' ))
    356308print('')
     
    371323        print('\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name ))
    372324#        print('\t\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name )))
    373         print('\t\t\tcrUnpackExtend%s( );' % func_name)
     325        print('\t\t\tcrUnpackExtend%s(pState);' % func_name)
    374326        print('\t\t\tbreak;')
    375327
     
    378330            break;
    379331    }
    380     INCR_VAR_PTR();
     332    INCR_VAR_PTR(pState);
    381333}""")
    382334
    383 print('static void crUnpackExtendDbg(void)')
     335print('static void crUnpackExtendDbg(PCrUnpackerState pState)')
    384336print('{')
     337print('\tCHECK_BUFFER_SIZE_STATIC_LAST(pState, 4, GLenum);');
    385338print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' ))
    386339print('')
     
    402355        if not apiutil.ExtendedOpcodeName(func_name) in nodebug_extopcodes:
    403356            print('\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name ))
    404         print('\t\t\tcrUnpackExtend%s( );' % func_name)
     357        print('\t\t\tcrUnpackExtend%s(pState);' % func_name)
    405358        print('\t\t\tbreak;')
    406359
     
    409362            break;
    410363    }
    411     INCR_VAR_PTR();
     364    INCR_VAR_PTR(pState);
    412365}""")
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_arrays.cpp

    r78189 r78190  
    2020 */
    2121
    22 void crUnpackExtendVertexPointer(void)
    23 {
    24     GLint size = READ_DATA( 8, GLint );
    25     GLenum type = READ_DATA( 12, GLenum );
    26     GLsizei stride = READ_DATA( 16, GLsizei );
    27     GLintptrARB pointer = (GLintptrARB) READ_DATA( 20, GLuint );
    28     cr_unpackDispatch.VertexPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    29 }
    30 
    31 void crUnpackExtendTexCoordPointer(void)
    32 {
    33     GLint size = READ_DATA( 8, GLint );
    34     GLenum type = READ_DATA( 12, GLenum );
    35     GLsizei stride = READ_DATA( 16, GLsizei );
    36     GLintptrARB pointer = READ_DATA( 20, GLuint );
    37     cr_unpackDispatch.TexCoordPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    38 }
    39 
    40 void crUnpackExtendNormalPointer(void)
    41 {
    42     GLenum type = READ_DATA( 8, GLenum );
    43     GLsizei stride = READ_DATA( 12, GLsizei );
    44     GLintptrARB pointer = READ_DATA( 16, GLuint );
    45     cr_unpackDispatch.NormalPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
    46 }
    47 
    48 void crUnpackExtendIndexPointer(void)
    49 {
    50     GLenum type = READ_DATA( 8, GLenum );
    51     GLsizei stride = READ_DATA( 12, GLsizei );
    52     GLintptrARB pointer = READ_DATA( 16, GLuint );
    53     cr_unpackDispatch.IndexPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
    54 }
    55 
    56 void crUnpackExtendEdgeFlagPointer(void)
    57 {
    58     GLsizei stride = READ_DATA( 8, GLsizei );
    59     GLintptrARB pointer = READ_DATA( 12, GLuint );
    60     cr_unpackDispatch.EdgeFlagPointer( stride, (void *) pointer, false /*fRealPtr*/ );
    61 }
    62 
    63 void crUnpackExtendColorPointer(void)
    64 {
    65     GLint size = READ_DATA( 8, GLint );
    66     GLenum type = READ_DATA( 12, GLenum );
    67     GLsizei stride = READ_DATA( 16, GLsizei );
    68     GLintptrARB pointer = READ_DATA( 20, GLuint );
    69     cr_unpackDispatch.ColorPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    70 }
    71 
    72 void crUnpackExtendFogCoordPointerEXT(void)
    73 {
    74     GLenum type = READ_DATA( 8, GLenum );
    75     GLsizei stride = READ_DATA( 12, GLsizei );
    76     GLintptrARB pointer = READ_DATA( 16, GLuint );
    77     cr_unpackDispatch.FogCoordPointerEXT( type, stride, (void *) pointer, false /*fRealPtr*/ );
    78 }
    79 
    80 void crUnpackExtendSecondaryColorPointerEXT(void)
    81 {
    82     GLint size = READ_DATA( 8, GLint );
    83     GLenum type = READ_DATA( 12, GLenum );
    84     GLsizei stride = READ_DATA( 16, GLsizei );
    85     GLintptrARB pointer = READ_DATA( 20, GLuint );
    86     cr_unpackDispatch.SecondaryColorPointerEXT( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    87 }
    88 
    89 void crUnpackExtendVertexAttribPointerARB(void)
    90 {
    91     GLuint index = READ_DATA( 8, GLuint);
    92     GLint size = READ_DATA( 12, GLint );
    93     GLenum type = READ_DATA( 16, GLenum );
    94     GLboolean normalized = READ_DATA( 20, GLboolean );
    95     GLsizei stride = READ_DATA( 24, GLsizei );
    96     GLintptrARB pointer = READ_DATA( 28, GLuint );
    97     cr_unpackDispatch.VertexAttribPointerARB( index, size, type, normalized, stride, (void *) pointer, false /*fRealPtr*/ );
    98 }
    99 
    100 void crUnpackExtendVertexAttribPointerNV(void)
    101 {
    102     GLuint index = READ_DATA( 8, GLuint);
    103     GLint size = READ_DATA( 12, GLint );
    104     GLenum type = READ_DATA( 16, GLenum );
    105     GLsizei stride = READ_DATA( 20, GLsizei );
    106     GLintptrARB pointer = READ_DATA( 24, GLuint );
    107     cr_unpackDispatch.VertexAttribPointerNV( index, size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    108 }
    109 
    110 void crUnpackExtendInterleavedArrays(void)
    111 {
    112     GLenum format = READ_DATA( 8, GLenum );
    113     GLsizei stride = READ_DATA( 12, GLsizei );
    114     GLintptrARB pointer = READ_DATA( 16, GLuint );
    115     cr_unpackDispatch.InterleavedArrays( format, stride, (void *) pointer, false /*fRealPtr*/ );
    116 }
    117 
    118 void crUnpackExtendDrawElements(void)
    119 {
    120     GLenum mode         = READ_DATA( 8, GLenum );
    121     GLsizei count       = READ_DATA( 12, GLsizei );
    122     GLenum type         = READ_DATA( 16, GLenum );
    123     GLintptrARB indices = READ_DATA( 20, GLuint );
     22void crUnpackExtendVertexPointer(PCrUnpackerState pState)
     23{
     24    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     25
     26    GLint size = READ_DATA(pState, 8, GLint );
     27    GLenum type = READ_DATA(pState, 12, GLenum );
     28    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     29    GLintptrARB pointer = (GLintptrARB) READ_DATA(pState, 20, GLuint );
     30    pState->pDispatchTbl->VertexPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     31}
     32
     33void crUnpackExtendTexCoordPointer(PCrUnpackerState pState)
     34{
     35    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     36
     37    GLint size = READ_DATA(pState, 8, GLint );
     38    GLenum type = READ_DATA(pState, 12, GLenum );
     39    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     40    GLintptrARB pointer = READ_DATA(pState, 20, GLuint );
     41    pState->pDispatchTbl->TexCoordPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     42}
     43
     44void crUnpackExtendNormalPointer(PCrUnpackerState pState)
     45{
     46    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     47
     48    GLenum type = READ_DATA(pState, 8, GLenum );
     49    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     50    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     51    pState->pDispatchTbl->NormalPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
     52}
     53
     54void crUnpackExtendIndexPointer(PCrUnpackerState pState)
     55{
     56    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     57
     58    GLenum type = READ_DATA(pState, 8, GLenum );
     59    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     60    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     61    pState->pDispatchTbl->IndexPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
     62}
     63
     64void crUnpackExtendEdgeFlagPointer(PCrUnpackerState pState)
     65{
     66    CHECK_BUFFER_SIZE_STATIC(pState, 12 + sizeof(GLuint) );
     67
     68    GLsizei stride = READ_DATA(pState, 8, GLsizei );
     69    GLintptrARB pointer = READ_DATA(pState, 12, GLuint );
     70    pState->pDispatchTbl->EdgeFlagPointer( stride, (void *) pointer, false /*fRealPtr*/ );
     71}
     72
     73void crUnpackExtendColorPointer(PCrUnpackerState pState)
     74{
     75    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     76
     77    GLint size = READ_DATA(pState, 8, GLint );
     78    GLenum type = READ_DATA(pState, 12, GLenum );
     79    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     80    GLintptrARB pointer = READ_DATA(pState, 20, GLuint );
     81    pState->pDispatchTbl->ColorPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     82}
     83
     84void crUnpackExtendFogCoordPointerEXT(PCrUnpackerState pState)
     85{
     86    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     87
     88    GLenum type = READ_DATA(pState, 8, GLenum );
     89    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     90    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     91    pState->pDispatchTbl->FogCoordPointerEXT( type, stride, (void *) pointer, false /*fRealPtr*/ );
     92}
     93
     94void crUnpackExtendSecondaryColorPointerEXT(PCrUnpackerState pState)
     95{
     96    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     97
     98    GLint size = READ_DATA(pState, 8, GLint );
     99    GLenum type = READ_DATA(pState, 12, GLenum );
     100    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     101    GLintptrARB pointer = READ_DATA(pState, 20, GLuint );
     102    pState->pDispatchTbl->SecondaryColorPointerEXT( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     103}
     104
     105void crUnpackExtendVertexAttribPointerARB(PCrUnpackerState pState)
     106{
     107    CHECK_BUFFER_SIZE_STATIC(pState, 28 + sizeof(GLuint) );
     108
     109    GLuint index = READ_DATA(pState, 8, GLuint);
     110    GLint size = READ_DATA(pState, 12, GLint );
     111    GLenum type = READ_DATA(pState, 16, GLenum );
     112    GLboolean normalized = READ_DATA(pState, 20, GLboolean );
     113    GLsizei stride = READ_DATA(pState, 24, GLsizei );
     114    GLintptrARB pointer = READ_DATA(pState, 28, GLuint );
     115    pState->pDispatchTbl->VertexAttribPointerARB( index, size, type, normalized, stride, (void *) pointer, false /*fRealPtr*/ );
     116}
     117
     118void crUnpackExtendVertexAttribPointerNV(PCrUnpackerState pState)
     119{
     120    CHECK_BUFFER_SIZE_STATIC(pState, 24 + sizeof(GLuint) );
     121
     122    GLuint index = READ_DATA(pState, 8, GLuint);
     123    GLint size = READ_DATA(pState, 12, GLint );
     124    GLenum type = READ_DATA(pState, 16, GLenum );
     125    GLsizei stride = READ_DATA(pState, 20, GLsizei );
     126    GLintptrARB pointer = READ_DATA(pState, 24, GLuint );
     127    pState->pDispatchTbl->VertexAttribPointerNV( index, size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     128}
     129
     130void crUnpackExtendInterleavedArrays(PCrUnpackerState pState)
     131{
     132    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     133
     134    GLenum format = READ_DATA(pState, 8, GLenum );
     135    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     136    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     137    pState->pDispatchTbl->InterleavedArrays( format, stride, (void *) pointer, false /*fRealPtr*/ );
     138}
     139
     140void crUnpackExtendDrawElements(PCrUnpackerState pState)
     141{
     142#ifdef CR_ARB_vertex_buffer_object
     143    CHECK_BUFFER_SIZE_STATIC(pState, 28);
     144#else
     145    CHECK_BUFFER_SIZE_STATIC(pState, 24);
     146#endif
     147
     148    GLenum mode         = READ_DATA(pState, 8, GLenum );
     149    GLsizei count       = READ_DATA(pState, 12, GLsizei );
     150    GLenum type         = READ_DATA(pState, 16, GLenum );
     151    GLintptrARB indices = READ_DATA(pState, 20, GLuint );
    124152    void * indexptr;
     153
     154    size_t cbElem = 0;
     155    switch (type)
     156    {
     157        case GL_UNSIGNED_BYTE:
     158            cbElem = sizeof(GLubyte);
     159            break;
     160        case GL_UNSIGNED_SHORT:
     161            cbElem = sizeof(GLubyte);
     162            break;
     163        case GL_UNSIGNED_INT:
     164            cbElem = sizeof(GLubyte);
     165            break;
     166        default:
     167            crError("crUnpackExtendDrawElements: Invalid type (%#x) passed!\n", type);
     168            pState->rcUnpack = VERR_INVALID_PARAMETER;
     169            return;
     170    }
     171
    125172#ifdef CR_ARB_vertex_buffer_object
    126     GLboolean hasidxdata = READ_DATA(24, GLint);
    127     indexptr = hasidxdata ? DATA_POINTER(28, void) : (void*)indices;
     173    GLboolean hasidxdata = READ_DATA(pState, 24, GLint);
     174    indexptr = hasidxdata ? DATA_POINTER(pState, 28, void) : (void*)indices;
     175    if (hasidxdata)
     176        CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    128177#else
    129     indexptr = DATA_POINTER(24, void);
     178    indexptr = DATA_POINTER(pState, 24, void);
     179    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    130180#endif
    131     cr_unpackDispatch.DrawElements(mode, count, type, indexptr);
    132 }
    133 
    134 void crUnpackExtendDrawRangeElements(void)
    135 {
    136     GLenum mode         = READ_DATA( 8, GLenum );
    137     GLuint start        = READ_DATA( 12, GLuint );
    138     GLuint end          = READ_DATA( 16, GLuint );
    139     GLsizei count       = READ_DATA( 20, GLsizei );
    140     GLenum type         = READ_DATA( 24, GLenum );
    141     GLintptrARB indices = READ_DATA( 28, GLuint );
     181    pState->pDispatchTbl->DrawElements(mode, count, type, indexptr);
     182}
     183
     184void crUnpackExtendDrawRangeElements(PCrUnpackerState pState)
     185{
     186#ifdef CR_ARB_vertex_buffer_object
     187    CHECK_BUFFER_SIZE_STATIC(pState, 36);
     188#else
     189    CHECK_BUFFER_SIZE_STATIC(pState, 32);
     190#endif
     191
     192    GLenum mode         = READ_DATA(pState, 8, GLenum );
     193    GLuint start        = READ_DATA(pState, 12, GLuint );
     194    GLuint end          = READ_DATA(pState, 16, GLuint );
     195    GLsizei count       = READ_DATA(pState, 20, GLsizei );
     196    GLenum type         = READ_DATA(pState, 24, GLenum );
     197    GLintptrARB indices = READ_DATA(pState, 28, GLuint );
    142198    void * indexptr;
     199
     200    size_t cbElem = 0;
     201    switch (type)
     202    {
     203        case GL_UNSIGNED_BYTE:
     204            cbElem = sizeof(GLubyte);
     205            break;
     206        case GL_UNSIGNED_SHORT:
     207            cbElem = sizeof(GLubyte);
     208            break;
     209        case GL_UNSIGNED_INT:
     210            cbElem = sizeof(GLubyte);
     211            break;
     212        default:
     213            crError("crUnpackExtendDrawElements: Invalid type (%#x) passed!\n", type);
     214            pState->rcUnpack = VERR_INVALID_PARAMETER;
     215            return;
     216    }
    143217#ifdef CR_ARB_vertex_buffer_object
    144     GLboolean hasidxdata = READ_DATA(32, GLint);
    145     indexptr = hasidxdata ? DATA_POINTER(36, void) : (void*)indices;
     218    GLboolean hasidxdata = READ_DATA(pState, 32, GLint);
     219    indexptr = hasidxdata ? DATA_POINTER(pState, 36, void) : (void*)indices;
     220    if (hasidxdata)
     221        CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    146222#else
    147     indexptr = DATA_POINTER(32, void);
     223    indexptr = DATA_POINTER(pState, 32, void);
     224    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    148225#endif
    149     cr_unpackDispatch.DrawRangeElements(mode, start, end, count, type, indexptr);
    150 }
    151 
    152 void crUnpackMultiDrawArraysEXT(void)
    153 {
     226
     227    pState->pDispatchTbl->DrawRangeElements(mode, start, end, count, type, indexptr);
     228}
     229
     230void crUnpackMultiDrawArraysEXT(PCrUnpackerState pState)
     231{
     232    RT_NOREF(pState);
    154233    crError( "Can't decode MultiDrawArraysEXT" );
    155234}
    156235
    157 void crUnpackMultiDrawElementsEXT(void)
    158 {
     236void crUnpackMultiDrawElementsEXT(PCrUnpackerState pState)
     237{
     238    RT_NOREF(pState);
    159239    crError( "Can't decode MultiDrawElementsEXT" );
    160240}
    161241
    162 static void crUnpackSetClientPointerByIndex(int index, GLint size,
     242static void crUnpackSetClientPointerByIndex(PCrUnpackerState pState, int index, GLint size,
    163243                                            GLenum type, GLboolean normalized,
    164244                                            GLsizei stride, const GLvoid *pointer, CRClientState *c, int fRealPtr)
     
    171251        {
    172252            case 0:
    173                 cr_unpackDispatch.VertexPointer(size, type, stride, pointer, fRealPtr);
     253                pState->pDispatchTbl->VertexPointer(size, type, stride, pointer, fRealPtr);
    174254                break;
    175255            case 1:
    176                 cr_unpackDispatch.ColorPointer(size, type, stride, pointer, fRealPtr);
     256                pState->pDispatchTbl->ColorPointer(size, type, stride, pointer, fRealPtr);
    177257                break;
    178258            case 2:
    179                 cr_unpackDispatch.FogCoordPointerEXT(type, stride, pointer, fRealPtr);
     259                pState->pDispatchTbl->FogCoordPointerEXT(type, stride, pointer, fRealPtr);
    180260                break;
    181261            case 3:
    182                 cr_unpackDispatch.SecondaryColorPointerEXT(size, type, stride, pointer, fRealPtr);
     262                pState->pDispatchTbl->SecondaryColorPointerEXT(size, type, stride, pointer, fRealPtr);
    183263                break;
    184264            case 4:
    185                 cr_unpackDispatch.EdgeFlagPointer(stride, pointer, fRealPtr);
     265                pState->pDispatchTbl->EdgeFlagPointer(stride, pointer, fRealPtr);
    186266                break;
    187267            case 5:
    188                 cr_unpackDispatch.IndexPointer(type, stride, pointer, fRealPtr);
     268                pState->pDispatchTbl->IndexPointer(type, stride, pointer, fRealPtr);
    189269                break;
    190270            case 6:
    191                 cr_unpackDispatch.NormalPointer(type, stride, pointer, fRealPtr);
     271                pState->pDispatchTbl->NormalPointer(type, stride, pointer, fRealPtr);
    192272                break;
    193273        }
     
    198278        if ((index-7)!=curTexUnit)
    199279        {
    200             cr_unpackDispatch.ClientActiveTextureARB(GL_TEXTURE0_ARB+index-7);
    201         }
    202         cr_unpackDispatch.TexCoordPointer(size, type, stride, pointer, fRealPtr);
     280            pState->pDispatchTbl->ClientActiveTextureARB(GL_TEXTURE0_ARB+index-7);
     281        }
     282        pState->pDispatchTbl->TexCoordPointer(size, type, stride, pointer, fRealPtr);
    203283        if ((index-7)!=curTexUnit)
    204284        {
    205             cr_unpackDispatch.ClientActiveTextureARB(GL_TEXTURE0_ARB+curTexUnit);
     285            pState->pDispatchTbl->ClientActiveTextureARB(GL_TEXTURE0_ARB+curTexUnit);
    206286        }
    207287    }
    208288    else
    209289    {
    210         cr_unpackDispatch.VertexAttribPointerARB(index-7-CR_MAX_TEXTURE_UNITS,
     290        pState->pDispatchTbl->VertexAttribPointerARB(index-7-CR_MAX_TEXTURE_UNITS,
    211291                                                 size, type, normalized, stride, pointer, fRealPtr);
    212292    }
    213293}
    214294
    215 void crUnpackExtendLockArraysEXT(void)
    216 {
    217     GLint first    = READ_DATA(sizeof(int) + 4, GLint);
    218     GLint count    = READ_DATA(sizeof(int) + 8, GLint);
    219     int numenabled = READ_DATA(sizeof(int) + 12, int);
     295void crUnpackExtendLockArraysEXT(PCrUnpackerState pState)
     296{
     297    CHECK_BUFFER_SIZE_STATIC(pState, sizeof(int) + 12 + sizeof(int));
     298
     299    GLint first    = READ_DATA(pState, sizeof(int) + 4, GLint);
     300    GLint count    = READ_DATA(pState, sizeof(int) + 8, GLint);
     301    int numenabled = READ_DATA(pState, sizeof(int) + 12, int);
    220302
    221303    CRContext *g = crStateGetCurrent();
     
    223305    CRClientPointer *cp;
    224306    int i, index, offset;
    225     unsigned char *data;
    226    
     307    uint8_t *data;
     308
    227309    if (first < 0 || count <= 0 || first >= INT32_MAX - count)
    228310    {
     
    243325    for (i = 0; i < numenabled; ++i)
    244326    {
    245         index = READ_DATA(offset, int);
     327        CHECK_BUFFER_SIZE_STATIC_LAST(pState, offset, int);
     328        index = READ_DATA(pState, offset, int);
    246329        offset += sizeof(int);
    247330
     
    258341            }
    259342
    260             data = crAlloc((first + count) * cp->bytesPerIndex);
     343            data = (uint8_t *)crAlloc((first + count) * cp->bytesPerIndex);
    261344
    262345            if (data)
    263346            {
    264                 crMemcpy(data + first * cp->bytesPerIndex, DATA_POINTER(offset, GLvoid), count * cp->bytesPerIndex);
     347                crMemcpy(data + first * cp->bytesPerIndex, DATA_POINTER(pState, offset, GLvoid), count * cp->bytesPerIndex);
    265348                /*crDebug("crUnpackExtendLockArraysEXT: old cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
    266349                        index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
    267                 crUnpackSetClientPointerByIndex(index, cp->size, cp->type, cp->normalized, 0, data, c, 1 /*fRealPtr*/);
     350                crUnpackSetClientPointerByIndex(pState, index, cp->size, cp->type, cp->normalized, 0, data, c, 1);
    268351                /*crDebug("crUnpackExtendLockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
    269352                        index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
     
    284367    }
    285368
    286     cr_unpackDispatch.LockArraysEXT(first, count);
    287 }
    288 
    289 void crUnpackExtendUnlockArraysEXT(void)
     369    pState->pDispatchTbl->LockArraysEXT(first, count);
     370}
     371
     372void crUnpackExtendUnlockArraysEXT(PCrUnpackerState pState)
    290373{
    291374    int i;
     
    296379    /*crDebug("crUnpackExtendUnlockArraysEXT");*/
    297380
    298     cr_unpackDispatch.UnlockArraysEXT();
     381    pState->pDispatchTbl->UnlockArraysEXT();
    299382
    300383    for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i)
     
    309392            cp->prevPtr = NULL;
    310393            cp->fPrevRealPtr = 0;
    311             crUnpackSetClientPointerByIndex(i, cp->size, cp->type, cp->normalized, cp->prevStride, prevPtr, c, fPrevRealPtr);
     394
     395            crUnpackSetClientPointerByIndex(pState, i, cp->size, cp->type, cp->normalized, cp->prevStride, prevPtr, c, fPrevRealPtr);
    312396            /*crDebug("crUnpackExtendUnlockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
    313397                    i, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py

    r78086 r78190  
    1818#define UNPACK_EXTEND_H 1
    1919
     20#include "cr_unpack.h"
     21
    2022#ifdef __cplusplus
    2123extern "C" {
     
    3032for func_name in apiutil.AllSpecials( "unpacker" ):
    3133        if "extpack" in apiutil.ChromiumProps(func_name):
    32                 print('extern void crUnpackExtend%s(void);' % func_name)
     34                print('extern void crUnpackExtend%s(PCrUnpackerState pState);' % func_name)
    3335        else:
    34                 print('extern void crUnpack%s(void);' % func_name)
     36                print('extern void crUnpack%s(PCrUnpackerState pState);' % func_name)
    3537
    3638print("""
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py

    r69390 r78190  
    2222print("""#ifndef CR_UNPACKFUNCTIONS_H
    2323#define CR_UNPACKFUNCTIONS_H
     24
     25#include "cr_unpack.h"
    2426""")
    2527
    2628for func_name in sorted(gl_mapping.keys()):
    2729        ( return_type, arg_names, arg_types ) = gl_mapping[func_name]
    28         print('void crUnpack%s();' %( func_name ))
    29 print('void crUnpackExtend();')
     30        print('void crUnpack%s(PCrUnpackerState pState);' %( func_name ))
     31print('void crUnpackExtend(PCrUnpackerState pState);')
    3032print('\n#endif /* CR_UNPACKFUNCTIONS_H */')
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_misc.cpp

    r78189 r78190  
    77#include "unpacker.h"
    88
    9 void crUnpackExtendChromiumParametervCR( void  )
     9void crUnpackExtendChromiumParametervCR(PCrUnpackerState pState)
    1010{
    11     GLenum target = READ_DATA( 8, GLenum );
    12     GLenum type = READ_DATA( 12, GLenum );
    13     GLsizei count = READ_DATA( 16, GLsizei );
    14     GLvoid *values = DATA_POINTER( 20, GLvoid );
     11    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei);
    1512
    16     cr_unpackDispatch.ChromiumParametervCR(target, type, count, values);
     13    GLenum target = READ_DATA(pState, 8, GLenum );
     14    GLenum type = READ_DATA(pState, 12, GLenum );
     15    GLsizei count = READ_DATA(pState, 16, GLsizei );
     16    GLvoid *values = DATA_POINTER(pState, 20, GLvoid );
    1717
     18    size_t cbValue = 0;
     19    switch (type)
     20    {
     21        case GL_BYTE:
     22        case GL_UNSIGNED_BYTE:
     23            cbValue = sizeof(GLbyte);
     24            break;
     25        case GL_SHORT:
     26        case GL_UNSIGNED_SHORT:
     27            cbValue = sizeof(GLshort);
     28            break;
     29        case GL_INT:
     30        case GL_UNSIGNED_INT:
     31            cbValue = sizeof(GLint);
     32            break;
     33        case GL_FLOAT:
     34            cbValue = sizeof(GLfloat);
     35            break;
     36        case GL_DOUBLE:
     37            cbValue = sizeof(GLdouble);
     38            break;
     39        default:
     40            crError("crUnpackExtendChromiumParametervCR: Invalid type (%#x) passed!\n", type);
     41            pState->rcUnpack = VERR_INVALID_PARAMETER;
     42            return;
     43    }
    1844
    19     /*
    20     INCR_VAR_PTR();
    21     */
     45    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, values, count, cbValue);
     46    pState->pDispatchTbl->ChromiumParametervCR(target, type, count, values);
    2247}
    2348
    24 void crUnpackExtendDeleteQueriesARB(void)
     49void crUnpackExtendDeleteQueriesARB(PCrUnpackerState pState)
    2550{
    26     GLsizei n = READ_DATA( 8, GLsizei );
    27     const GLuint *ids = DATA_POINTER(12, GLuint);
     51    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei);
    2852
    29     if (n <= 0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(12 + n * sizeof(GLuint)))
     53    GLsizei n = READ_DATA(pState, 8, GLsizei );
     54    const GLuint *ids = DATA_POINTER(pState, 12, GLuint);
     55
     56    if (n <= 0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(pState, 12 + n * sizeof(GLuint)))
    3057    {
    3158        crError("crUnpackExtendDeleteQueriesARB: parameter 'n' is out of range");
     
    3360    }
    3461
    35     cr_unpackDispatch.DeleteQueriesARB(n, ids);
     62
     63    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, ids, n, GLuint);
     64    pState->pDispatchTbl->DeleteQueriesARB(n, ids);
    3665}
    3766
    38 void crUnpackExtendGetPolygonStipple(void)
     67void crUnpackExtendGetPolygonStipple(PCrUnpackerState pState)
    3968{
    40     GLubyte *mask;
     69    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, CRNetworkPointer);
    4170
    42     SET_RETURN_PTR( 8 );
    43     SET_WRITEBACK_PTR( 16 );
    44     mask = DATA_POINTER(8, GLubyte);
     71    SET_RETURN_PTR(pState, 8 );
     72    SET_WRITEBACK_PTR(pState, 16 );
     73    GLubyte *mask = DATA_POINTER(pState, 8, GLubyte);
    4574
    46     cr_unpackDispatch.GetPolygonStipple( mask );
     75    /*
     76     * This method will write to the set writeback buffer and not to the mask argument, the mask argument is only used
     77     * for GL_PIXEL_PACK_BUFFER_ARB contexts where it denotes an offset (GLint) which was already enclosed in the
     78     * buffer verification.
     79     */
     80    pState->pDispatchTbl->GetPolygonStipple( mask );
    4781}
    4882
    49 void crUnpackExtendGetPixelMapfv(void)
     83void crUnpackExtendGetPixelMapfv(PCrUnpackerState pState)
    5084{
    51     GLenum map = READ_DATA( 8, GLenum );
    52     GLfloat *values;
     85    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
    5386
    54     SET_RETURN_PTR( 12 );
    55     SET_WRITEBACK_PTR( 20 );
    56     values = DATA_POINTER(12, GLfloat);
     87    GLenum map = READ_DATA(pState, 8, GLenum );
    5788
    58     cr_unpackDispatch.GetPixelMapfv( map, values );
     89    SET_RETURN_PTR(pState, 12 );
     90    SET_WRITEBACK_PTR(pState, 20 );
     91    GLfloat *values = DATA_POINTER(pState, 12, GLfloat);
     92
     93    /* see crUnpackExtendGetPolygonStipple() for verification notes. */
     94    pState->pDispatchTbl->GetPixelMapfv( map, values );
    5995}
    6096
    61 void crUnpackExtendGetPixelMapuiv(void)
     97void crUnpackExtendGetPixelMapuiv(PCrUnpackerState pState)
    6298{
    63     GLenum map = READ_DATA( 8, GLenum );
     99    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
     100
     101    GLenum map = READ_DATA(pState, 8, GLenum );
    64102    GLuint *values;
    65103
    66     SET_RETURN_PTR( 12 );
    67     SET_WRITEBACK_PTR( 20 );
    68     values = DATA_POINTER(12, GLuint);
     104    SET_RETURN_PTR(pState, 12 );
     105    SET_WRITEBACK_PTR(pState, 20 );
     106    values = DATA_POINTER(pState, 12, GLuint);
    69107
    70     cr_unpackDispatch.GetPixelMapuiv( map, values );
     108    /* see crUnpackExtendGetPolygonStipple() for verification notes. */
     109    pState->pDispatchTbl->GetPixelMapuiv( map, values );
    71110}
    72111
    73 void crUnpackExtendGetPixelMapusv(void)
     112void crUnpackExtendGetPixelMapusv(PCrUnpackerState pState)
    74113{
    75     GLenum map = READ_DATA( 8, GLenum );
     114    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
     115
     116    GLenum map = READ_DATA(pState, 8, GLenum );
    76117    GLushort *values;
    77118
    78     SET_RETURN_PTR( 12 );
    79     SET_WRITEBACK_PTR( 20 );
    80     values = DATA_POINTER(12, GLushort);
     119    SET_RETURN_PTR(pState, 12 );
     120    SET_WRITEBACK_PTR(pState, 20 );
     121    values = DATA_POINTER(pState, 12, GLushort);
    81122
    82     cr_unpackDispatch.GetPixelMapusv( map, values );
     123    /* see crUnpackExtendGetPolygonStipple() for verification notes. */
     124    pState->pDispatchTbl->GetPixelMapusv( map, values );
    83125}
    84126
    85 void crUnpackExtendVBoxTexPresent(void)
     127void crUnpackExtendVBoxTexPresent(PCrUnpackerState pState)
    86128{
    87     GLuint texture = READ_DATA( 8, GLuint );
    88     GLuint cfg = READ_DATA( 12, GLuint );
    89     GLint xPos = READ_DATA( 16, GLint );
    90     GLint yPos = READ_DATA( 20, GLint );
    91     GLint cRects = READ_DATA( 24, GLint );
    92     GLint *pRects = (GLint *)DATA_POINTER( 28, GLvoid );
     129    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, GLint);
    93130
    94     if (cRects <= 0 || cRects >= INT32_MAX / sizeof(GLint) / 8 || !DATA_POINTER_CHECK(28 + 4 * cRects * sizeof(GLint)))
     131    GLuint texture = READ_DATA(pState, 8, GLuint );
     132    GLuint cfg = READ_DATA(pState, 12, GLuint );
     133    GLint xPos = READ_DATA(pState, 16, GLint );
     134    GLint yPos = READ_DATA(pState, 20, GLint );
     135    GLint cRects = READ_DATA(pState, 24, GLint );
     136    GLint *pRects = (GLint *)DATA_POINTER(pState, 28, GLvoid );
     137
     138    if (cRects <= 0 || cRects >= INT32_MAX / sizeof(GLint) / 8 || !DATA_POINTER_CHECK(pState, 28 + 4 * cRects * sizeof(GLint)))
    95139    {
    96140        crError("crUnpackExtendVBoxTexPresent: parameter 'cRects' is out of range");
     
    98142    }
    99143
    100     cr_unpackDispatch.VBoxTexPresent( texture, cfg, xPos, yPos, cRects, pRects );
     144    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pRects, cRects * 4, GLint); /* Each rect as 4 points. */
     145    pState->pDispatchTbl->VBoxTexPresent( texture, cfg, xPos, yPos, cRects, pRects );
    101146}
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.cpp

    r78189 r78190  
    2323#include "cr_version.h"
    2424
    25 void crUnpackExtendBindAttribLocation(void)
    26 {
    27     GLuint program   = READ_DATA(8, GLuint);
    28     GLuint index     = READ_DATA(12, GLuint);
    29     const char *name = DATA_POINTER(16, const char);
    30 
    31     cr_unpackDispatch.BindAttribLocation(program, index, name);
    32 }
    33 
    34 void crUnpackExtendShaderSource(void)
    35 {
     25void crUnpackExtendBindAttribLocation(PCrUnpackerState pState)
     26{
     27    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLuint);
     28
     29    GLuint program   = READ_DATA(pState, 8, GLuint);
     30    GLuint index     = READ_DATA(pState, 12, GLuint);
     31    const char *name = DATA_POINTER(pState, 16, const char);
     32
     33    CHECK_STRING_FROM_PTR_UPDATE_NO_SZ(pState, name);
     34    pState->pDispatchTbl->BindAttribLocation(program, index, name);
     35}
     36
     37void crUnpackExtendShaderSource(PCrUnpackerState pState)
     38{
     39    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei);
     40
    3641    GLint *length = NULL;
    37     GLuint shader = READ_DATA(8, GLuint);
    38     GLsizei count = READ_DATA(12, GLsizei);
    39     GLint hasNonLocalLen = READ_DATA(16, GLsizei);
    40     GLint *pLocalLength = DATA_POINTER(20, GLint);
     42    GLuint shader = READ_DATA(pState, 8, GLuint);
     43    GLsizei count = READ_DATA(pState, 12, GLsizei);
     44    GLint hasNonLocalLen = READ_DATA(pState, 16, GLsizei);
     45    GLint *pLocalLength = DATA_POINTER(pState, 20, GLint);
    4146    char **ppStrings = NULL;
    4247    GLsizei i, j, jUpTo;
     
    4853        return;
    4954    }
    50 
     55    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pLocalLength, count, GLint);
     56
     57    /** @todo More verification required here. */
    5158    pos = 20 + count * sizeof(*pLocalLength);
    5259
    53     if (!DATA_POINTER_CHECK(pos))
     60    if (!DATA_POINTER_CHECK(pState, pos))
    5461    {
    5562        crError("crUnpackExtendShaderSource: pos %d is out of range", pos);
     
    5966    if (hasNonLocalLen > 0)
    6067    {
    61         length = DATA_POINTER(pos, GLint);
     68        length = DATA_POINTER(pState, pos, GLint);
    6269        pos += count * sizeof(*length);
    6370    }
    6471
    65     if (!DATA_POINTER_CHECK(pos))
     72    pos_check = pos;
     73
     74    if (!DATA_POINTER_CHECK(pState, pos_check))
    6675    {
    6776        crError("crUnpackExtendShaderSource: pos %d is out of range", pos);
     
    7382    for (i = 0; i < count; ++i)
    7483    {
    75         if (pLocalLength[i] <= 0 || pos_check >= INT32_MAX - pLocalLength[i])
     84        if (pLocalLength[i] <= 0 || pos_check >= INT32_MAX - pLocalLength[i] || !DATA_POINTER_CHECK(pState, pos_check))
    7685        {
    7786            crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check);
     
    8190        pos_check += pLocalLength[i];
    8291
    83         if (!DATA_POINTER_CHECK(pos_check))
     92        if (!DATA_POINTER_CHECK(pState, pos_check))
    8493        {
    8594            crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check);
     
    8897    }
    8998
    90     ppStrings = crAlloc(count * sizeof(char*));
     99    ppStrings = (char **)crAlloc(count * sizeof(char*));
    91100    if (!ppStrings) return;
    92101
    93102    for (i = 0; i < count; ++i)
    94103    {
    95         ppStrings[i] = DATA_POINTER(pos, char);
     104        CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, pos); /** @todo Free ppStrings on error. */
     105        ppStrings[i] = DATA_POINTER(pState, pos, char);
    96106        pos += pLocalLength[i];
    97107        if (!length)
     
    114124    }
    115125
    116 //    cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
    117     cr_unpackDispatch.ShaderSource(shader, 1, (const char**)ppStrings, 0);
     126//    pState->pDispatchTbl->ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
     127    pState->pDispatchTbl->ShaderSource(shader, 1, (const char**)ppStrings, 0);
    118128
    119129    crFree(ppStrings);
    120130}
    121131
    122 void crUnpackExtendUniform1fv(void)
    123 {
    124     GLint location = READ_DATA(8, GLint);
    125     GLsizei count = READ_DATA(12, GLsizei);
    126     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    127     cr_unpackDispatch.Uniform1fv(location, count, value);
    128 }
    129 
    130 void crUnpackExtendUniform1iv(void)
    131 {
    132     GLint location = READ_DATA(8, GLint);
    133     GLsizei count = READ_DATA(12, GLsizei);
    134     const GLint *value = DATA_POINTER(16, const GLint);
    135     cr_unpackDispatch.Uniform1iv(location, count, value);
    136 }
    137 
    138 void crUnpackExtendUniform2fv(void)
    139 {
    140     GLint location = READ_DATA(8, GLint);
    141     GLsizei count = READ_DATA(12, GLsizei);
    142     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    143     cr_unpackDispatch.Uniform2fv(location, count, value);
    144 }
    145 
    146 void crUnpackExtendUniform2iv(void)
    147 {
    148     GLint location = READ_DATA(8, GLint);
    149     GLsizei count = READ_DATA(12, GLsizei);
    150     const GLint *value = DATA_POINTER(16, const GLint);
    151     cr_unpackDispatch.Uniform2iv(location, count, value);
    152 }
    153 
    154 void crUnpackExtendUniform3fv(void)
    155 {
    156     GLint location = READ_DATA(8, GLint);
    157     GLsizei count = READ_DATA(12, GLsizei);
    158     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    159     cr_unpackDispatch.Uniform3fv(location, count, value);
    160 }
    161 
    162 void crUnpackExtendUniform3iv(void)
    163 {
    164     GLint location = READ_DATA(8, GLint);
    165     GLsizei count = READ_DATA(12, GLsizei);
    166     const GLint *value = DATA_POINTER(16, const GLint);
    167     cr_unpackDispatch.Uniform3iv(location, count, value);
    168 }
    169 
    170 void crUnpackExtendUniform4fv(void)
    171 {
    172     GLint location = READ_DATA(8, GLint);
    173     GLsizei count = READ_DATA(12, GLsizei);
    174     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    175     cr_unpackDispatch.Uniform4fv(location, count, value);
    176 }
    177 
    178 void crUnpackExtendUniform4iv(void)
    179 {
    180     GLint location = READ_DATA(8, GLint);
    181     GLsizei count = READ_DATA(12, GLsizei);
    182     const GLint *value = DATA_POINTER(16, const GLint);
    183     cr_unpackDispatch.Uniform4iv(location, count, value);
    184 }
    185 
    186 void crUnpackExtendUniformMatrix2fv(void)
    187 {
    188     GLint location = READ_DATA(8, GLint);
    189     GLsizei count = READ_DATA(12, GLsizei);
    190     GLboolean transpose = READ_DATA(16, GLboolean);
    191     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    192     cr_unpackDispatch.UniformMatrix2fv(location, count, transpose, value);
    193 }
    194 
    195 void crUnpackExtendUniformMatrix3fv(void)
    196 {
    197     GLint location = READ_DATA(8, GLint);
    198     GLsizei count = READ_DATA(12, GLsizei);
    199     GLboolean transpose = READ_DATA(16, GLboolean);
    200     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    201     cr_unpackDispatch.UniformMatrix3fv(location, count, transpose, value);
    202 }
    203 
    204 void crUnpackExtendUniformMatrix4fv(void)
    205 {
    206     GLint location = READ_DATA(8, GLint);
    207     GLsizei count = READ_DATA(12, GLsizei);
    208     GLboolean transpose = READ_DATA(16, GLboolean);
    209     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    210     cr_unpackDispatch.UniformMatrix4fv(location, count, transpose, value);
    211 }
    212 
    213 void crUnpackExtendUniformMatrix2x3fv(void)
    214 {
    215     GLint location = READ_DATA(8, GLint);
    216     GLsizei count = READ_DATA(12, GLsizei);
    217     GLboolean transpose = READ_DATA(16, GLboolean);
    218     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    219     cr_unpackDispatch.UniformMatrix2x3fv(location, count, transpose, value);
    220 }
    221 
    222 void crUnpackExtendUniformMatrix3x2fv(void)
    223 {
    224     GLint location = READ_DATA(8, GLint);
    225     GLsizei count = READ_DATA(12, GLsizei);
    226     GLboolean transpose = READ_DATA(16, GLboolean);
    227     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    228     cr_unpackDispatch.UniformMatrix3x2fv(location, count, transpose, value);
    229 }
    230 
    231 void crUnpackExtendUniformMatrix2x4fv(void)
    232 {
    233     GLint location = READ_DATA(8, GLint);
    234     GLsizei count = READ_DATA(12, GLsizei);
    235     GLboolean transpose = READ_DATA(16, GLboolean);
    236     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    237     cr_unpackDispatch.UniformMatrix2x4fv(location, count, transpose, value);
    238 }
    239 
    240 void crUnpackExtendUniformMatrix4x2fv(void)
    241 {
    242     GLint location = READ_DATA(8, GLint);
    243     GLsizei count = READ_DATA(12, GLsizei);
    244     GLboolean transpose = READ_DATA(16, GLboolean);
    245     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    246     cr_unpackDispatch.UniformMatrix4x2fv(location, count, transpose, value);
    247 }
    248 
    249 void crUnpackExtendUniformMatrix3x4fv(void)
    250 {
    251     GLint location = READ_DATA(8, GLint);
    252     GLsizei count = READ_DATA(12, GLsizei);
    253     GLboolean transpose = READ_DATA(16, GLboolean);
    254     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    255     cr_unpackDispatch.UniformMatrix3x4fv(location, count, transpose, value);
    256 }
    257 
    258 void crUnpackExtendUniformMatrix4x3fv(void)
    259 {
    260     GLint location = READ_DATA(8, GLint);
    261     GLsizei count = READ_DATA(12, GLsizei);
    262     GLboolean transpose = READ_DATA(16, GLboolean);
    263     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    264     cr_unpackDispatch.UniformMatrix4x3fv(location, count, transpose, value);
    265 }
    266 
    267 void crUnpackExtendDrawBuffers(void)
    268 {
    269     GLsizei n = READ_DATA(8, GLsizei);
    270     const GLenum *bufs = DATA_POINTER(8+sizeof(GLsizei), const GLenum);
    271     cr_unpackDispatch.DrawBuffers(n, bufs);
    272 }
    273 
    274 void crUnpackExtendGetActiveAttrib(void)
    275 {
    276     GLuint program = READ_DATA(8, GLuint);
    277     GLuint index = READ_DATA(12, GLuint);
    278     GLsizei bufSize = READ_DATA(16, GLsizei);
    279     SET_RETURN_PTR(20);
    280     SET_WRITEBACK_PTR(28);
    281     cr_unpackDispatch.GetActiveAttrib(program, index, bufSize, NULL, NULL, NULL, NULL);
    282 }
    283 
    284 void crUnpackExtendGetActiveUniform(void)
    285 {
    286     GLuint program = READ_DATA(8, GLuint);
    287     GLuint index = READ_DATA(12, GLuint);
    288     GLsizei bufSize = READ_DATA(16, GLsizei);
    289     SET_RETURN_PTR(20);
    290     SET_WRITEBACK_PTR(28);
    291     cr_unpackDispatch.GetActiveUniform(program, index, bufSize, NULL, NULL, NULL, NULL);
    292 }
    293 
    294 void crUnpackExtendGetAttachedShaders(void)
    295 {
    296     GLuint program = READ_DATA(8, GLuint);
    297     GLsizei maxCount = READ_DATA(12, GLsizei);
    298     SET_RETURN_PTR(16);
    299     SET_WRITEBACK_PTR(24);
    300     cr_unpackDispatch.GetAttachedShaders(program, maxCount, NULL, NULL);
    301 }
    302 
    303 void crUnpackExtendGetAttachedObjectsARB(void)
    304 {
    305         VBoxGLhandleARB containerObj = READ_DATA(8, VBoxGLhandleARB);
    306         GLsizei maxCount = READ_DATA(12, GLsizei);
    307         SET_RETURN_PTR(16);
    308         SET_WRITEBACK_PTR(24);
    309         cr_unpackDispatch.GetAttachedObjectsARB(containerObj, maxCount, NULL, NULL);
    310 }
    311 
    312 void crUnpackExtendGetInfoLogARB(void)
    313 {
    314         VBoxGLhandleARB obj = READ_DATA(8, VBoxGLhandleARB);
    315         GLsizei maxLength = READ_DATA(12, GLsizei);
    316         SET_RETURN_PTR(16);
    317         SET_WRITEBACK_PTR(24);
    318         cr_unpackDispatch.GetInfoLogARB(obj, maxLength, NULL, NULL);
    319 }
    320 
    321 void crUnpackExtendGetProgramInfoLog(void)
    322 {
    323     GLuint program = READ_DATA(8, GLuint);
    324     GLsizei bufSize = READ_DATA(12, GLsizei);
    325     SET_RETURN_PTR(16);
    326     SET_WRITEBACK_PTR(24);
    327     cr_unpackDispatch.GetProgramInfoLog(program, bufSize, NULL, NULL);
    328 }
    329 
    330 void crUnpackExtendGetShaderInfoLog(void)
    331 {
    332     GLuint shader = READ_DATA(8, GLuint);
    333     GLsizei bufSize = READ_DATA(12, GLsizei);
    334     SET_RETURN_PTR(16);
    335     SET_WRITEBACK_PTR(24);
    336     cr_unpackDispatch.GetShaderInfoLog(shader, bufSize, NULL, NULL);
    337 }
    338 
    339 void crUnpackExtendGetShaderSource(void)
    340 {
    341     GLuint shader = READ_DATA(8, GLuint);
    342     GLsizei bufSize = READ_DATA(12, GLsizei);
    343     SET_RETURN_PTR(16);
    344     SET_WRITEBACK_PTR(24);
    345     cr_unpackDispatch.GetShaderSource(shader, bufSize, NULL, NULL);
    346 }
    347 
    348 void crUnpackExtendGetAttribLocation(void)
    349 {
    350     int packet_length = READ_DATA(0, int);
    351     GLuint program = READ_DATA(8, GLuint);
    352     const char *name = DATA_POINTER(12, const char);
    353 
    354     if (!DATA_POINTER_CHECK(packet_length))
    355     {
    356         crError("crUnpackExtendGetAttribLocation: packet_length is out of range");
     132void crUnpackExtendUniform1fv(PCrUnpackerState pState)
     133{
     134    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     135
     136    GLint location = READ_DATA(pState, 8, GLint);
     137    GLsizei count = READ_DATA(pState, 12, GLsizei);
     138    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     139
     140    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count, GLfloat);
     141    pState->pDispatchTbl->Uniform1fv(location, count, value);
     142}
     143
     144void crUnpackExtendUniform1iv(PCrUnpackerState pState)
     145{
     146    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     147
     148    GLint location = READ_DATA(pState, 8, GLint);
     149    GLsizei count = READ_DATA(pState, 12, GLsizei);
     150    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     151
     152    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count, GLint);
     153    pState->pDispatchTbl->Uniform1iv(location, count, value);
     154}
     155
     156void crUnpackExtendUniform2fv(PCrUnpackerState pState)
     157{
     158    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     159
     160    GLint location = READ_DATA(pState, 8, GLint);
     161    GLsizei count = READ_DATA(pState, 12, GLsizei);
     162    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     163
     164    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2, GLfloat);
     165    pState->pDispatchTbl->Uniform2fv(location, count, value);
     166}
     167
     168void crUnpackExtendUniform2iv(PCrUnpackerState pState)
     169{
     170    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     171
     172    GLint location = READ_DATA(pState, 8, GLint);
     173    GLsizei count = READ_DATA(pState, 12, GLsizei);
     174    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     175
     176    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2, GLint);
     177    pState->pDispatchTbl->Uniform2iv(location, count, value);
     178}
     179
     180void crUnpackExtendUniform3fv(PCrUnpackerState pState)
     181{
     182    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     183
     184    GLint location = READ_DATA(pState, 8, GLint);
     185    GLsizei count = READ_DATA(pState, 12, GLsizei);
     186    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     187
     188    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3, GLfloat);
     189    pState->pDispatchTbl->Uniform3fv(location, count, value);
     190}
     191
     192void crUnpackExtendUniform3iv(PCrUnpackerState pState)
     193{
     194    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     195
     196    GLint location = READ_DATA(pState, 8, GLint);
     197    GLsizei count = READ_DATA(pState, 12, GLsizei);
     198    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     199
     200    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3, GLint);
     201    pState->pDispatchTbl->Uniform3iv(location, count, value);
     202}
     203
     204void crUnpackExtendUniform4fv(PCrUnpackerState pState)
     205{
     206    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     207
     208    GLint location = READ_DATA(pState, 8, GLint);
     209    GLsizei count = READ_DATA(pState, 12, GLsizei);
     210    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     211
     212    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4, GLfloat);
     213    pState->pDispatchTbl->Uniform4fv(location, count, value);
     214}
     215
     216void crUnpackExtendUniform4iv(PCrUnpackerState pState)
     217{
     218    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     219
     220    GLint location = READ_DATA(pState, 8, GLint);
     221    GLsizei count = READ_DATA(pState, 12, GLsizei);
     222    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     223
     224    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4, GLint);
     225    pState->pDispatchTbl->Uniform4iv(location, count, value);
     226}
     227
     228void crUnpackExtendUniformMatrix2fv(PCrUnpackerState pState)
     229{
     230    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     231
     232    GLint location = READ_DATA(pState, 8, GLint);
     233    GLsizei count = READ_DATA(pState, 12, GLsizei);
     234    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     235    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     236
     237    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 2, GLfloat);
     238    pState->pDispatchTbl->UniformMatrix2fv(location, count, transpose, value);
     239}
     240
     241void crUnpackExtendUniformMatrix3fv(PCrUnpackerState pState)
     242{
     243    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     244
     245    GLint location = READ_DATA(pState, 8, GLint);
     246    GLsizei count = READ_DATA(pState, 12, GLsizei);
     247    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     248    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     249
     250    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 3, GLfloat);
     251    pState->pDispatchTbl->UniformMatrix3fv(location, count, transpose, value);
     252}
     253
     254void crUnpackExtendUniformMatrix4fv(PCrUnpackerState pState)
     255{
     256    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     257
     258    GLint location = READ_DATA(pState, 8, GLint);
     259    GLsizei count = READ_DATA(pState, 12, GLsizei);
     260    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     261    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     262
     263    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 4, GLfloat);
     264    pState->pDispatchTbl->UniformMatrix4fv(location, count, transpose, value);
     265}
     266
     267void crUnpackExtendUniformMatrix2x3fv(PCrUnpackerState pState)
     268{
     269    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     270
     271    GLint location = READ_DATA(pState, 8, GLint);
     272    GLsizei count = READ_DATA(pState, 12, GLsizei);
     273    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     274    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     275
     276    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 3, GLfloat);
     277    pState->pDispatchTbl->UniformMatrix2x3fv(location, count, transpose, value);
     278}
     279
     280void crUnpackExtendUniformMatrix3x2fv(PCrUnpackerState pState)
     281{
     282    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     283
     284    GLint location = READ_DATA(pState, 8, GLint);
     285    GLsizei count = READ_DATA(pState, 12, GLsizei);
     286    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     287    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     288
     289    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 2, GLfloat);
     290    pState->pDispatchTbl->UniformMatrix3x2fv(location, count, transpose, value);
     291}
     292
     293void crUnpackExtendUniformMatrix2x4fv(PCrUnpackerState pState)
     294{
     295    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     296
     297    GLint location = READ_DATA(pState, 8, GLint);
     298    GLsizei count = READ_DATA(pState, 12, GLsizei);
     299    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     300    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     301
     302    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 4, GLfloat);
     303    pState->pDispatchTbl->UniformMatrix2x4fv(location, count, transpose, value);
     304}
     305
     306void crUnpackExtendUniformMatrix4x2fv(PCrUnpackerState pState)
     307{
     308    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     309
     310    GLint location = READ_DATA(pState, 8, GLint);
     311    GLsizei count = READ_DATA(pState, 12, GLsizei);
     312    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     313    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     314
     315    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 2, GLfloat);
     316    pState->pDispatchTbl->UniformMatrix4x2fv(location, count, transpose, value);
     317}
     318
     319void crUnpackExtendUniformMatrix3x4fv(PCrUnpackerState pState)
     320{
     321    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     322
     323    GLint location = READ_DATA(pState, 8, GLint);
     324    GLsizei count = READ_DATA(pState, 12, GLsizei);
     325    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     326    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     327
     328    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 4, GLfloat);
     329    pState->pDispatchTbl->UniformMatrix3x4fv(location, count, transpose, value);
     330}
     331
     332void crUnpackExtendUniformMatrix4x3fv(PCrUnpackerState pState)
     333{
     334    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     335
     336    GLint location = READ_DATA(pState, 8, GLint);
     337    GLsizei count = READ_DATA(pState, 12, GLsizei);
     338    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     339    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     340
     341    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 3, GLfloat);
     342    pState->pDispatchTbl->UniformMatrix4x3fv(location, count, transpose, value);
     343}
     344
     345void crUnpackExtendDrawBuffers(PCrUnpackerState pState)
     346{
     347    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei);
     348
     349    GLsizei n = READ_DATA(pState, 8, GLsizei);
     350    const GLenum *bufs = DATA_POINTER(pState, 8+sizeof(GLsizei), const GLenum);
     351
     352    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, bufs, n, GLenum);
     353    pState->pDispatchTbl->DrawBuffers(n, bufs);
     354}
     355
     356void crUnpackExtendGetActiveAttrib(PCrUnpackerState pState)
     357{
     358    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 28, CRNetworkPointer);
     359
     360    GLuint program = READ_DATA(pState, 8, GLuint);
     361    GLuint index = READ_DATA(pState, 12, GLuint);
     362    GLsizei bufSize = READ_DATA(pState, 16, GLsizei);
     363    SET_RETURN_PTR(pState, 20);
     364    SET_WRITEBACK_PTR(pState, 28);
     365    pState->pDispatchTbl->GetActiveAttrib(program, index, bufSize, NULL, NULL, NULL, NULL);
     366}
     367
     368void crUnpackExtendGetActiveUniform(PCrUnpackerState pState)
     369{
     370    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 28, CRNetworkPointer);
     371
     372    GLuint program = READ_DATA(pState, 8, GLuint);
     373    GLuint index = READ_DATA(pState, 12, GLuint);
     374    GLsizei bufSize = READ_DATA(pState, 16, GLsizei);
     375    SET_RETURN_PTR(pState, 20);
     376    SET_WRITEBACK_PTR(pState, 28);
     377    pState->pDispatchTbl->GetActiveUniform(program, index, bufSize, NULL, NULL, NULL, NULL);
     378}
     379
     380void crUnpackExtendGetAttachedShaders(PCrUnpackerState pState)
     381{
     382    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     383
     384    GLuint program = READ_DATA(pState, 8, GLuint);
     385    GLsizei maxCount = READ_DATA(pState, 12, GLsizei);
     386    SET_RETURN_PTR(pState, 16);
     387    SET_WRITEBACK_PTR(pState, 24);
     388    pState->pDispatchTbl->GetAttachedShaders(program, maxCount, NULL, NULL);
     389}
     390
     391void crUnpackExtendGetAttachedObjectsARB(PCrUnpackerState pState)
     392{
     393    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     394
     395    VBoxGLhandleARB containerObj = READ_DATA(pState, 8, VBoxGLhandleARB);
     396    GLsizei maxCount = READ_DATA(pState, 12, GLsizei);
     397    SET_RETURN_PTR(pState, 16);
     398    SET_WRITEBACK_PTR(pState, 24);
     399    pState->pDispatchTbl->GetAttachedObjectsARB(containerObj, maxCount, NULL, NULL);
     400}
     401
     402void crUnpackExtendGetInfoLogARB(PCrUnpackerState pState)
     403{
     404    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     405
     406    VBoxGLhandleARB obj = READ_DATA(pState, 8, VBoxGLhandleARB);
     407    GLsizei maxLength = READ_DATA(pState, 12, GLsizei);
     408    SET_RETURN_PTR(pState, 16);
     409    SET_WRITEBACK_PTR(pState, 24);
     410    pState->pDispatchTbl->GetInfoLogARB(obj, maxLength, NULL, NULL);
     411}
     412
     413void crUnpackExtendGetProgramInfoLog(PCrUnpackerState pState)
     414{
     415    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     416
     417    GLuint program = READ_DATA(pState, 8, GLuint);
     418    GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
     419    SET_RETURN_PTR(pState, 16);
     420    SET_WRITEBACK_PTR(pState, 24);
     421    pState->pDispatchTbl->GetProgramInfoLog(program, bufSize, NULL, NULL);
     422}
     423
     424void crUnpackExtendGetShaderInfoLog(PCrUnpackerState pState)
     425{
     426    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     427
     428    GLuint shader = READ_DATA(pState, 8, GLuint);
     429    GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
     430    SET_RETURN_PTR(pState, 16);
     431    SET_WRITEBACK_PTR(pState, 24);
     432    pState->pDispatchTbl->GetShaderInfoLog(shader, bufSize, NULL, NULL);
     433}
     434
     435void crUnpackExtendGetShaderSource(PCrUnpackerState pState)
     436{
     437    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     438
     439    GLuint shader = READ_DATA(pState, 8, GLuint);
     440    GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
     441    SET_RETURN_PTR(pState, 16);
     442    SET_WRITEBACK_PTR(pState, 24);
     443    pState->pDispatchTbl->GetShaderSource(shader, bufSize, NULL, NULL);
     444}
     445
     446void crUnpackExtendGetAttribLocation(PCrUnpackerState pState)
     447{
     448    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLuint);
     449
     450    int packet_length = READ_DATA(pState, 0, int);
     451    GLuint program = READ_DATA(pState, 8, GLuint);
     452    const char *name = DATA_POINTER(pState, 12, const char);
     453
     454    size_t cchStr = CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(pState, name);
     455    if (RT_UNLIKELY(cchStr == SIZE_MAX || packet_length != cchStr + 2 * sizeof(CRNetworkPointer)))
     456    {
     457        crError("crUnpackExtendGetAttribLocation: packet_length is corrupt");
    357458        return;
    358459    }
    359460
    360     SET_RETURN_PTR(packet_length-16);
    361     SET_WRITEBACK_PTR(packet_length-8);
    362     cr_unpackDispatch.GetAttribLocation(program, name);
    363 }
    364 
    365 void crUnpackExtendGetUniformLocation(void)
    366 {
    367     int packet_length = READ_DATA(0, int);
    368     GLuint program = READ_DATA(8, GLuint);
    369     const char *name = DATA_POINTER(12, const char);
    370 
    371     if (!DATA_POINTER_CHECK(packet_length))
    372     {
    373         crError("crUnpackExtendGetUniformLocation: packet_length is out of range");
     461    CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, packet_length);
     462    SET_RETURN_PTR(pState, packet_length-16);
     463    SET_WRITEBACK_PTR(pState, packet_length-8);
     464    pState->pDispatchTbl->GetAttribLocation(program, name);
     465}
     466
     467void crUnpackExtendGetUniformLocation(PCrUnpackerState pState)
     468{
     469    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLuint);
     470
     471    int packet_length = READ_DATA(pState, 0, int);
     472    GLuint program = READ_DATA(pState, 8, GLuint);
     473    const char *name = DATA_POINTER(pState, 12, const char);
     474
     475    size_t cchStr = CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(pState, name);
     476    if (RT_UNLIKELY(cchStr == SIZE_MAX || packet_length != cchStr + 2 * sizeof(CRNetworkPointer)))
     477    {
     478        crError("crUnpackExtendGetUniformLocation: packet_length is corrupt");
    374479        return;
    375480    }
    376481
    377     SET_RETURN_PTR(packet_length-16);
    378     SET_WRITEBACK_PTR(packet_length-8);
    379     cr_unpackDispatch.GetUniformLocation(program, name);
    380 }
    381 
    382 void crUnpackExtendGetUniformsLocations(void)
    383 {
    384         GLuint program = READ_DATA(8, GLuint);
    385         GLsizei maxcbData = READ_DATA(12, GLsizei);
    386         SET_RETURN_PTR(16);
    387         SET_WRITEBACK_PTR(24);
    388         cr_unpackDispatch.GetUniformsLocations(program, maxcbData, NULL, NULL);
    389 }
    390 
    391 void crUnpackExtendGetAttribsLocations(void)
    392 {
    393     GLuint program = READ_DATA(8, GLuint);
    394     GLsizei maxcbData = READ_DATA(12, GLsizei);
    395     SET_RETURN_PTR(16);
    396     SET_WRITEBACK_PTR(24);
    397     cr_unpackDispatch.GetAttribsLocations(program, maxcbData, NULL, NULL);
    398 }
     482    CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, packet_length);
     483    SET_RETURN_PTR(pState, packet_length-16);
     484    SET_WRITEBACK_PTR(pState, packet_length-8);
     485    pState->pDispatchTbl->GetUniformLocation(program, name);
     486}
     487
     488void crUnpackExtendGetUniformsLocations(PCrUnpackerState pState)
     489{
     490    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     491
     492    GLuint program = READ_DATA(pState, 8, GLuint);
     493    GLsizei maxcbData = READ_DATA(pState, 12, GLsizei);
     494    SET_RETURN_PTR(pState, 16);
     495    SET_WRITEBACK_PTR(pState, 24);
     496    pState->pDispatchTbl->GetUniformsLocations(program, maxcbData, NULL, NULL);
     497}
     498
     499void crUnpackExtendGetAttribsLocations(PCrUnpackerState pState)
     500{
     501    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     502
     503    GLuint program = READ_DATA(pState, 8, GLuint);
     504    GLsizei maxcbData = READ_DATA(pState, 12, GLsizei);
     505    SET_RETURN_PTR(pState, 16);
     506    SET_WRITEBACK_PTR(pState, 24);
     507    pState->pDispatchTbl->GetAttribsLocations(program, maxcbData, NULL, NULL);
     508}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette