Changeset 78190 in vbox for trunk/src/VBox/GuestHost/OpenGL/spu_loader
- Timestamp:
- Apr 18, 2019 12:07:07 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 130111
- Location:
- trunk
- Files:
-
- 5 edited
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/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/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 {
Note:
See TracChangeset
for help on using the changeset viewer.