- Timestamp:
- Apr 18, 2019 12:07:07 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 48 added
- 91 deleted
- 93 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo
-
old new 9 9 /branches/VBox-5.1:112367,115992,116543,116550,116568,116573 10 10 /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 11 12 /branches/andy/draganddrop:90781-91268 12 13 /branches/andy/guestctrl20:78916,78930
-
- Property svn:mergeinfo
-
trunk/Config.kmk
r78027 r78190 2503 2503 ifdef VBOX_WITH_WDDM 2504 2504 VBOX_WITH_CRHGSMI = 1 2505 endif2506 2507 if1of ($(KBUILD_TARGET),darwin)2508 #VBOX_WITH_CR_DISPLAY_LISTS = 12509 2505 endif 2510 2506 … … 7337 7333 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.linux = Linux=1 _GNU_SOURCE 7338 7334 TEMPLATE_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_QT7335 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE 7340 7336 TEMPLATE_VBOXCROGLR3HOSTDLL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE 7341 7337 TEMPLATE_VBOXCROGLR3HOSTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES) … … 7384 7380 # 7385 7381 TEMPLATE_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 7389 7386 TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS = VBOXGUESTR3NPDLL 7390 endif7387 #endif 7391 7388 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS) CHROMIUM_THREADSAFE VBOX_WITH_HGCM 7392 7389 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.win = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.win) WINDOWS=1 7393 7390 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.linux = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.linux) Linux=1 _GNU_SOURCE 7394 7391 TEMPLATE_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_QT7392 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.darwin = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.darwin) DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE 7396 7393 TEMPLATE_VBOXCROGLR3GUESTDLL_DEFS.freebsd = $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_DEFS.freebsd) FreeBSD=1 _GNU_SOURCE 7397 7394 TEMPLATE_VBOXCROGLR3GUESTDLL_INCS = $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES) $(TEMPLATE_$(TEMPLATE_VBOXCROGLR3GUESTDLL_EXTENDS)_INCS) -
trunk/src/VBox
- Property svn:mergeinfo
-
old new 9 9 /branches/VBox-5.1/src/VBox:112367,116543,116550,116568,116573 10 10 /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 11 12 /branches/andy/draganddrop/src/VBox:90781-91268 12 13 /branches/andy/guestctrl20/src/VBox:78916,78930
-
- Property svn:mergeinfo
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/Makefile.kmk
r76884 r78190 119 119 wddm/VBoxMPCm.cpp \ 120 120 wddm/VBoxMPCr.cpp \ 121 wddm/VBoxMPSa.cpp \ 121 122 wddm/VBoxMPMisc.cpp \ 122 123 wddm/VBoxWddm.rc \ … … 132 133 $(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp 133 134 134 VBoxWddm_SOURCES += \135 $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/util/sortarray.cpp136 137 135 if defined(VBOX_WITH_CROGL) 138 136 VBoxWddm_SOURCES += \ … … 142 140 $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer/pack_visibleregion.c \ 143 141 $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/packer/pack_misc.c \ 144 $(VBOX_PATH_CROGL_GENFILES)/pack_bounds_swap.c \145 142 $(VBOX_PATH_CROGL_GENFILES)/packer.c \ 146 143 wddm/VBoxMPCrUtil.cpp -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPTypes.h
r76563 r78190 36 36 #include "VBoxMPVbva.h" 37 37 #include "VBoxMPCr.h" 38 #include "VBoxMPSa.h" 38 39 #include "VBoxMPVModes.h" 39 40 … … 41 42 #include <cr_vreg.h> 42 43 #endif 43 44 #include <cr_sortarray.h>45 44 46 45 #if 0 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVModes.h
r76563 r78190 24 24 //#include "../../common/VBoxVideoTools.h" 25 25 26 #include <cr_sortarray.h> 27 26 #include "VBoxMPSa.h" 28 27 29 28 #define _CR_TYPECAST(_Type, _pVal) ((_Type*)((void*)(_pVal))) -
trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_config.c
r69310 r78190 15 15 } 16 16 17 /* No SPU options yet.18 */19 SPUOptions arraySPUOptions[] = {20 { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },21 };22 23 24 17 void arrayspuSetVBoxConfiguration( void ) 25 18 { -
trunk/src/VBox/Additions/common/crOpenGL/array/arrayspu_init.c
r69310 r78190 11 11 12 12 extern SPUNamedFunctionTable _cr_array_table[]; 13 14 extern SPUOptions arraySPUOptions[];15 13 16 14 static SPUFunctions array_functions = { … … 73 71 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 74 72 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 75 SPUOptionsPtr *options,int *flags )73 int *flags ) 76 74 { 77 75 *name = "array"; … … 80 78 *self = arraySPUSelfDispatch; 81 79 *cleanup = arraySPUCleanup; 82 *options = arraySPUOptions;83 80 *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO); 84 81 -
trunk/src/VBox/Additions/common/crOpenGL/context.c
r69310 r78190 29 29 #include "cr_mem.h" 30 30 #include "cr_string.h" 31 #include "cr_environment.h"32 31 #include "stub.h" 33 32 -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h
r76563 r78190 18 18 19 19 #include "cr_spu.h" 20 #include "cr_timer.h"21 20 #include "cr_glstate.h" 22 21 … … 52 51 extern SPUNamedFunctionTable _cr_feedback_table[]; 53 52 54 extern SPUOptions feedbackSPUOptions[];55 56 53 extern void feedbackspuGatherConfiguration( void ); 57 54 -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c
r63206 r78190 6 6 7 7 #include "cr_string.h" 8 #include "cr_environment.h"9 8 #include "cr_error.h" 10 9 #include "cr_mem.h" … … 21 20 } 22 21 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, callback30 */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 40 22 41 23 void feedbackspuGatherConfiguration( void ) -
trunk/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c
r69310 r78190 6 6 7 7 #include "cr_spu.h" 8 #include "cr_environment.h"9 8 #include "cr_string.h" 10 9 #include "cr_error.h" … … 73 72 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 74 73 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 75 SPUOptionsPtr *options,int *flags )74 int *flags ) 76 75 { 77 76 *name = "feedback"; … … 80 79 *self = feedbackSPUSelfDispatch; 81 80 *cleanup = feedbackSPUCleanup; 82 *options = feedbackSPUOptions;83 81 *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO); 84 82 -
trunk/src/VBox/Additions/common/crOpenGL/icd_drv.c
r76553 r78190 28 28 29 29 #include <iprt/win/windows.h> 30 31 #include <stdio.h> /*sprintf*/ 30 32 31 33 /// @todo consider -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r76474 r78190 11 11 #include "cr_string.h" 12 12 #include "cr_net.h" 13 #include "cr_environment.h"14 13 #include "cr_process.h" 15 #include "cr_rand.h"16 14 #include "cr_netserver.h" 17 15 #include "stub.h" … … 19 17 #include <string.h> 20 18 #include <signal.h> 19 #include <stdio.h> /*swprintf*/ 21 20 #include <iprt/initterm.h> 22 21 #include <iprt/thread.h> 23 22 #include <iprt/errcore.h> 24 23 #include <iprt/asm.h> 24 #include <iprt/env.h> 25 25 #ifndef WINDOWS 26 26 # include <sys/types.h> … … 601 601 602 602 603 #if 0 /* unused */604 605 /**606 * Return a free port number for the mothership to use, or -1 if we607 * can't find one.608 */609 static int610 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 WINDOWS620 /* XXX should implement a free port check here */621 return port;622 #else623 /*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 else688 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 void727 MothershipPhoneHome(int signo)728 {729 crDebug("Got signal %d: mothership is awake!", signo);730 Mothership_Awake = 1;731 }732 733 #endif /* 0 */734 735 603 static void stubSetDefaultConfigurationOptions(void) 736 604 { 737 unsigned char key[16]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};738 739 605 stub.appDrawCursor = 0; 740 606 stub.minChromiumWindowWidth = 0; … … 752 618 stub.matchChromiumWindowCount = 0; 753 619 stub.spu_dir = NULL; 754 crNetSetRank(0);755 crNetSetContextRange(32, 35);756 crNetSetNodeRange("iam0", "iamvis20");757 crNetSetKey(key,sizeof(key));758 620 stub.force_pbuffers = 0; 759 621 … … 963 825 964 826 /** @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" ); 966 828 967 829 crNetInit( NULL, NULL ); … … 1347 1209 1348 1210 #ifdef VDBG_VEHANDLER 1349 env = crGetenv("CR_DBG_VEH_ENABLE");1211 env = RTEnvGet("CR_DBG_VEH_ENABLE"); 1350 1212 g_VBoxVehEnable = crStrParseI32(env, 1351 1213 # ifdef DEBUG_misha … … 1362 1224 size_t cChars; 1363 1225 1364 env = crGetenv("CR_DBG_VEH_FLAGS");1226 env = RTEnvGet("CR_DBG_VEH_FLAGS"); 1365 1227 g_VBoxVehFlags = crStrParseI32(env, 1366 1228 0 … … 1372 1234 ); 1373 1235 1374 env = crGetenv("CR_DBG_VEH_DUMP_DIR");1236 env = RTEnvGet("CR_DBG_VEH_DUMP_DIR"); 1375 1237 if (!env) 1376 1238 env = VBOXMD_DUMP_DIR_DEFAULT; … … 1410 1272 g_aszwVBoxMdFilePrefix[g_cVBoxMdFilePrefixLen] = L'\0'; 1411 1273 1412 env = crGetenv("CR_DBG_VEH_DUMP_TYPE");1274 env = RTEnvGet("CR_DBG_VEH_DUMP_TYPE"); 1413 1275 1414 1276 g_enmVBoxMdDumpType = crStrParseI32(env, -
trunk/src/VBox/Additions/common/crOpenGL/pack/pack.py
r69310 r78190 53 53 print('\t__fillin(%3d, "%s", (SPUGenericFunction) packspu_%s);' % (index, func_name, func_name )) 54 54 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 )) 56 56 print('\t__fillin(%3d, NULL, NULL);' % num_funcs) 57 57 print('}') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h
r76563 r78190 82 82 typedef struct { 83 83 int id; 84 int swap;85 84 86 85 /* config options */ -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_beginend.py
r69310 r78190 48 48 #endif 49 49 50 if (pack_spu.swap) 51 { 52 crPackBeginSWAP( mode ); 53 } 54 else 55 { 56 crPackBegin( mode ); 57 } 58 50 crPackBegin( mode ); 59 51 if ( thread->netServer.conn->Barf ) { 60 52 thread->BeginEndMode = mode; … … 99 91 } 100 92 101 if (pack_spu.swap) 102 { 103 crPackEndSWAP(); 104 } 105 else 106 { 107 crPackEnd(); 108 } 93 crPackEnd(); 109 94 } 110 95 … … 166 151 print('void PACKSPU_APIENTRY packspu_%s(%s)' % ( func_name, apiutil.MakeDeclarationString(params) )) 167 152 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 ) )) 176 154 print('\tRunState();') 177 155 print('}') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c
r69310 r78190 140 140 crError( "packspu_GenBuffersARB doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 141 141 } 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 ); 150 144 packspuFlush( (void *) thread ); 151 145 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_client.c
r69310 r78190 15 15 #if CR_ARB_vertex_buffer_object 16 16 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 ); 22 19 } 23 20 #endif … … 30 27 GET_CONTEXT(ctx); 31 28 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 ); 36 30 } 37 31 #endif … … 44 38 GET_CONTEXT(ctx); 45 39 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 ); 50 41 } 51 42 #endif … … 59 50 CRASSERT(ctx->clientState->extensions.ARB_vertex_buffer_object); 60 51 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 ); 65 53 } 66 54 #endif … … 73 61 GET_CONTEXT(ctx); 74 62 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 ); 79 64 } 80 65 #endif … … 87 72 GET_CONTEXT(ctx); 88 73 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 ); 93 75 } 94 76 #endif … … 101 83 GET_CONTEXT(ctx); 102 84 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 ); 107 86 } 108 87 #endif … … 115 94 GET_CONTEXT(ctx); 116 95 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 ); 121 97 } 122 98 #endif … … 129 105 GET_CONTEXT(ctx); 130 106 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 ); 135 108 } 136 109 #endif … … 143 116 GET_CONTEXT(ctx); 144 117 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 ); 149 119 } 150 120 #endif … … 162 132 GET_CONTEXT(ctx); 163 133 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 ); 168 135 } 169 136 #endif … … 380 347 381 348 /* Send the DrawArrays command over the wire */ 382 if (pack_spu.swap) 383 crPackArrayElementSWAP( index ); 384 else 385 crPackArrayElement( index ); 349 crPackArrayElement( index ); 386 350 387 351 if (cZvaValues) … … 400 364 #endif 401 365 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 ); 406 367 407 368 #ifdef CR_FORCE_ZVA_SERVER_ARRAY … … 529 490 530 491 /* 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 ); 535 493 536 494 if (cZvaValues) … … 549 507 #endif 550 508 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(); 559 512 560 513 #ifdef CR_FORCE_ZVA_SERVER_ARRAY … … 615 568 616 569 /* 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 ); 621 571 622 572 if (cZvaValues) … … 634 584 #endif 635 585 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 ); 642 587 643 588 #ifdef CR_FORCE_ZVA_SERVER_ARRAY … … 709 654 710 655 /* 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 ); 715 657 716 658 if (cZvaValues) … … 729 671 #endif 730 672 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 ); 735 674 736 675 #ifdef CR_FORCE_ZVA_SERVER_ARRAY … … 809 748 { 810 749 crStateEnable(cap); 811 812 if (pack_spu.swap) 813 crPackEnableSWAP(cap); 814 else 815 crPackEnable(cap); 750 crPackEnable(cap); 816 751 } 817 752 else … … 834 769 { 835 770 crStateDisable(cap); 836 837 if (pack_spu.swap) 838 crPackDisableSWAP(cap); 839 else 840 crPackDisable(cap); 771 crPackDisable(cap); 841 772 } 842 773 else -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_config.c
r69310 r78190 23 23 24 24 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 52 25 void packspuSetVBoxConfiguration( const SPU *child_spu ) 53 26 { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
r69310 r78190 69 69 /* packer setup */ 70 70 CRASSERT(thread->packer == NULL); 71 thread->packer = crPackNewContext( pack_spu.swap);71 thread->packer = crPackNewContext(); 72 72 CRASSERT(thread->packer); 73 73 crPackInitBuffer( &(thread->buffer), crNetAlloc(thread->netServer.conn), … … 357 357 358 358 /* 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 ); 363 360 364 361 /* Flush buffer and get return value */ … … 385 382 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 386 383 387 if (pack_spu.swap) {388 serverCtx = (GLint) SWAP32(serverCtx);389 }390 384 if (serverCtx < 0) { 391 385 #ifdef CHROMIUM_THREADSAFE … … 472 466 } 473 467 474 if (pack_spu.swap) 475 crPackDestroyContextSWAP( context->serverCtx ); 476 else 477 crPackDestroyContext( context->serverCtx ); 478 468 crPackDestroyContext( context->serverCtx ); 479 469 crStateDestroyContext( context->clientState ); 480 470 … … 600 590 } 601 591 602 if (pack_spu.swap) 603 crPackMakeCurrentSWAP( window, nativeWindow, serverCtx ); 604 else 605 crPackMakeCurrent( window, nativeWindow, serverCtx ); 606 592 crPackMakeCurrent( window, nativeWindow, serverCtx ); 607 593 if (serverCtx) 608 594 { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_flush.py
r69310 r78190 31 31 print('{') 32 32 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 ) )) 41 34 print('\tpackspuFlush( (void *) thread );') 42 35 print('}\n') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_framebuffer.c
r76553 r78190 107 107 crError( "packspu_GenFramebuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 108 108 } 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 ); 117 111 packspuFlush( (void *) thread ); 118 112 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); … … 129 123 crError( "packspu_GenRenderbuffersEXT doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 130 124 } 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 ); 139 127 packspuFlush( (void *) thread ); 140 128 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
r69310 r78190 49 49 """) 50 50 51 print('#ifdef DEBUG'); 51 52 from get_sizes import * 52 53 easy_swaps = { 54 'GenTextures': '(unsigned int) n', 55 'GetClipPlane': '4', 56 'GetPolygonStipple': '0' 57 } 53 print('#endif'); 58 54 59 55 simple_funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ] 60 simple_swaps = [ 'SWAP32', 'SWAPFLOAT', 'SWAPDOUBLE', '(GLboolean) SWAP32' ]61 62 56 vertattr_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' }78 57 79 58 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") … … 93 72 print('\t%s return_val = (%s) 0;' % (return_type, return_type)) 94 73 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;')97 74 print('\tif (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))') 98 75 print('\t{') … … 138 115 ) 139 116 { 117 unsigned int i = 0; 140 118 %s localparams; 141 119 localparams = (%s) crAlloc(__numValues(pname) * sizeof(*localparams)); … … 193 171 194 172 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 ) )) 203 174 print('\tpackspuFlush( (void *) thread );') 204 175 print('\tCRPACKSPU_WRITEBACK_WAIT(thread, writeback);') … … 208 179 lastParamName = params[-2][0] 209 180 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}')214 181 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}')250 182 print('}\n') -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c
r69310 r78190 17 17 static GLubyte gpszShadingVersion[255]=""; 18 18 #endif 19 static uint32_t g_uOpenGlVersMaj = 0; 20 static uint32_t g_uOpenGlVersMin = 0; 21 19 22 20 23 static void GetString(GLenum name, GLubyte *pszStr) … … 23 26 int writeback = 1; 24 27 25 if (pack_spu.swap) 26 crPackGetStringSWAP(name, pszStr, &writeback); 27 else 28 crPackGetString(name, pszStr, &writeback); 28 crPackGetString(name, pszStr, &writeback); 29 29 packspuFlush( (void *) thread ); 30 30 … … 32 32 } 33 33 34 static GLfloat34 static void 35 35 GetVersionString(void) 36 36 { … … 40 40 if (!fInitialized) 41 41 { 42 int iGlVersion = 0; 42 43 GLubyte return_value[100]; 43 44 … … 45 46 CRASSERT(crStrlen((char *)return_value) < 100); 46 47 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); 49 52 50 53 fInitialized = GL_TRUE; 51 54 } 52 53 return version;54 55 } 55 56 … … 65 66 int writeback = 1; 66 67 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 ); 75 69 packspuFlush( (void *) thread ); 76 70 … … 129 123 { 130 124 char *oldlocale; 131 float version;132 125 133 126 oldlocale = setlocale(LC_NUMERIC, NULL); … … 135 128 setlocale(LC_NUMERIC, "C"); 136 129 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); 139 132 140 133 if (oldlocale) -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
r76553 r78190 33 33 crError("packspu_CreateProgram doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!"); 34 34 } 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); 43 36 packspuFlush((void *) thread); 44 37 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 45 if (pack_spu.swap)46 {47 return_val = (GLuint) SWAP32(return_val);48 }49 50 38 crStateCreateProgram(return_val); 51 39 … … 62 50 crError("packspu_GetUniformLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!"); 63 51 } 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); 72 54 packspuFlush((void *) thread); 73 55 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 74 if (pack_spu.swap)75 {76 return_val = (GLint) SWAP32(return_val);77 }78 56 return return_val; 79 57 } … … 124 102 crError( "packspu_GetAttribLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 125 103 } 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 ); 134 106 packspuFlush( (void *) thread ); 135 107 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 136 if (pack_spu.swap)137 {138 return_val = (GLint) SWAP32(return_val);139 }140 108 return return_val; 141 109 } -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
r69310 r78190 135 135 } 136 136 137 extern SPUOptions packSPUOptions[];138 139 137 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 140 138 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 141 SPUOptionsPtr *options,int *flags )139 int *flags ) 142 140 { 143 141 *name = "pack"; … … 146 144 *self = packSPUSelfDispatch; 147 145 *cleanup = packSPUCleanup; 148 *options = packSPUOptions;149 146 *flags = (SPU_HAS_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ONE); 150 147 -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c
r69310 r78190 85 85 } 86 86 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); 91 88 92 89 if (fFlush) … … 131 128 GLint writeback = CRPACKSPU_IS_WDDM_CRHGSMI() ? 1 : pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network; 132 129 133 if (pack_spu.swap) 134 { 135 crPackFinishSWAP(); 136 } 137 else 138 { 139 crPackFinish(); 140 } 141 130 crPackFinish(); 142 131 if (packspuSyncOnFlushes()) 143 132 { 144 133 if (writeback) 145 134 { 146 if (pack_spu.swap) 147 crPackWritebackSWAP(&writeback); 148 else 149 crPackWriteback(&writeback); 135 crPackWriteback(&writeback); 150 136 151 137 packspuFlush( (void *) thread ); … … 277 263 278 264 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 ); 288 266 packspuFlush(thread); 289 267 if (!(thread->netServer.conn->actual_network)) … … 294 272 { 295 273 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 296 if (pack_spu.swap)297 {298 return_val = (GLint) SWAP32(return_val);299 }300 274 retVal = return_val; 301 275 } … … 334 308 } 335 309 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 ); 344 311 packspuFlush( (void *) thread ); 345 312 … … 373 340 crError( "packspu_AreProgramsResidentNV doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 374 341 } 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 ); 383 344 packspuFlush( (void *) thread ); 384 345 … … 403 364 int writeback = 1; 404 365 405 if (pack_spu.swap) 406 { 407 crPackGetPolygonStippleSWAP( mask, &writeback ); 408 } 409 else 410 { 411 crPackGetPolygonStipple( mask, &writeback ); 412 } 413 366 crPackGetPolygonStipple( mask, &writeback ); 414 367 #ifdef CR_ARB_pixel_buffer_object 415 368 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) … … 426 379 int writeback = 1; 427 380 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 ); 437 382 #ifdef CR_ARB_pixel_buffer_object 438 383 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) … … 449 394 int writeback = 1; 450 395 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 ); 459 397 460 398 #ifdef CR_ARB_pixel_buffer_object … … 472 410 int writeback = 1; 473 411 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 ); 483 413 #ifdef CR_ARB_pixel_buffer_object 484 414 if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) … … 558 488 crError( "packspu_GetError doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 559 489 } 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 ); 569 492 packspuFlush( (void *) thread ); 570 493 CRPACKSPU_WRITEBACK_WAIT(thread, writeback); 571 572 if (pack_spu.swap)573 {574 return_val = (GLenum) SWAP32(return_val);575 }576 577 494 return return_val; 578 495 } … … 619 536 620 537 CRASSERT(thread->packer == NULL); 621 thread->packer = crPackNewContext( pack_spu.swap);538 thread->packer = crPackNewContext(); 622 539 CRASSERT(thread->packer); 623 540 crPackInitBuffer(&(thread->buffer), crNetAlloc(thread->netServer.conn), -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
r69310 r78190 95 95 CRASSERT( (void *) hdr >= buf->pack ); 96 96 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; 107 99 108 100 *len = buf->data_current - (unsigned char *) hdr; … … 206 198 a header */ 207 199 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 }213 200 len += 4 + sizeof(CRMessageOpcodes); 214 201 … … 221 208 222 209 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; 234 212 235 213 CRASSERT( thread->netServer.conn ); … … 272 250 return; 273 251 } 274 pack_spu.swap = server->conn->swap;275 252 } 276 253 else { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c
r69310 r78190 330 330 { 331 331 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 ); 336 333 /* XXX why flush here? */ 337 334 packspuFlush( (void *) thread ); … … 378 375 } 379 376 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) ); 385 378 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 386 379 { … … 411 404 } 412 405 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) ); 418 407 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 419 408 { … … 433 422 } 434 423 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) ); 440 425 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 441 426 { … … 456 441 } 457 442 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) ); 463 444 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 464 445 { … … 484 465 } 485 466 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) ); 491 468 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 492 469 { … … 511 488 } 512 489 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) ); 518 491 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 519 492 { … … 533 506 } 534 507 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) ); 540 509 if (crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB)) 541 510 { … … 549 518 GET_CONTEXT(ctx); 550 519 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) ); 555 521 } 556 522 … … 572 538 } 573 539 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 ); 579 541 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 580 542 { … … 601 563 } 602 564 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 ); 612 566 if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB)) 613 567 { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_swapbuf.c
r69310 r78190 11 11 #include "packspu_proto.h" 12 12 13 #if 014 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 else23 {24 crPackSwapBuffers( window, flags );25 }26 packspuFlush( (void *) thread );27 }28 29 30 #else31 13 32 14 void PACKSPU_APIENTRY packspu_SwapBuffers( GLint window, GLint flags ) … … 34 16 GET_THREAD(thread); 35 17 36 if (pack_spu.swap) 37 { 38 crPackSwapBuffersSWAP( window, flags ); 39 } 40 else 41 { 42 crPackSwapBuffers( window, flags ); 43 } 18 crPackSwapBuffers( window, flags ); 44 19 packspuFlush( (void *) thread ); 45 20 … … 73 48 */ 74 49 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 ); 83 51 break; 84 52 case 1: … … 92 60 /* want to emit a parameter here */ 93 61 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); 100 63 } 101 64 102 #endif -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_texture.c
r76553 r78190 44 44 GET_THREAD(thread); 45 45 int writeback = 1; 46 unsigned int i;47 46 if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network)) 48 47 { 49 48 crError( "packspu_GenTextures doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" ); 50 49 } 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 ); 59 52 packspuFlush( (void *) thread ); 60 53 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 69 54 crStateRegTextures(n, textures); 70 55 } -
trunk/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu_init.c
r69310 r78190 44 44 } 45 45 46 static SPUOptions passthroughSPUOptions[] = {47 { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },48 };49 50 46 51 47 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 52 48 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 53 SPUOptionsPtr *options,int *flags )49 int *flags ) 54 50 { 55 51 *name = "passthrough"; … … 58 54 *self = passthroughSPUSelfDispatch; 59 55 *cleanup = passthroughSPUCleanup; 60 *options = passthroughSPUOptions;61 56 *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO); 62 57 -
trunk/src/VBox/Additions/common/crOpenGL/wgl.c
r69310 r78190 7 7 #include "cr_error.h" 8 8 #include "cr_spu.h" 9 #include "cr_environment.h"10 9 #include "cr_mem.h" 11 10 #include "stub.h" … … 19 18 20 19 #include <iprt/cdefs.h> 20 #include <iprt/env.h> 21 21 22 22 /* Currently host part will misbehave re-creating context with proper visual bits … … 83 83 * There are subtle differences in the use of these calls. 84 84 */ 85 crSetenv("CR_WGL_DO_NOT_USE_GDI", "yes");85 RTEnvSet("CR_WGL_DO_NOT_USE_GDI", "yes"); 86 86 87 87 if ( pfd->nSize != sizeof(*pfd) || pfd->nVersion != 1 ) { -
trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk
r77180 r78190 60 60 endif 61 61 VBoxOGLcrutil_SOURCES = \ 62 util/bbox.c \63 62 util/bufpool.c \ 64 util/calllists.c \65 util/devnull.c \66 63 util/dll.c \ 67 util/endian.c \68 util/environment.c \69 64 util/error.c \ 70 util/filenet.c \71 65 util/hash.c \ 72 util/hull.c \73 util/list.c \74 66 util/matrix.c \ 75 67 util/mem.c \ … … 77 69 util/pixel.c \ 78 70 util/process.c \ 79 util/rand.c \80 71 util/string.c \ 81 72 util/threads.c \ 82 util/tcpip.c \83 util/udptcpip.c \84 util/timer.c \85 util/url.c \86 util/warp.c \87 73 util/vreg.cpp \ 88 74 util/blitter.cpp \ … … 90 76 util/htable.cpp \ 91 77 util/bmpscale.cpp \ 92 util/vboxhgcm.c \ 93 $(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c 78 util/vboxhgcm.c 94 79 VBoxOGLcrutil_SOURCES.win = \ 95 80 util/VBoxOGLcrutil.rc … … 123 108 VBoxOGLcrutil_LIBS.win += $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger$(VBOX_SUFF_LIB) 124 109 endif 125 VBoxOGLcrutil_CLEAN = \126 $(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c127 110 if1of ($(KBUILD_TARGET), linux) 128 111 VBoxOGLcrutil_LDFLAGS += -Wl,-z,nodelete … … 191 174 # Generate files for VBoxOGLcrutil and VBoxOGLhostcrutil. 192 175 # 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 197 176 ifdef VBOX_WITH_CRDUMPER 198 177 $(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 $$@) … … 235 214 packer/pack_lights.c \ 236 215 packer/pack_lists.c \ 237 packer/pack_swap_lists.c \238 216 packer/pack_map.c \ 239 217 packer/pack_point.c \ 240 packer/pack_swap_map.c \241 218 packer/pack_misc.c \ 242 219 packer/pack_materials.c \ … … 244 221 packer/pack_pixels.c \ 245 222 packer/pack_pixelmap.c \ 246 packer/pack_swap_pixelmap.c \247 223 packer/pack_program.c \ 248 224 packer/pack_regcombiner.c \ 249 225 packer/pack_stipple.c \ 250 226 packer/pack_texture.c \ 251 packer/pack_swap_texture.c \252 227 packer/pack_visibleregion.c \ 253 228 packer/pack_shaders.c \ 254 229 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 \270 230 $(VBOX_PATH_CROGL_GENFILES)/pack_bbox.c \ 271 231 $(VBOX_PATH_CROGL_GENFILES)/pack_current.c \ 272 232 $(VBOX_PATH_CROGL_GENFILES)/packer.c 273 233 VBoxOGLcrpacker_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 \289 234 $(VBOX_PATH_CROGL_GENFILES)/pack_bbox.c \ 290 235 $(VBOX_PATH_CROGL_GENFILES)/pack_current.c \ … … 347 292 $(call MSG_GENERATE,python,$@,$<) 348 293 $(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 354 294 355 295 # -
trunk/src/VBox/GuestHost/OpenGL/error/errorspu_init.c
r69392 r78190 38 38 } 39 39 40 static SPUOptions errorSPUOptions[] = {41 { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },42 };43 44 40 45 41 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 46 42 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 47 SPUOptionsPtr *options,int *flags )43 int *flags ) 48 44 { 49 45 #ifdef IN_GUEST … … 56 52 *self = errorSPUSelfDispatch; 57 53 *cleanup = errorSPUCleanup; 58 *options = errorSPUOptions;59 54 *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO); 60 55 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_htable.h
r76553 r78190 45 45 } CRHTABLE, *PCRHTABLE; 46 46 47 typedef struct CRHTABLE_ITERATOR48 {49 PCRHTABLE pTbl;50 uint32_t iCur;51 uint32_t cLeft;52 } VCRHTABLE_ITERATOR, *PCRHTABLE_ITERATOR;53 54 47 /*private stuff, not to be used directly */ 55 48 DECLINLINE(CRHTABLE_HANDLE) crHTableIndex2Handle(uint32_t iIndex) … … 61 54 { 62 55 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;100 56 } 101 57 … … 111 67 VBOXHTABLEDECL(CRHTABLE_HANDLE) CrHTablePut(PCRHTABLE pTbl, void *pvData); 112 68 VBOXHTABLEDECL(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 */115 69 VBOXHTABLEDECL(void*) CrHTableRemove(PCRHTABLE pTbl, CRHTABLE_HANDLE hHandle); 116 70 VBOXHTABLEDECL(void*) CrHTableGet(PCRHTABLE pTbl, CRHTABLE_HANDLE hHandle); -
trunk/src/VBox/GuestHost/OpenGL/include/cr_mem.h
r69474 r78190 8 8 #define CR_MEM_H 9 9 10 #include "cr_error.h" 11 12 #include <stdlib.h> 10 13 #include <iprt/types.h> 14 #include <iprt/mem.h> 15 #include <iprt/string.h> 11 16 12 17 #ifdef __cplusplus … … 14 19 #endif 15 20 16 #define DEBUG_MEM 0 21 DECLINLINE(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 } 17 27 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 28 DECLINLINE(void) crMemset( void *ptr, int value, unsigned int bytes ) 29 { 30 CRASSERT(ptr); 31 memset( ptr, value, bytes ); 32 } 33 34 DECLINLINE(void) crMemZero( void *ptr, unsigned int bytes ) 35 { 36 CRASSERT(ptr); 37 memset( ptr, 0, bytes ); 38 } 39 40 DECLINLINE(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 24 47 extern DECLEXPORT(void *) crAlloc( unsigned int nbytes ); 25 48 extern DECLEXPORT(void *) crCalloc( unsigned int nbytes ); 26 #endif27 49 extern DECLEXPORT(void) crRealloc( void **ptr, unsigned int bytes ); 28 50 extern 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 );33 51 34 52 #ifdef __cplusplus -
trunk/src/VBox/GuestHost/OpenGL/include/cr_net.h
r69474 r78190 8 8 #define CR_NET_H 9 9 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 16 11 # include <iprt/win/winsock.h> 17 # endif /* VBOX */18 #endif19 20 #include <stdio.h>21 22 #ifndef WINDOWS23 #include <sys/socket.h>24 #ifndef DARWIN25 #ifdef AF_INET626 /* getaddrinfo & co appeared with ipv6 */27 #define ADDRINFO28 #endif29 #endif30 #include <netinet/in.h>31 #endif32 33 #ifdef SunOS34 #include <sys/types.h>35 12 #endif 36 13 … … 46 23 #endif 47 24 48 #define DEFAULT_SERVER_PORT 700049 50 /* If you change this, update DefaultMothershipPort in mothership.py */51 #define DEFAULT_MOTHERSHIP_PORT 1000052 53 25 typedef struct CRConnection CRConnection; 54 26 55 27 typedef enum { 56 28 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,65 29 CR_VBOXHGCM, 66 30 CR_DROP_PACKETS 67 31 } CRConnectionType; 68 69 #if defined(WINDOWS)70 typedef SOCKET CRSocket;71 #else72 typedef int CRSocket;73 #endif74 32 75 33 typedef void (*CRVoidFunc)( void ); … … 143 101 int broker; /* is connection brokered through mothership? */ 144 102 int threaded; /* is this a threaded connection? */ 145 int endianness,swap;103 int swap; 146 104 int actual_network; /* is this a real network? */ 147 105 148 106 unsigned char *userbuf; 149 107 int userbuf_len; 150 151 char *hostname;152 int port;153 108 154 109 /* To allocate a data buffer of size conn->buffer_size bytes */ … … 173 128 void (*HandleNewMessage)( CRConnection *conn, CRMessage *mess, unsigned int len ); 174 129 /* To accept a new connection from a client */ 175 void (*Accept)( CRConnection *conn , const char *hostname, unsigned short port);130 void (*Accept)( CRConnection *conn); 176 131 /* To connect to a server (return 0 if error, 1 if success) */ 177 132 int (*Connect)( CRConnection *conn ); … … 191 146 int recv_credits; 192 147 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 ADDRINFO202 struct sockaddr_in remoteaddr;203 #else204 struct sockaddr_storage remoteaddr;205 #endif206 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 234 148 /* VBox HGCM */ 149 int index; 235 150 uint32_t u32ClientID; 236 151 uint8_t *pBuffer; … … 275 190 extern DECLEXPORT(void) crNetFree( CRConnection *conn, void *buf ); 276 191 277 extern DECLEXPORT(void) crNetAccept( CRConnection *conn , const char *hostname, unsigned short port);192 extern DECLEXPORT(void) crNetAccept( CRConnection *conn ); 278 193 extern DECLEXPORT(int) crNetConnect( CRConnection *conn ); 279 194 extern DECLEXPORT(void) crNetDisconnect( CRConnection *conn ); 280 195 extern DECLEXPORT(void) crNetFreeConnection( CRConnection *conn ); 281 extern DECLEXPORT(void) crCloseSocket( CRSocket sock );282 196 283 197 extern DECLEXPORT(void) crNetSend( CRConnection *conn, void **bufp, const void *start, unsigned int len ); … … 318 232 extern DECLEXPORT(void) crNetDispatchMessage( CRNetReceiveFuncList *rfl, CRConnection *conn, CRMessage *msg, unsigned int len ); 319 233 320 extern DECLEXPORT(CRConnection *) crNetConnectToServer( const char *server, unsigned short default_port,int mtu, int broker234 extern DECLEXPORT(CRConnection *) crNetConnectToServer( const char *server, int mtu, int broker 321 235 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 322 236 , struct VBOXUHGSMI *pHgsmi … … 331 245 332 246 extern DECLEXPORT(void) crNetRecvReadPixels( const CRMessageReadPixels *rp, unsigned int len ); 333 334 335 /*336 * Quadrics stuff337 */338 #define CR_QUADRICS_DEFAULT_LOW_CONTEXT 32339 #define CR_QUADRICS_DEFAULT_HIGH_CONTEXT 35340 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 );345 247 346 248 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h
r69474 r78190 12 12 #include "cr_protocol.h" 13 13 #include "cr_opcodes.h" 14 #include "cr_endian.h"15 14 #include "state/cr_statetypes.h" 16 15 #include "state/cr_currentpointers.h" … … 84 83 GLvectorf bounds_min, bounds_max; 85 84 int updateBBOX; 86 int swapping;87 85 CRPackBuffer *currentBuffer; 88 86 #ifdef CHROMIUM_THREADSAFE … … 122 120 #endif 123 121 124 extern DECLEXPORT(CRPackContext *) crPackNewContext( int swapping);122 extern DECLEXPORT(CRPackContext *) crPackNewContext(void); 125 123 extern DECLEXPORT(void) crPackDeleteContext(CRPackContext *pc); 126 124 extern DECLEXPORT(void) crPackSetContext( CRPackContext *pc ); … … 164 162 #ifndef IN_RING0 165 163 extern DECLEXPORT(void) crWriteUnalignedDouble( void *buffer, double d ); 166 extern DECLEXPORT(void) crWriteSwappedDouble( void *buffer, double d );167 164 #endif 168 165 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_process.h
r69474 r78190 33 33 34 34 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 43 35 extern DECLEXPORT(void) crGetProcName( char *name, int maxLen ); 44 45 extern DECLEXPORT(void) crGetCurrentDir( char *dir, int maxLen );46 36 47 37 extern DECLEXPORT(CRpid) crGetPID(void); -
trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h
r69474 r78190 16 16 #include "cr_blitter.h" 17 17 #include "cr_htable.h" 18 #include "cr_unpack.h" 18 19 #include "spu_dispatch_table.h" 19 20 #include "cr_dump.h" … … 389 390 CRNetworkPointer return_ptr; 390 391 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; 391 398 392 399 CRLimitsState limits; /**< GL limits for any contexts we create */ -
trunk/src/VBox/GuestHost/OpenGL/include/cr_spu.h
r69474 r78190 21 21 #ifdef DARWIN 22 22 # include <OpenGL/OpenGL.h> 23 # ifdef VBOX_WITH_COCOA_QT24 # else25 # include <AGL/agl.h>26 # endif27 23 #endif 28 24 … … 55 51 SPUNamedFunctionTable *table; 56 52 } SPUFunctions; 57 58 /**59 * SPU Option callback60 * \param spu61 * \param response62 */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 table69 */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 81 53 82 54 /** Init spu */ … … 87 59 typedef int (*SPUCleanupFuncPtr)(void); 88 60 /** Load spu */ 89 typedef int (*SPULoadFunction)(char **, char **, void *, void *, void *, 90 SPUOptionsPtr *, int *); 61 typedef int (*SPULoadFunction)(char **, char **, void *, void *, void *, int *); 91 62 92 63 … … 121 92 SPUCleanupFuncPtr cleanup; /**< SPU cleanup func */ 122 93 SPUFunctions *function_table; /**< Function table for spu */ 123 SPUOptions *options; /**< Options table */124 94 SPUDispatchTable dispatch_table; 125 95 void *privatePtr; /**< pointer to SPU-private data */ … … 154 124 /*@}*/ 155 125 #elif defined(DARWIN) 156 # ifndef VBOX_WITH_COCOA_QT157 /**158 * Apple/AGL159 */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 # endif198 199 126 typedef const GLubyte *(*glGetStringFunc_t)( GLenum ); 200 127 /*@}*/ … … 328 255 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT; 329 256 #elif defined(DARWIN) 330 # ifndef VBOX_WITH_COCOA_QT331 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 # endif351 352 257 CGLChoosePixelFormatFunc_t CGLChoosePixelFormat; 353 258 CGLDestroyPixelFormatFunc_t CGLDestroyPixelFormat; … … 435 340 DECLEXPORT(int) SPULoad( char **name, char **super, SPUInitFuncPtr *init, 436 341 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 437 SPUOptionsPtr *options,int *flags );342 int *flags ); 438 343 439 344 DECLEXPORT(SPU *) crSPULoad( SPU *child, int id, char *name, char *dir, void *server); … … 444 349 DECLEXPORT(void) crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src ); 445 350 DECLEXPORT(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 );450 351 451 352 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_unpack.h
r78076 r78190 20 20 #endif 21 21 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 */ 25 typedef 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. */ 46 typedef CrUnpackerState *PCrUnpackerState; 47 /** Pointer to a const unpacker state. */ 48 typedef const CrUnpackerState *PCCrUnpackerState; 49 50 DECLEXPORT(void) crUnpack(PCrUnpackerState pState); 32 51 33 52 typedef enum … … 41 60 DECLEXPORT(CR_UNPACK_BUFFER_TYPE) crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes); 42 61 43 extern CRNetworkPointer * return_ptr;44 extern CRNetworkPointer * writeback_ptr;45 46 62 #if defined(LINUX) || defined(WINDOWS) 47 63 #define CR_UNALIGNED_ACCESS_OKAY … … 51 67 DECLEXPORT(double) crReadUnalignedDouble( const void *buffer ); 52 68 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 */ 72 DECLINLINE(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 120 DECLINLINE(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 )) 55 152 56 153 #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 ) 59 155 #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))) \ 86 185 { \ 87 186 crError("%s: SET_RETURN_PTR(%u) offset out of bounds\n", __FUNCTION__, offset); \ 88 187 return; \ 89 188 } \ 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); \ 99 199 return; \ 100 200 } \ 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) ); \ 102 202 } while (0); 103 203 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h
r69474 r78190 76 76 #ifdef CR_OPENGL_VERSION_2_1 77 77 # define CR_OPENGL_VERSION_STRING "2.1" 78 # define CR_OPENGL_VERSION_MAJOR 2 79 # define CR_OPENGL_VERSION_MINOR 1 78 80 #elif defined(CR_OPENGL_VERSION_2_0) 79 81 # define CR_OPENGL_VERSION_STRING "2.0" 82 # define CR_OPENGL_VERSION_MAJOR 2 83 # define CR_OPENGL_VERSION_MINOR 0 80 84 #else 81 85 # define CR_OPENGL_VERSION_STRING "1.5" 86 # define CR_OPENGL_VERSION_MAJOR 1 87 # define CR_OPENGL_VERSION_MINOR 5 82 88 #endif 83 89 -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_limits.h
r69474 r78190 272 272 extern DECLEXPORT(void) crStateLimitsPrint(const CRLimitsState *limits); 273 273 274 extern DECLEXPORT( GLfloat) crStateComputeVersion(float minVersion);274 extern DECLEXPORT(void) crStateComputeVersion(uint32_t *puMajorMin, uint32_t *puMinorMin); 275 275 276 276 extern DECLEXPORT(GLubyte *) crStateMergeExtensions(GLuint n, const GLubyte **extensions); -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_beginend.c
r69392 r78190 39 39 } 40 40 41 void PACK_APIENTRY crPackBeginSWAP( GLenum mode )42 {43 CR_GET_PACKER_CONTEXT(pc);44 unsigned char *data_ptr;45 (void) pc;46 #ifndef VBOX47 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 #endif55 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 64 41 void PACK_APIENTRY crPackEnd( void ) 65 42 { … … 74 51 } 75 52 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 20 20 ui[0] = ((unsigned int *) &d)[0]; 21 21 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]);29 22 } 30 23 … … 375 368 } 376 369 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 ); 382 371 pc->buffer.holds_BeginEnd |= src->holds_BeginEnd; 383 372 pc->buffer.in_BeginEnd = src->in_BeginEnd; … … 462 451 */ 463 452 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; 473 454 #ifndef CHROMIUM_THREADSAFE 474 455 sanityCheckPointer = data_ptr + 4; -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_context.c
r69392 r78190 50 50 } 51 51 52 void PACK_APIENTRY53 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 86 52 void PACK_APIENTRY crPackWindowCreate( const char *dpyName, GLint visBits, GLint *return_value, int *writeback ) 87 53 { … … 113 79 } 114 80 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 7 7 8 8 #include "cr_error.h" 9 #include "cr_environment.h"10 9 #include "cr_pack.h" 11 10 #include "packer.h" 11 12 #include <iprt/env.h> 12 13 13 14 … … 32 33 pc->Error( line, file, error, info ); 33 34 34 if ( crGetenv("CR_DEBUG"))35 if (RTEnvExist("CR_DEBUG")) 35 36 { 36 37 char *glerr; -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_feedback.c
r69392 r78190 18 18 } 19 19 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 30 20 void PACK_APIENTRY crPackSelectBuffer( GLsizei size, GLuint *buffer ) 31 21 { … … 37 27 } 38 28 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 24 24 } 25 25 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 55 55 } 56 56 57 void PACK_APIENTRY58 crPackDeleteRenderbuffersEXTSWAP(GLsizei n, const GLuint * renderbuffers)59 {60 (void) n;61 (void) renderbuffers;62 crError ("No swap version");63 }64 65 void PACK_APIENTRY66 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 62 62 63 63 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)))65 64 66 65 … … 79 78 print('void PACK_APIENTRY crPack%sBBOX(%s);' % (func_name, apiutil.MakeDeclarationString(args))) 80 79 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)))83 80 84 81 -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_init.c
r69392 r78190 20 20 uint32_t cr_packer_cmd_blocks_enabled = 0; 21 21 22 CRPackContext *crPackNewContext( int swapping)22 CRPackContext *crPackNewContext(void) 23 23 { 24 24 #ifdef CHROMIUM_THREADSAFE … … 32 32 #endif 33 33 pc->u32CmdBlockState = 0; 34 pc->swapping = swapping;35 34 pc->Flush = NULL; 36 35 pc->SendHuge = NULL; -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c
r76553 r78190 634 634 } 635 635 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 51 51 } 52 52 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 13 13 14 14 15 def WriteData( offset, arg_type, arg_name , is_swapped):15 def WriteData( offset, arg_type, arg_name ): 16 16 """Return a string to write a variable to the packing buffer.""" 17 17 retval = 9 … … 19 19 retval = "\tWRITE_NETWORK_POINTER(%d, (void *) %s);" % (offset, arg_name ) 20 20 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) 32 23 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) 37 25 if retval == 9: 38 26 print >>sys.stderr, "no retval for %s %s" % (arg_name, arg_type) … … 113 101 114 102 115 def PrintFunc( func_name, params, is_swapped,can_have_pointers ):103 def PrintFunc( func_name, params, can_have_pointers ): 116 104 """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))) 121 106 print('{') 122 107 print('\tCR_GET_PACKER_CONTEXT(pc);') … … 184 169 if is_extended: 185 170 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 ))) 188 173 else: 189 174 counter = 0 … … 197 182 for i in range(0, vecSize): 198 183 print(WriteData( counter + i * apiutil.sizeof(ptrType), 199 ptrType, "%s[%d]" % (name, i) , is_swapped))184 ptrType, "%s[%d]" % (name, i))) 200 185 # XXX increment counter here? 201 186 else: 202 print(WriteData( counter, type, name , is_swapped))187 print(WriteData( counter, type, name)) 203 188 if apiutil.IsPointer(type): 204 189 counter += apiutil.PointerSize() … … 267 252 print('#ifndef IN_RING0') 268 253 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 272 256 if not func_name in r0_funcs: 273 257 print('#endif') -
trunk/src/VBox/GuestHost/OpenGL/packer/packer_bbox.py
r69392 r78190 66 66 """) 67 67 68 def WriteData( offset, arg_type, arg_name , is_swapped):68 def WriteData( offset, arg_type, arg_name ): 69 69 if arg_type.find('*') != -1: 70 70 retval = "\tWRITE_NETWORK_POINTER(%d, (void *) %s);" % (offset, arg_name ) 71 71 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) 88 76 return retval 89 77 90 78 91 79 def PrintFunction( func_name, extSuffix, num_coords, argtype, 92 do_ swapped, do_count, do_vector ):80 do_count, do_vector ): 93 81 """ 94 82 Generate all the functions named crPackVertex[234][dfis][v]BBOX() and … … 102 90 else: 103 91 countSuffix = "" 104 105 if do_swapped:106 swapSuffix = "SWAP"107 else:108 swapSuffix = ""109 92 110 93 if func_name[0:12] == "VertexAttrib": … … 146 129 params = apiutil.Parameters(func_name + extSuffix) 147 130 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))) 150 133 print('{') 151 134 … … 229 212 if do_vector: 230 213 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);") 235 215 counter += 4 236 216 argname = params[1][0] # skip 'index' parameter … … 239 219 240 220 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))) 242 222 counter += apiutil.sizeof(vector_type) 243 223 … … 253 233 for index in range(0,len(params)): 254 234 (name, type, vecSize) = params[index] 255 print(WriteData( counter, type, name , do_swapped))235 print(WriteData( counter, type, name)) 256 236 counter += apiutil.sizeof(type) 257 237 … … 272 252 for argtype in ['d', 'f', 'i', 's']: 273 253 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 ) 279 258 280 259 for num_coords in [1,2,3,4]: 281 260 for argtype in ['d', 'f', 's']: 282 261 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 ) 288 266 289 267 # Special vector functions … … 303 281 vec = 2 # special, hacked value 304 282 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 ) 308 285 309 286 # Special non-vector functions … … 312 289 vec = 0 313 290 num_coords = 4 314 for swapin 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 21 21 if apiutil.CanPack(func_name): 22 22 print "crPack%s" % func_name 23 print "crPack%sSWAP" % func_name24 23 25 24 functions = [ … … 171 170 for func_name in functions: 172 171 print "%s" % func_name 173 print "%sSWAP" % func_name174 172 175 173 -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/glloader.py
r69392 r78190 21 21 #include "cr_string.h" 22 22 #include "cr_error.h" 23 #include "cr_environment.h" 23 24 #include <iprt/env.h> 24 25 25 26 #include <stdio.h> … … 36 37 #define SYSTEM_GL "libGL.dylib" 37 38 #define SYSTEM_CGL "OpenGL" 38 # ifndef VBOX_WITH_COCOA_QT39 # define SYSTEM_AGL "AGL"40 # endif41 39 #include <string.h> /* VBOX */ 42 40 #elif defined(IRIX) || defined(IRIX64) || defined(Linux) || defined(FreeBSD) || defined(AIX) || defined(SunOS) || defined(OSF1) … … 59 57 #define SYSTEM_CGL_DIR "/System/Library/Frameworks/OpenGL.framework" 60 58 static CRDLL *cglDll = NULL; 61 # ifndef VBOX_WITH_COCOA_QT62 # define SYSTEM_AGL_DIR "/System/Library/Frameworks/AGL.framework"63 static CRDLL *aglDll = NULL;64 # endif65 59 #endif 66 60 … … 263 257 crDLLClose( cglDll ); 264 258 cglDll = NULL; 265 266 # ifndef VBOX_WITH_COCOA_QT267 crDLLClose( aglDll );268 aglDll = NULL;269 # endif270 259 #endif 271 260 } … … 294 283 int i; 295 284 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" ); 302 288 #endif 303 289 … … 326 312 327 313 crDebug( "Found it in %s.", !env_cgl_syspath ? "default path" : env_cgl_syspath ); 328 329 # ifndef VBOX_WITH_COCOA_QT330 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 # endif340 314 #endif 341 315 """) … … 466 440 467 441 print('#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 473 442 for fun in useful_cgl_functions: 474 443 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError(cglDll, "%s");' % (fun, fun,fun)) … … 580 549 static CRDLL *osMesaDll = NULL; 581 550 582 const char *env_syspath = crGetenv( "CR_SYSTEM_GL_PATH" );551 const char *env_syspath = RTEnvGet( "CR_SYSTEM_GL_PATH" ); 583 552 584 553 crDebug( "Looking for the system's OSMesa library..." ); -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuinit.c
r69392 r78190 28 28 } 29 29 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 number95 * 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 of184 * 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 6 6 7 7 #include "cr_mem.h" 8 #include "cr_environment.h"9 8 #include "cr_string.h" 10 9 #include "cr_dll.h" … … 120 119 &(the_spu->init), &(the_spu->self), 121 120 &(the_spu->cleanup), 122 &(the_spu->options),123 121 &(the_spu->spu_flags)) ) 124 122 { -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump.cpp
r76553 r78190 20 20 #include "cr_error.h" 21 21 #include "cr_net.h" 22 #include "cr_rand.h"23 22 #include "cr_mem.h" 24 23 #include "cr_string.h" -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
r63939 r78190 40 40 #include "cr_error.h" 41 41 #include "cr_net.h" 42 #include "cr_rand.h"43 42 #include "cr_mem.h" 44 43 #include "cr_string.h" -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_error.c
r69392 r78190 9 9 #include "state.h" 10 10 #include "cr_error.h" 11 #include "cr_environment.h"12 11 #include <stdarg.h> 13 12 #include <stdio.h> 13 14 #include <iprt/env.h> 14 15 15 16 void crStateError( int line, const char *file, GLenum error, const char *format, ... ) … … 25 26 26 27 #ifndef DEBUG_misha 27 if ( crGetenv("CR_DEBUG"))28 if (RTEnvExist("CR_DEBUG")) 28 29 #endif 29 30 { -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
r76553 r78190 23 23 #include "cr_mem.h" 24 24 #include "cr_string.h" 25 26 #include <stdio.h> /*sprintf*/ 25 27 26 28 static CRGLSLShader* crStateGetShaderObj(GLuint id) -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_limits.c
r69392 r78190 174 174 * compute the version number supported by Chromium. 175 175 */ 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; 176 void 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; 182 189 } 183 190 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_occlude.c
r76802 r78190 10 10 #include "state_internals.h" 11 11 #include "cr_mem.h" 12 13 #if !defined(IN_GUEST)14 #include "cr_unpack.h"15 #endif16 12 17 13 void … … 63 59 return; 64 60 } 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 #endif80 61 81 62 for (i = 0; i < n; i++) { -
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r78116 r78190 34 34 # include "cr_error.h" 35 35 # include "cr_net.h" 36 # include "cr_rand.h"37 36 # include "cr_mem.h" 38 37 # include "cr_string.h" -
trunk/src/VBox/GuestHost/OpenGL/util/error.c
r76553 r78190 25 25 #include <iprt/buildconfig.h> 26 26 27 27 28 #include <VBox/log.h> 29 #include <iprt/env.h> 28 30 29 31 #ifdef RT_OS_WINDOWS 30 32 # include <iprt/win/windows.h> 31 # include "cr_environment.h"32 33 # include "cr_error.h" 33 34 # include "VBox/VBoxGuestLib.h" … … 100 101 /* Log last error on windows. */ 101 102 dwLastErr = GetLastError(); 102 if (dwLastErr != 0 && crGetenv("CR_WINDOWS_ERRORS") != NULL)103 if (dwLastErr != 0 && RTEnvGet("CR_WINDOWS_ERRORS") != NULL) 103 104 { 104 105 LPTSTR pszWindowsMessage; -
trunk/src/VBox/GuestHost/OpenGL/util/htable.cpp
r76553 r78190 28 28 #include "cr_error.h" 29 29 #include "cr_net.h" 30 #include "cr_rand.h"31 30 #include "cr_mem.h" 32 31 #include "cr_string.h" -
trunk/src/VBox/GuestHost/OpenGL/util/net.c
r69392 r78190 22 22 #include "cr_error.h" 23 23 #include "cr_string.h" 24 #include "cr_url.h"25 24 #include "cr_net.h" 26 25 #include "cr_netserver.h" 27 26 #include "cr_pixeldata.h" 28 #include "cr_environment.h"29 #include "cr_endian.h"30 27 #include "cr_bufpool.h" 31 28 #include "cr_threads.h" … … 47 44 48 45 /* 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;57 46 int use_hgcm; 58 47 … … 60 49 61 50 #ifdef CHROMIUM_THREADSAFE 62 CRmutex mutex; 63 #endif 64 int my_rank; /* Teac/TSComm only */ 51 CRmutex mutex; 52 #endif 65 53 } cr_net; 66 54 … … 73 61 */ 74 62 static void 75 InitConnection(CRConnection *conn , const char *protocol, unsigned int mtu63 InitConnection(CRConnection *conn 76 64 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 77 65 , struct VBOXUHGSMI *pHgsmi … … 79 67 ) 80 68 { 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 }112 69 #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 178 78 } 179 79 … … 192 92 * the mothership 193 93 */ 194 CRConnection * crNetConnectToServer( const char *server, unsigned short default_port,int mtu, int broker94 CRConnection * crNetConnectToServer( const char *server, int mtu, int broker 195 95 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 196 96 , struct VBOXUHGSMI *pHgsmi … … 198 98 ) 199 99 { 200 char hostname[4096], protocol[4096];201 unsigned short port;202 100 CRConnection *conn; 203 101 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 ); 206 104 207 105 CRASSERT( cr_net.initialized ); … … 212 110 "but the minimum MTU is %d", server, mtu, CR_MINIMUM_MTU ); 213 111 } 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_ name221 * of the localhost. If we don't do this, there seems to be222 * confusion in the mothership as to whether or not "localhost" and223 * "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 the232 * crTeacConnection() function with no problem. I.e. change the233 * 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_SUPPORT248 /* 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 #endif257 112 258 113 conn = (CRConnection *) crCalloc( sizeof(*conn) ); … … 263 118 conn->type = CR_NO_CONNECTION; /* we don't know yet */ 264 119 conn->recv_credits = CR_INITIAL_RECV_CREDITS; 265 conn->hostname = crStrdup( hostname );266 conn->port = port;267 120 conn->mtu = mtu; 268 121 conn->buffer_size = mtu; 269 122 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;278 123 279 124 crInitMessageList(&conn->messageList); 280 125 281 126 /* now, just dispatch to the appropriate protocol's initialization functions. */ 282 InitConnection(conn , protocol, mtu127 InitConnection(conn 283 128 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 284 129 , pHgsmi … … 311 156 ) 312 157 { 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 else322 msg.header.type = CR_MESSAGE_NEWCLIENT;323 324 crNetSend( conn, NULL, &msg, len );325 */326 327 158 crNetServerConnect( ns 328 159 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 349 180 CRConnection *conn; 350 181 182 RT_NOREF(hostname); 351 183 CRASSERT( cr_net.initialized ); 352 184 … … 358 190 conn->type = CR_NO_CONNECTION; /* we don't know yet */ 359 191 conn->recv_credits = CR_INITIAL_RECV_CREDITS; 360 conn->port = port;361 192 conn->mtu = mtu; 362 193 conn->buffer_size = mtu; 363 194 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;369 195 370 196 crInitMessageList(&conn->messageList); … … 374 200 protocol, (int) port, (int) mtu); 375 201 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 392 204 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) 393 205 , NULL 394 206 #endif 395 ); /* ktd (add) */396 }397 else {398 /* call the protocol-specific init routines */399 InitConnection(conn, protocol, mtu400 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)401 , NULL402 #endif403 207 ); 404 } 405 406 crNetAccept( conn, hostname, port ); 208 209 crNetAccept(conn); 407 210 return conn; 408 211 } … … 416 219 { 417 220 conn->Disconnect(conn); 418 crFree( conn->hostname );419 221 #ifdef CHROMIUM_THREADSAFE 420 222 crFreeMutex( &conn->messageList.lock ); … … 440 242 else 441 243 { 442 #ifdef WINDOWS443 /** @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 #endif452 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;460 244 cr_net.use_hgcm = 0; 461 245 cr_net.num_clients = 0; … … 555 339 CRConnection **c; 556 340 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 566 341 #ifdef VBOX_WITH_HGCM 567 342 c = crVBoxHGCMDump( num ); 568 if ( c ) return c;569 #endif570 #ifdef GM_SUPPORT571 c = crGmDump( num );572 if ( c ) return c;573 #endif574 #ifdef IB_SUPPORT575 c = crIBDump( num );576 if ( c ) return c;577 #endif578 #ifdef SDP_SUPPORT579 c = crSDPDump( num );580 343 if ( c ) return c; 581 344 #endif … … 866 629 ) 867 630 { 868 ns->conn = crNetConnectToServer( ns->name, DEFAULT_SERVER_PORT,631 ns->conn = crNetConnectToServer( ns->name, 869 632 ns->buffer_size, 0 870 633 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 890 653 { 891 654 conn->Disconnect( conn ); 892 crFree( conn->hostname );893 655 #ifdef CHROMIUM_THREADSAFE 894 656 crFreeMutex( &conn->messageList.lock ); … … 902 664 * Apparently, this is only called from the crNetConnectToServer function. 903 665 */ 904 void crNetAccept( CRConnection *conn , const char *hostname, unsigned short port)905 { 906 conn->Accept( conn , hostname, port);666 void crNetAccept( CRConnection *conn) 667 { 668 conn->Accept( conn); 907 669 } 908 670 … … 916 678 void crNetSingleRecv( CRConnection *conn, void *buf, unsigned int len ) 917 679 { 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." ); 922 682 conn->Recv( conn, buf, len ); 923 683 } … … 987 747 { 988 748 CRASSERT( len == sizeof(CRMessageFlowControl) ); 989 conn->send_credits += (conn->swap ? SWAP32(msg->credits) : msg->credits);749 conn->send_credits += msg->credits; 990 750 conn->InstantReclaim( conn, (CRMessage *) msg ); 991 751 } … … 1095 855 case CR_MESSAGE_OPCODES: 1096 856 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 }1102 857 break; 1103 858 case CR_MESSAGE_READ_PIXELS: … … 1251 1006 void crNetReadline( CRConnection *conn, void *buf ) 1252 1007 { 1253 char *temp, c;1008 RT_NOREF(buf); 1254 1009 1255 1010 if (!conn || conn->type == CR_NO_CONNECTION) 1256 1011 return; 1257 1012 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 ); 1273 1015 } 1274 1016 … … 1301 1043 int found_work = 0; 1302 1044 1303 if ( cr_net.use_tcpip )1304 found_work += crTCPIPRecv();1305 1045 #ifdef VBOX_WITH_HGCM 1306 1046 if ( cr_net.use_hgcm ) … … 1311 1051 ); 1312 1052 #endif 1313 #ifdef SDP_SUPPORT1314 if ( cr_net.use_sdp )1315 found_work += crSDPRecv();1316 #endif1317 #ifdef IB_SUPPORT1318 if ( cr_net.use_ib )1319 found_work += crIBRecv();1320 #endif1321 if ( cr_net.use_udp )1322 found_work += crUDPTCPIPRecv();1323 1324 if ( cr_net.use_file )1325 found_work += crFileRecv();1326 1327 #ifdef GM_SUPPORT1328 if ( cr_net.use_gm )1329 found_work += crGmRecv();1330 #endif1331 1332 #ifdef TEAC_SUPPORT1333 if ( cr_net.use_teac )1334 found_work += crTeacRecv();1335 #endif1336 1337 #ifdef TCSCOMM_SUPPORT1338 if ( cr_net.use_tcscomm )1339 found_work += crTcscommRecv();1340 #endif1341 1053 1342 1054 return found_work; 1343 1055 } 1344 1056 1345 1346 /**1347 * Teac/TSComm only1348 */1349 void1350 crNetSetRank( int my_rank )1351 {1352 cr_net.my_rank = my_rank;1353 #ifdef TEAC_SUPPORT1354 crTeacSetRank( cr_net.my_rank );1355 #endif1356 #ifdef TCSCOMM_SUPPORT1357 crTcscommSetRank( cr_net.my_rank );1358 #endif1359 }1360 1361 /**1362 * Teac/TSComm only1363 */1364 void1365 crNetSetContextRange( int low_context, int high_context )1366 {1367 #if !defined(TEAC_SUPPORT) && !defined(TCSCOMM_SUPPORT)1368 (void)low_context; (void)high_context;1369 #endif1370 #ifdef TEAC_SUPPORT1371 crTeacSetContextRange( low_context, high_context );1372 #endif1373 #ifdef TCSCOMM_SUPPORT1374 crTcscommSetContextRange( low_context, high_context );1375 #endif1376 }1377 1378 /**1379 * Teac/TSComm only1380 */1381 void1382 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 #endif1387 #ifdef TEAC_SUPPORT1388 crTeacSetNodeRange( low_node, high_node );1389 #endif1390 #ifdef TCSCOMM_SUPPORT1391 crTcscommSetNodeRange( low_node, high_node );1392 #endif1393 }1394 1395 /**1396 * Teac/TSComm only1397 */1398 void1399 crNetSetKey( const unsigned char* key, const int keyLength )1400 {1401 #ifdef TEAC_SUPPORT1402 crTeacSetKey( key, keyLength );1403 #else1404 (void)key; (void)keyLength;1405 #endif1406 } -
trunk/src/VBox/GuestHost/OpenGL/util/net_internals.h
r63199 r78190 10 10 11 11 /* 12 * DevNull network interface13 */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 interface22 */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 interface31 */32 typedef enum {33 CRTCPIPMemory,34 CRTCPIPMemoryBig35 } CRTCPIPBufferKind;36 37 #define CR_TCPIP_BUFFER_MAGIC 0x8913453238 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_THREADSAFE53 CRmutex mutex;54 CRmutex recvmutex;55 #endif56 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 interface84 */85 extern void crUDPTCPIPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );86 extern void crUDPTCPIPConnection( CRConnection *conn );87 extern int crUDPTCPIPRecv( void );88 89 /*90 12 * VirtualBox HGCM 91 13 */ 92 14 #ifdef VBOX_WITH_HGCM 93 extern void crVBoxHGCMInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl , unsigned int mtu);15 extern void crVBoxHGCMInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl); 94 16 extern void crVBoxHGCMConnection( CRConnection *conn 95 17 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) … … 111 33 #endif 112 34 113 /*114 * TEAC network interface115 */116 #ifdef TEAC_SUPPORT117 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 interface130 */131 #ifdef TCSCOMM_SUPPORT132 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 interface141 */142 #ifdef SDP_SUPPORT143 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 interface153 */154 #ifdef IB_SUPPORT155 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 interface164 */165 #ifdef GM_SUPPORT166 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 187 35 extern CRConnection** crNetDump( int *num ); 188 36 -
trunk/src/VBox/GuestHost/OpenGL/util/process.c
r63199 r78190 22 22 #define snprintf _snprintf 23 23 #endif 24 25 /**26 * Sleep/pause for the given number of seconds.27 */28 void crSleep( unsigned int seconds )29 {30 #ifdef WINDOWS31 Sleep(seconds*1000); /* milliseconds */32 #else33 sleep(seconds);34 #endif35 }36 37 /**38 * Sleep/pause for the given number of milliseconds.39 */40 void crMsleep( unsigned int msec )41 {42 #ifdef WINDOWS43 Sleep(msec);44 #else45 usleep(msec*1000); /* usecs */46 #endif47 }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 WINDOWS56 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 #else81 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 #endif91 }92 93 94 /*95 * Kill the named process.96 */97 void crKill( CRpid pid )98 {99 #ifdef WINDOWS100 TerminateProcess( pid, 0 );101 #else102 kill((pid_t) pid, SIGKILL);103 #endif104 }105 106 24 107 25 /* … … 208 126 209 127 210 /*211 * Return current directory string.212 */213 void crGetCurrentDir( char *dir, int maxLen )214 {215 #ifdef WINDOWS216 if (!GetCurrentDirectory(maxLen, dir))217 dir[0] = 0;218 #else219 if (!getcwd(dir, maxLen))220 dir[0] = 0;221 #endif222 }223 224 225 128 /** 226 129 * Return current process ID number. -
trunk/src/VBox/GuestHost/OpenGL/util/util.def
r69392 r78190 12 12 crDebug 13 13 crInfo 14 crParseURL15 crAlloc16 crCalloc17 crAllocDebug18 crCallocDebug19 crRealloc20 crMemset21 crFree22 14 crStrSplit 23 15 crStrSplitn … … 43 35 crBytesToString 44 36 crWordsToString 45 crGetHostname46 37 crGetPID 47 38 crNetAcceptClient … … 74 65 crImageSize 75 66 crTextureSize 76 crGetenv77 crSetenv78 67 crHashtableAdd 79 68 crHashtableDelete … … 90 79 crFreeHashtableEx 91 80 crHashtableGetDataKey 92 crDetermineEndianness93 SWAPDOUBLE94 81 crBufferPoolInit 95 82 crBufferPoolPush 96 83 crBufferPoolPop 97 84 crBufferPoolFree 98 crTimerNewTimer99 85 crBufferPoolGetNumBuffers 100 86 crBufferPoolGetMaxBuffers 101 crDestroyTimer102 crStartTimer103 crStopTimer104 crResetTimer105 crTimerTime106 crMemcpy107 crMemcmp108 crMemZero109 crCalloc110 87 crSetTSD 111 88 crGetTSD … … 129 106 crGetTSD 130 107 crFreeTSD 131 crRandFloat132 crRandInt133 crRandSeed134 crRandAutoSeed135 crTransformBBox136 crProjectBBox137 crRectiUnion138 crWarpPoint139 crHullInteriorBox140 crNetSetNodeRange141 crNetSetContextRange142 crNetSetRank143 crNetSetKey144 crSleep145 crSpawn146 crKill147 108 crGetProcName 148 crGetCurrentDir149 109 crHashtableAllocKeys 150 110 crHashtableDeleteBlock -
trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
r76553 r78190 32 32 #include "cr_mem.h" 33 33 #include "cr_string.h" 34 #include "cr_endian.h"35 34 #include "cr_threads.h" 36 35 #include "net_internals.h" … … 1185 1184 * Called on host side only, to "accept" client connection 1186 1185 */ 1187 static void crVBoxHGCMAccept( CRConnection *conn, const char *hostname, unsigned short port ) 1188 { 1189 RT_NOREF(hostname, port); 1186 static void crVBoxHGCMAccept( CRConnection *conn) 1187 { 1190 1188 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); 1191 1189 CRASSERT(conn && conn->pHostBuffer); … … 2067 2065 * Called on host side only, to "accept" client connection 2068 2066 */ 2069 static void crVBoxHGSMIAccept( CRConnection *conn , const char *hostname, unsigned short port)2067 static void crVBoxHGSMIAccept( CRConnection *conn) 2070 2068 { 2071 2069 VBOXCRHGSMIPROFILE_FUNC_PROLOGUE(); … … 2186 2184 #endif 2187 2185 2188 void crVBoxHGCMInit(CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu) 2189 { 2190 (void) mtu; 2191 2186 void crVBoxHGCMInit(CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl) 2187 { 2192 2188 g_crvboxhgcm.recv_list = rfl; 2193 2189 g_crvboxhgcm.close_list = cfl; -
trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
r78086 r78190 29 29 $(VBOX_PATH_CROGL_GENFILES)/ 30 30 endif 31 32 ifdef VBOX_WITH_CR_DISPLAY_LISTS33 LIBRARIES += VBoxOGLcrdlm34 DLLS += VBoxOGLexpandospu35 endif # VBOX_WITH_CR_DISPLAY_LISTS36 31 37 32 ifeq ($(KBUILD_TARGET),darwin) … … 97 92 VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI 98 93 endif 99 ifdef VBOX_WITH_CR_DISPLAY_LISTS100 VBoxSharedCrOpenGL_LIBS += $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB)101 endif102 94 103 95 # … … 116 108 $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h 117 109 118 ifdef VBOX_WITH_CR_DISPLAY_LISTS119 VBoxOGLcrserverlib_INTERMEDIATES += $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h120 endif121 122 110 VBoxOGLcrserverlib_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 \ 150 138 crserverlib/server_muralfbo.cpp \ 151 crserverlib/server_texture.c \139 crserverlib/server_texture.cpp \ 152 140 crserverlib/presenter/server_presenter.cpp \ 153 141 crserverlib/presenter/display_base.cpp \ … … 158 146 crserverlib/presenter/display_vrdp.cpp \ 159 147 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 164 152 VBoxOGLcrserverlib_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 \ 169 157 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h 170 ifdef VBOX_WITH_CR_DISPLAY_LISTS171 VBoxOGLcrserverlib_DEFS += VBOX_WITH_CR_DISPLAY_LISTS172 endif173 158 ifdef VBOXCR_LOGFPS 174 159 VBoxOGLcrserverlib_DEFS += VBOXCR_LOGFPS … … 192 177 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) 193 178 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 $$@) 207 192 $(call MSG_GENERATE,python,$@,$<) 208 193 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) … … 223 208 $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h 224 209 VBoxOGLcrunpacker_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 \ 250 235 $(VBOX_PATH_CROGL_GENFILES)/unpack.cpp 251 236 VBoxOGLcrunpacker_CLEAN = \ … … 270 255 $(call MSG_GENERATE,python,$@,$<) 271 256 $(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_LISTS275 #276 # VBoxOGLcrdlm277 #278 279 VBoxOGLcrdlm_TEMPLATE = VBOXCROGLR3HOSTLIB280 VBoxOGLcrdlm_INCS = \281 dlm282 VBoxOGLcrdlm_INTERMEDIATES = \283 $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \284 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h285 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.c295 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.h300 #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 # VBoxOGLexpandospu329 #330 VBoxOGLexpandospu_TEMPLATE = VBOXCROGLR3HOSTDLL331 VBoxOGLexpandospu_INCS = \332 expando333 VBoxOGLexpandospu_SOURCES = \334 expando/expandospu.c \335 expando/expandospu_config.c \336 expando/expandospu_init.c \337 $(VBOX_PATH_CROGL_GENFILES)/expando.c338 VBoxOGLexpandospu_CLEAN = \339 $(VBOX_PATH_CROGL_GENFILES)/expando.c340 VBoxOGLexpandospu_CLEAN = \341 $(VBOX_PATH_CROGL_GENFILES)/expando.c342 VBoxOGLexpandospu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLexpandospu.dylib343 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 endif360 257 361 258 -
trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
r76553 r78190 26 26 #include <ApplicationServices/ApplicationServices.h> 27 27 #include <OpenGL/gl.h> 28 #ifdef VBOX_WITH_COCOA_QT 29 # include <OpenGL/glu.h> 30 #endif 28 #include <OpenGL/glu.h> 31 29 32 30 #include <iprt/env.h> … … 143 141 GLboolean isSupported = GL_TRUE; 144 142 145 #ifdef VBOX_WITH_COCOA_QT146 143 /* 147 144 * In the Cocoa port we depend on the GL_EXT_framebuffer_object & … … 160 157 else 161 158 LogRel(("OpenGL Info: 3D test found that GL_EXT_framebuffer_object extension not supported.\n")); 162 #endif /* VBOX_WITH_COCOA_QT */163 159 164 160 CGLDestroyContext(pCglContext); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h
r76553 r78190 24 24 #include "cr_error.h" 25 25 #include "cr_net.h" 26 #include "cr_rand.h"27 26 #include "server_dispatch.h" 28 27 #include "server.h" -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r71607 r78190 92 92 } CRServerProgram; 93 93 94 void crServerSetVBoxConfiguration();95 94 void crServerSetVBoxConfigurationHGCM(); 96 95 void crServerInitDispatch(void); … … 107 106 void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum ); 108 107 void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural ); 109 110 GLboolean crServerInitializeBucketing(CRMuralInfo *mural);111 108 112 109 void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py
r78116 r78190 110 110 print('\t{') 111 111 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)) 113 113 print('\t}') 114 114 print('}\n') -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getpixelmap.cpp
r78189 r78190 70 70 pbo_offset = (GLfloat*) ((uintptr_t) *((GLint*)values)); 71 71 72 cr_server.head_spu->dispatch_table.GetPixelMapfv( map, pbo_offset );72 cr_server.head_spu->dispatch_table.GetPixelMapfv( map, (GLfloat *)pbo_offset ); 73 73 } 74 74 else … … 97 97 pbo_offset = (GLuint*) ((uintptr_t) *((GLint*)values)); 98 98 99 cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, pbo_offset );99 cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, (GLuint *)pbo_offset ); 100 100 } 101 101 else … … 124 124 pbo_offset = (GLushort*) ((uintptr_t) *((GLint*)values)); 125 125 126 cr_server.head_spu->dispatch_table.GetPixelMapusv( map, pbo_offset );126 cr_server.head_spu->dispatch_table.GetPixelMapusv( map, (GLushort *)pbo_offset ); 127 127 } 128 128 else -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_papi.cpp
r78189 r78190 12 12 13 13 #define DEBUG_BARRIERS 1 14 #ifdef DEBUG_BARRIERS 15 # include <stdio.h> 16 #endif 14 17 15 18 void SERVER_DISPATCH_APIENTRY crServerDispatchBarrierCreateCR( GLuint name, GLuint count ) … … 165 168 } 166 169 167 sema = crHashtableSearch(cr_server.semaphores, name);170 sema = (CRServerSemaphore *)crHashtableSearch(cr_server.semaphores, name); 168 171 if (sema) 169 172 return; /* already created */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py
r74890 r78190 30 30 if (cr_server.bIsInLoadingState) 31 31 return; 32 33 if (cr_server.curClient->conn->type == CR_FILE)34 {35 return;36 }37 32 38 33 if (payload_len >= INT32_MAX - sizeof( *rb )) -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
r69390 r78190 5 5 */ 6 6 7 #include "cr_environment.h"8 7 #include "cr_string.h" 9 8 #include "cr_error.h" 10 9 #include "cr_mem.h" 11 10 #include "cr_spu.h" 12 #include "cr_environment.h"13 11 #include "renderspu.h" 14 12 #include "cr_extstring.h" … … 16 14 #include <iprt/asm.h> 17 15 16 #include <stdio.h> /*sprintf*/ 17 18 18 uint32_t renderspuContextRelease(ContextInfo *context); 19 19 uint32_t renderspuContextRetain(ContextInfo *context); … … 26 26 out.header.type = CR_MESSAGE_OOB; 27 27 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); 48 32 } 49 33 … … 1361 1345 DrawCursor( render_spu.cursorX, render_spu.cursorY ); 1362 1346 1363 if (render_spu.swap_master_url)1364 DoSync();1365 1366 1347 renderspu_SystemSwapBuffers( w, flags ); 1367 1348 } … … 1570 1551 switch (render_spu.server->clients[client_num]->conn->type) 1571 1552 { 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 1584 1553 default: 1585 1554 crError("Render SPU: Unknown Network Type to Open Gather Connection"); … … 1600 1569 if (render_spu.gather_conns[client_num]) 1601 1570 { 1602 crDebug("Render SPU: success! from %s", render_spu.gather_conns[client_num]->hostname);1571 crDebug("Render SPU: success!"); 1603 1572 } 1604 1573 } … … 1629 1598 * in SwapBuffers above] is not necessary -- karl 1630 1599 */ 1631 1632 if (render_spu.swap_master_url)1633 DoSync();1634 1635 1600 for (client_num=0; client_num< render_spu.server->numClients; client_num++) 1636 1601 crNetSend(render_spu.gather_conns[client_num], NULL, &pingback, -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r70851 r78190 14 14 #define snprintf _snprintf 15 15 #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" 21 17 #define RENDER_APIENTRY 22 18 #else … … 47 43 #define MAX_VISUALS 32 48 44 49 #ifdef RT_OS_DARWIN50 # ifndef VBOX_WITH_COCOA_QT51 enum52 {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 # endif67 #endif /* RT_OS_DARWIN */68 69 45 /** 70 46 * Visual info … … 76 52 // HDC device_context; 77 53 #elif defined(DARWIN) 78 # ifndef VBOX_WITH_COCOA_QT79 WindowRef window;80 # endif81 54 #elif defined(GLX) 82 55 Display *dpy; … … 121 94 HRGN hRgn; 122 95 #elif defined(DARWIN) 123 # ifndef VBOX_WITH_COCOA_QT124 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 # else133 96 NativeNSViewRef window; 134 97 NativeNSViewRef nativeWindow; /**< for render_to_app_window */ 135 98 NativeNSOpenGLContextRef *currentCtx; 136 # endif137 99 #elif defined(GLX) 138 100 Window window; … … 163 125 HGLRC hRC; 164 126 #elif defined(DARWIN) 165 # ifndef VBOX_WITH_COCOA_QT166 AGLContext context;167 # else168 127 NativeNSOpenGLContextRef context; 169 # endif170 128 #elif defined(GLX) 171 129 GLXContext context; … … 288 246 CRHashTable *barrierHash; 289 247 290 int is_swap_master, num_swap_clients; 291 int swap_mtu; 292 char *swap_master_url; 248 int num_swap_clients; 293 249 CRConnection **swap_conns; 294 250 … … 329 285 330 286 #ifdef RT_OS_DARWIN 331 # ifdef VBOX_WITH_COCOA_QT332 287 PFNDELETE_OBJECT pfnDeleteObject; 333 288 PFNGET_ATTACHED_OBJECTS pfnGetAttachedObjects; … … 338 293 339 294 CR_GLSL_CACHE GlobalShaders; 340 # else341 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 # endif350 295 #endif /* RT_OS_DARWIN */ 351 296 /* If TRUE, render should tell window server to prevent artificial content -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_config.c
r70852 r78190 10 10 #include "cr_mem.h" 11 11 #include "cr_error.h" 12 #include "cr_environment.h"13 #include "cr_url.h"14 12 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> 320 14 321 15 322 16 void renderspuSetVBoxConfiguration( RenderSPU *render_spu ) 323 17 { 18 const char *display = NULL; 324 19 int a; 325 20 … … 332 27 render_spu->use_lut8 = 0; 333 28 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; 341 40 #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; 344 43 #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; 363 57 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 */ 365 63 366 64 /* Some initialization that doesn't really have anything to do … … 376 74 /* Config of "render force present main thread" (currently implemented by glx and wgl). */ 377 75 { 378 const char *forcePresent = crGetenv("CR_RENDER_FORCE_PRESENT_MAIN_THREAD");76 const char *forcePresent = RTEnvGet("CR_RENDER_FORCE_PRESENT_MAIN_THREAD"); 379 77 if (forcePresent) 380 78 render_spu->force_present_main_thread = crStrToInt(forcePresent) ? 1 : 0; -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
r70851 r78190 4 4 * See the file LICENSE.txt for information on redistributing this software. 5 5 */ 6 #if 00 /*TEMPORARY*/7 #include <unistd.h>8 #include "cr_rand.h"9 #endif10 11 6 #include <GL/glx.h> 12 7 #include <X11/Xlib.h> … … 18 13 #include <stdio.h> 19 14 20 #include "cr_environment.h"21 15 #include "cr_error.h" 22 16 #include "cr_string.h" … … 24 18 #include "cr_process.h" 25 19 #include "renderspu.h" 26 27 20 28 21 /* … … 948 941 flags = CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect; 949 942 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); 966 944 if (render_spu_parent_window_id>0) 967 945 { … … 1989 1967 CRASSERT(w); 1990 1968 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 #endif2003 2004 1969 /* render_to_app_window: 2005 1970 * w->nativeWindow will only be non-zero if the -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
r69390 r78190 9 9 #include "cr_error.h" 10 10 #include "cr_string.h" 11 #include "cr_url.h"12 #include "cr_environment.h"13 11 #include "renderspu.h" 14 12 #include <stdio.h> 13 14 #include <iprt/env.h> 15 15 16 16 #ifdef RT_OS_DARWIN … … 32 32 CRtsd _RenderTSD; 33 33 #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 else59 {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 }68 34 69 35 #ifdef RT_OS_WINDOWS … … 195 161 renderspuSetVBoxConfiguration(&render_spu); 196 162 197 if (render_spu.swap_master_url)198 swapsyncConnect();199 200 201 163 /* Get our special functions. */ 202 164 numSpecial = renderspuCreateFunctions( _cr_render_table ); … … 234 196 render_spu.dummyWindowTable = crAllocHashtable(); 235 197 236 pcpwSetting = crGetenv("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT");198 pcpwSetting = RTEnvGet("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT"); 237 199 if (pcpwSetting) 238 200 { … … 271 233 } 272 234 #endif 273 274 #ifdef DARWIN275 # ifdef VBOX_WITH_COCOA_QT276 # 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 & this281 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 */304 235 305 236 rc = renderspuDefaultCtxInit(); … … 536 467 renderspuCleanupBase(true); 537 468 538 #ifdef RT_OS_DARWIN539 # ifndef VBOX_WITH_COCOA_QT540 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 556 469 #ifdef RT_OS_WINDOWS 557 470 if (render_spu.dwWinThreadId) … … 600 513 601 514 602 extern SPUOptions renderSPUOptions[];603 604 515 int SPULoad( char **name, char **super, SPUInitFuncPtr *init, 605 516 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, 606 SPUOptionsPtr *options,int *flags )517 int *flags ) 607 518 { 608 519 *name = "render"; … … 611 522 *self = renderSPUSelfDispatch; 612 523 *cleanup = renderSPUCleanup; 613 *options = renderSPUOptions;614 524 *flags = (SPU_NO_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ZERO); 615 525 -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c
r70871 r78190 13 13 #include <memory.h> 14 14 15 #include "cr_environment.h"16 15 #include "cr_error.h" 17 16 #include "cr_string.h" … … 19 18 #include "cr_mem.h" 20 19 20 #include <iprt/env.h> 21 21 22 22 /* IAT patcher stuff */ … … 664 664 */ 665 665 #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) 667 667 { 668 668 pixelformat = render_spu.ws.wglChoosePixelFormat( hdc, ppfd ); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.def
r69390 r78190 5 5 EXPORTS 6 6 crUnpack 7 crUnpackPush8 crUnpackPop9 7 crUnpackSetReturnPointer 10 8 crUnpackSetWritebackPointer -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
r78116 r78190 27 27 DECLEXPORT(const unsigned char *) cr_unpackData = NULL; 28 28 DECLEXPORT(const unsigned char *) cr_unpackDataEnd = NULL; 29 SPUDispatchTable cr_unpackDispatch; 30 31 static void crUnpackExtend(void); 32 static void crUnpackExtendDbg(void); 29 30 static void crUnpackExtend(PCrUnpackerState pState); 31 static void crUnpackExtendDbg(PCrUnpackerState pState); 33 32 34 33 #if 0 //def DEBUG_misha … … 72 71 argument out of the buffer's operand area.""" 73 72 if arg_type == "GLdouble" or arg_type == "GLclampd": 74 retval = "READ_DOUBLE( %d)" % offset75 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) 77 76 return retval 78 77 … … 83 82 arg_len = apiutil.PacketLength( params ) 84 83 if (return_type != 'void'): 85 print('\tSET_RETURN_PTR( %d);' % (arg_len + 8)) # extended opcode plus packet length84 print('\tSET_RETURN_PTR(pState, %d);' % (arg_len + 8)) # extended opcode plus packet length 86 85 else: 87 86 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 90 def getWritebackPointerOffset(return_type, params): 91 """Returns the offset of the writeback pointer""" 93 92 arg_len = apiutil.PacketLength( params ) 94 93 if return_type != 'void': … … 96 95 arg_len += apiutil.PacketLength( paramList ) 97 96 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 99 def FindWritebackPointer( return_type, params ): 100 """Emit a SET_WRITEBACK_PTR call.""" 101 print('\tSET_WRITEBACK_PTR(pState, %d);' % getWritebackPointerOffset(return_type, params)) 99 102 100 103 … … 122 125 else: 123 126 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))) 125 128 126 129 … … 134 137 if arg_type == "GLdouble" or arg_type == "GLclampd": 135 138 print("#ifdef CR_UNALIGNED_ACCESS_OKAY") 136 print("\t cr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType))139 print("\tpState->pDispatchTbl->%s((%s) pState->pbUnpackData);" % (vec_func, vecType)) 137 140 print("#else") 138 141 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) + ");") 140 143 if return_type != "void": 141 print("\t(void) cr_unpackDispatch.%s(" % func_name, end="")144 print("\t(void) pState->pDispatchTbl->%s(" % func_name, end="") 142 145 else: 143 print("\t cr_unpackDispatch.%s(" % func_name, end="")146 print("\tpState->pDispatchTbl->%s(" % func_name, end="") 144 147 for index in range(0, vecSize): 145 148 print("v" + repr(index), end="") … … 149 152 print("#endif") 150 153 else: 151 print("\t cr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType))154 print("\tpState->pDispatchTbl->%s((%s) pState->pbUnpackData);" % (vec_func, vecType)) 152 155 153 156 … … 166 169 params = apiutil.Parameters(func_name) 167 170 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) 170 174 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); 180 179 181 180 vector_func = apiutil.VectorFunction(func_name) … … 185 184 MakeNormalCall( return_type, func_name, params ) 186 185 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) 190 189 print("}\n") 191 190 … … 195 194 # 196 195 print(""" 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 227 196 CR_UNPACK_BUFFER_TYPE crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes) 228 197 { … … 249 218 } 250 219 251 void crUnpack( const void *data, const void *data_end, const void *opcodes, 252 unsigned int num_opcodes, SPUDispatchTable *table ) 220 void crUnpack(PCrUnpackerState pState) 253 221 { 254 222 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;265 223 266 224 #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++) 271 229 { 272 230 273 CRDBGPTR_CHECKZ( writeback_ptr);274 CRDBGPTR_CHECKZ( return_ptr);231 CRDBGPTR_CHECKZ(pState->pWritebackPtr); 232 CRDBGPTR_CHECKZ(pState->pReturnPtr); 275 233 276 /*crDebug(\"Unpacking opcode \%d\", * unpack_opcodes);*/234 /*crDebug(\"Unpacking opcode \%d\", *pState->pbOpcodes);*/ 277 235 #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 ) 281 239 {""") 282 240 … … 295 253 crDebug("Unpack: %s"); 296 254 #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) 298 256 299 257 print(""" 300 258 case CR_EXTEND_OPCODE: 301 259 #ifdef CR_UNPACK_DEBUG_OPCODES 302 crUnpackExtendDbg( );260 crUnpackExtendDbg(pState); 303 261 #else 304 262 # ifdef CR_UNPACK_DEBUG_LAST_OPCODES 305 if (i==(num_opcodes-1)) crUnpackExtendDbg( );263 if (i==(num_opcodes-1)) crUnpackExtendDbg(pState); 306 264 else 307 265 # endif 308 crUnpackExtend( );266 crUnpackExtend(pState); 309 267 #endif 310 268 break; … … 313 271 case CR_CMDBLOCKFLUSH_OPCODE: 314 272 case CR_NOP_OPCODE: 315 INCR_DATA_PTR_NO_ARGS( 273 INCR_DATA_PTR_NO_ARGS(pState); 316 274 break; 317 275 default: 318 crError( "Unknown opcode: %d", * unpack_opcodes );276 crError( "Unknown opcode: %d", *pState->pbOpcodes ); 319 277 break; 320 278 } 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--; 326 283 } 327 284 }""") … … 336 293 return_type = apiutil.ReturnType(func_name) 337 294 params = apiutil.Parameters(func_name) 338 print('static void crUnpackExtend%s( void)' % func_name)295 print('static void crUnpackExtend%s(PCrUnpackerState pState)' % func_name) 339 296 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 ))); 350 301 MakeNormalCall( return_type, func_name, params, 8 ) 351 302 print('}\n') 352 303 353 print('static void crUnpackExtend( void)')304 print('static void crUnpackExtend(PCrUnpackerState pState)') 354 305 print('{') 306 print('\tCHECK_BUFFER_SIZE_STATIC_LAST(pState, 4, GLenum);'); 355 307 print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' )) 356 308 print('') … … 371 323 print('\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name )) 372 324 # print('\t\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name ))) 373 print('\t\t\tcrUnpackExtend%s( 325 print('\t\t\tcrUnpackExtend%s(pState);' % func_name) 374 326 print('\t\t\tbreak;') 375 327 … … 378 330 break; 379 331 } 380 INCR_VAR_PTR( );332 INCR_VAR_PTR(pState); 381 333 }""") 382 334 383 print('static void crUnpackExtendDbg( void)')335 print('static void crUnpackExtendDbg(PCrUnpackerState pState)') 384 336 print('{') 337 print('\tCHECK_BUFFER_SIZE_STATIC_LAST(pState, 4, GLenum);'); 385 338 print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' )) 386 339 print('') … … 402 355 if not apiutil.ExtendedOpcodeName(func_name) in nodebug_extopcodes: 403 356 print('\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name )) 404 print('\t\t\tcrUnpackExtend%s( 357 print('\t\t\tcrUnpackExtend%s(pState);' % func_name) 405 358 print('\t\t\tbreak;') 406 359 … … 409 362 break; 410 363 } 411 INCR_VAR_PTR( );364 INCR_VAR_PTR(pState); 412 365 }""") -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_arrays.cpp
r78189 r78190 20 20 */ 21 21 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 ); 22 void 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 33 void 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 44 void 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 54 void 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 64 void 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 73 void 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 84 void 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 94 void 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 105 void 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 118 void 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 130 void 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 140 void 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 ); 124 152 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 125 172 #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); 128 177 #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); 130 180 #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 184 void 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 ); 142 198 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 } 143 217 #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); 146 222 #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); 148 225 #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 230 void crUnpackMultiDrawArraysEXT(PCrUnpackerState pState) 231 { 232 RT_NOREF(pState); 154 233 crError( "Can't decode MultiDrawArraysEXT" ); 155 234 } 156 235 157 void crUnpackMultiDrawElementsEXT(void) 158 { 236 void crUnpackMultiDrawElementsEXT(PCrUnpackerState pState) 237 { 238 RT_NOREF(pState); 159 239 crError( "Can't decode MultiDrawElementsEXT" ); 160 240 } 161 241 162 static void crUnpackSetClientPointerByIndex( int index, GLint size,242 static void crUnpackSetClientPointerByIndex(PCrUnpackerState pState, int index, GLint size, 163 243 GLenum type, GLboolean normalized, 164 244 GLsizei stride, const GLvoid *pointer, CRClientState *c, int fRealPtr) … … 171 251 { 172 252 case 0: 173 cr_unpackDispatch.VertexPointer(size, type, stride, pointer, fRealPtr);253 pState->pDispatchTbl->VertexPointer(size, type, stride, pointer, fRealPtr); 174 254 break; 175 255 case 1: 176 cr_unpackDispatch.ColorPointer(size, type, stride, pointer, fRealPtr);256 pState->pDispatchTbl->ColorPointer(size, type, stride, pointer, fRealPtr); 177 257 break; 178 258 case 2: 179 cr_unpackDispatch.FogCoordPointerEXT(type, stride, pointer, fRealPtr);259 pState->pDispatchTbl->FogCoordPointerEXT(type, stride, pointer, fRealPtr); 180 260 break; 181 261 case 3: 182 cr_unpackDispatch.SecondaryColorPointerEXT(size, type, stride, pointer, fRealPtr);262 pState->pDispatchTbl->SecondaryColorPointerEXT(size, type, stride, pointer, fRealPtr); 183 263 break; 184 264 case 4: 185 cr_unpackDispatch.EdgeFlagPointer(stride, pointer, fRealPtr);265 pState->pDispatchTbl->EdgeFlagPointer(stride, pointer, fRealPtr); 186 266 break; 187 267 case 5: 188 cr_unpackDispatch.IndexPointer(type, stride, pointer, fRealPtr);268 pState->pDispatchTbl->IndexPointer(type, stride, pointer, fRealPtr); 189 269 break; 190 270 case 6: 191 cr_unpackDispatch.NormalPointer(type, stride, pointer, fRealPtr);271 pState->pDispatchTbl->NormalPointer(type, stride, pointer, fRealPtr); 192 272 break; 193 273 } … … 198 278 if ((index-7)!=curTexUnit) 199 279 { 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); 203 283 if ((index-7)!=curTexUnit) 204 284 { 205 cr_unpackDispatch.ClientActiveTextureARB(GL_TEXTURE0_ARB+curTexUnit);285 pState->pDispatchTbl->ClientActiveTextureARB(GL_TEXTURE0_ARB+curTexUnit); 206 286 } 207 287 } 208 288 else 209 289 { 210 cr_unpackDispatch.VertexAttribPointerARB(index-7-CR_MAX_TEXTURE_UNITS,290 pState->pDispatchTbl->VertexAttribPointerARB(index-7-CR_MAX_TEXTURE_UNITS, 211 291 size, type, normalized, stride, pointer, fRealPtr); 212 292 } 213 293 } 214 294 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); 295 void 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); 220 302 221 303 CRContext *g = crStateGetCurrent(); … … 223 305 CRClientPointer *cp; 224 306 int i, index, offset; 225 u nsigned char*data;226 307 uint8_t *data; 308 227 309 if (first < 0 || count <= 0 || first >= INT32_MAX - count) 228 310 { … … 243 325 for (i = 0; i < numenabled; ++i) 244 326 { 245 index = READ_DATA(offset, int); 327 CHECK_BUFFER_SIZE_STATIC_LAST(pState, offset, int); 328 index = READ_DATA(pState, offset, int); 246 329 offset += sizeof(int); 247 330 … … 258 341 } 259 342 260 data = crAlloc((first + count) * cp->bytesPerIndex);343 data = (uint8_t *)crAlloc((first + count) * cp->bytesPerIndex); 261 344 262 345 if (data) 263 346 { 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); 265 348 /*crDebug("crUnpackExtendLockArraysEXT: old cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i", 266 349 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); 268 351 /*crDebug("crUnpackExtendLockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i", 269 352 index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/ … … 284 367 } 285 368 286 cr_unpackDispatch.LockArraysEXT(first, count);287 } 288 289 void crUnpackExtendUnlockArraysEXT( void)369 pState->pDispatchTbl->LockArraysEXT(first, count); 370 } 371 372 void crUnpackExtendUnlockArraysEXT(PCrUnpackerState pState) 290 373 { 291 374 int i; … … 296 379 /*crDebug("crUnpackExtendUnlockArraysEXT");*/ 297 380 298 cr_unpackDispatch.UnlockArraysEXT();381 pState->pDispatchTbl->UnlockArraysEXT(); 299 382 300 383 for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i) … … 309 392 cp->prevPtr = NULL; 310 393 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); 312 396 /*crDebug("crUnpackExtendUnlockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i", 313 397 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 18 18 #define UNPACK_EXTEND_H 1 19 19 20 #include "cr_unpack.h" 21 20 22 #ifdef __cplusplus 21 23 extern "C" { … … 30 32 for func_name in apiutil.AllSpecials( "unpacker" ): 31 33 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) 33 35 else: 34 print('extern void crUnpack%s( void);' % func_name)36 print('extern void crUnpack%s(PCrUnpackerState pState);' % func_name) 35 37 36 38 print(""" -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py
r69390 r78190 22 22 print("""#ifndef CR_UNPACKFUNCTIONS_H 23 23 #define CR_UNPACKFUNCTIONS_H 24 25 #include "cr_unpack.h" 24 26 """) 25 27 26 28 for func_name in sorted(gl_mapping.keys()): 27 29 ( 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 )) 31 print('void crUnpackExtend(PCrUnpackerState pState);') 30 32 print('\n#endif /* CR_UNPACKFUNCTIONS_H */') -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_misc.cpp
r78189 r78190 7 7 #include "unpacker.h" 8 8 9 void crUnpackExtendChromiumParametervCR( void)9 void crUnpackExtendChromiumParametervCR(PCrUnpackerState pState) 10 10 { 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); 15 12 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 ); 17 17 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 } 18 44 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); 22 47 } 23 48 24 void crUnpackExtendDeleteQueriesARB( void)49 void crUnpackExtendDeleteQueriesARB(PCrUnpackerState pState) 25 50 { 26 GLsizei n = READ_DATA( 8, GLsizei ); 27 const GLuint *ids = DATA_POINTER(12, GLuint); 51 CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei); 28 52 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))) 30 57 { 31 58 crError("crUnpackExtendDeleteQueriesARB: parameter 'n' is out of range"); … … 33 60 } 34 61 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); 36 65 } 37 66 38 void crUnpackExtendGetPolygonStipple( void)67 void crUnpackExtendGetPolygonStipple(PCrUnpackerState pState) 39 68 { 40 GLubyte *mask;69 CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, CRNetworkPointer); 41 70 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); 45 74 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 ); 47 81 } 48 82 49 void crUnpackExtendGetPixelMapfv( void)83 void crUnpackExtendGetPixelMapfv(PCrUnpackerState pState) 50 84 { 51 GLenum map = READ_DATA( 8, GLenum ); 52 GLfloat *values; 85 CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer); 53 86 54 SET_RETURN_PTR( 12 ); 55 SET_WRITEBACK_PTR( 20 ); 56 values = DATA_POINTER(12, GLfloat); 87 GLenum map = READ_DATA(pState, 8, GLenum ); 57 88 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 ); 59 95 } 60 96 61 void crUnpackExtendGetPixelMapuiv( void)97 void crUnpackExtendGetPixelMapuiv(PCrUnpackerState pState) 62 98 { 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 ); 64 102 GLuint *values; 65 103 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); 69 107 70 cr_unpackDispatch.GetPixelMapuiv( map, values ); 108 /* see crUnpackExtendGetPolygonStipple() for verification notes. */ 109 pState->pDispatchTbl->GetPixelMapuiv( map, values ); 71 110 } 72 111 73 void crUnpackExtendGetPixelMapusv( void)112 void crUnpackExtendGetPixelMapusv(PCrUnpackerState pState) 74 113 { 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 ); 76 117 GLushort *values; 77 118 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); 81 122 82 cr_unpackDispatch.GetPixelMapusv( map, values ); 123 /* see crUnpackExtendGetPolygonStipple() for verification notes. */ 124 pState->pDispatchTbl->GetPixelMapusv( map, values ); 83 125 } 84 126 85 void crUnpackExtendVBoxTexPresent( void)127 void crUnpackExtendVBoxTexPresent(PCrUnpackerState pState) 86 128 { 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); 93 130 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))) 95 139 { 96 140 crError("crUnpackExtendVBoxTexPresent: parameter 'cRects' is out of range"); … … 98 142 } 99 143 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 ); 101 146 } -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.cpp
r78189 r78190 23 23 #include "cr_version.h" 24 24 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 { 25 void 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 37 void crUnpackExtendShaderSource(PCrUnpackerState pState) 38 { 39 CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei); 40 36 41 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); 41 46 char **ppStrings = NULL; 42 47 GLsizei i, j, jUpTo; … … 48 53 return; 49 54 } 50 55 CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pLocalLength, count, GLint); 56 57 /** @todo More verification required here. */ 51 58 pos = 20 + count * sizeof(*pLocalLength); 52 59 53 if (!DATA_POINTER_CHECK(p os))60 if (!DATA_POINTER_CHECK(pState, pos)) 54 61 { 55 62 crError("crUnpackExtendShaderSource: pos %d is out of range", pos); … … 59 66 if (hasNonLocalLen > 0) 60 67 { 61 length = DATA_POINTER(p os, GLint);68 length = DATA_POINTER(pState, pos, GLint); 62 69 pos += count * sizeof(*length); 63 70 } 64 71 65 if (!DATA_POINTER_CHECK(pos)) 72 pos_check = pos; 73 74 if (!DATA_POINTER_CHECK(pState, pos_check)) 66 75 { 67 76 crError("crUnpackExtendShaderSource: pos %d is out of range", pos); … … 73 82 for (i = 0; i < count; ++i) 74 83 { 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)) 76 85 { 77 86 crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check); … … 81 90 pos_check += pLocalLength[i]; 82 91 83 if (!DATA_POINTER_CHECK(p os_check))92 if (!DATA_POINTER_CHECK(pState, pos_check)) 84 93 { 85 94 crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check); … … 88 97 } 89 98 90 ppStrings = crAlloc(count * sizeof(char*));99 ppStrings = (char **)crAlloc(count * sizeof(char*)); 91 100 if (!ppStrings) return; 92 101 93 102 for (i = 0; i < count; ++i) 94 103 { 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); 96 106 pos += pLocalLength[i]; 97 107 if (!length) … … 114 124 } 115 125 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); 118 128 119 129 crFree(ppStrings); 120 130 } 121 131 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"); 132 void 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 144 void 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 156 void 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 168 void 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 180 void 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 192 void 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 204 void 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 216 void 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 228 void 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 241 void 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 254 void 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 267 void 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 280 void 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 293 void 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 306 void 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 319 void 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 332 void 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 345 void 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 356 void 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 368 void 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 380 void 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 391 void 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 402 void 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 413 void 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 424 void 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 435 void 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 446 void 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"); 357 458 return; 358 459 } 359 460 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 467 void 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"); 374 479 return; 375 480 } 376 481 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 488 void 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 499 void 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.