Changeset 22284 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Aug 17, 2009 8:44:47 AM (15 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt
r22155 r22284 10204 10204 chromium extpack 10205 10205 10206 # GL_EXT_compiled_vertex_array 10207 10208 name LockArraysEXT 10209 return void 10210 param first GLint 10211 param count GLint 10212 category GL_EXT_compiled_vertex_array 10213 chromium extpack 10214 10215 name UnlockArraysEXT 10216 return void 10217 category GL_EXT_compiled_vertex_array 10218 chromium extpack 10219 10206 10220 # end of file sentinel 10207 10221 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_extstring.h
r22155 r22284 19 19 */ 20 20 static const char *crExtensions = 21 #ifdef CR_EXT_texture_compression_s3tc 22 "GL_EXT_texture_compression_s3tc " 23 #endif 24 #ifdef CR_EXT_draw_range_elements 25 "GL_EXT_draw_range_elements " 26 #endif 27 #ifdef CR_EXT_framebuffer_object 28 "GL_EXT_framebuffer_object " 29 #endif 30 #ifdef CR_EXT_compiled_vertex_array 31 "GL_EXT_compiled_vertex_array " 32 #endif 21 33 #ifdef CR_ARB_depth_texture 22 34 "GL_ARB_depth_texture " … … 194 206 #endif 195 207 #ifdef CR_ARB_fragment_shader 196 "GL_ARB_fragment_shader " 197 #endif 198 #ifdef CR_EXT_texture_compression_s3tc 199 "GL_EXT_texture_compression_s3tc " 200 #endif 201 #ifdef CR_EXT_draw_range_elements 202 "GL_EXT_draw_range_elements " 203 #endif 204 #ifdef CR_EXT_framebuffer_object 205 "GL_EXT_framebuffer_object" 208 "GL_ARB_fragment_shader" 206 209 #endif 207 210 ""; 208 209 211 210 212 /* -
trunk/src/VBox/GuestHost/OpenGL/include/cr_protocol.h
r22155 r22284 16 16 /*For now guest is allowed to connect host opengl service if protocol version matches exactly*/ 17 17 /*Note: that after any change to this file, or glapi_parser\apispec.txt version should be changed*/ 18 #define CR_PROTOCOL_VERSION_MAJOR 218 #define CR_PROTOCOL_VERSION_MAJOR 3 19 19 #define CR_PROTOCOL_VERSION_MINOR 1 20 20 -
trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h
r22155 r22284 120 120 121 121 #define CR_EXT_framebuffer_object 1 122 #define CR_EXT_compiled_vertex_array 1 122 123 123 124 #endif /* CR_VERSION_H */ -
trunk/src/VBox/GuestHost/OpenGL/include/state/cr_client.h
r15532 r22284 66 66 CRBufferObject *buffer; 67 67 #endif 68 #ifdef CR_EXT_compiled_vertex_array 69 GLboolean locked; 70 unsigned char *prevPtr; 71 GLint prevStride; 72 #endif 68 73 } CRClientPointer; 69 74 … … 86 91 GLuint arrayRangeLength; 87 92 #endif 93 #ifdef CR_EXT_compiled_vertex_array 94 GLint lockFirst; 95 GLint lockCount; 96 GLboolean locked; 97 # ifdef IN_GUEST 98 GLboolean synced; 99 # endif 100 #endif 88 101 } CRVertexArrays; 102 103 #define CRSTATECLIENT_MAX_VERTEXARRAYS (7+CR_MAX_TEXTURE_UNITS+CR_MAX_VERTEX_ATTRIBS) 89 104 90 105 typedef struct { … … 117 132 DECLEXPORT(GLboolean) crStateUseServerArrays(void); 118 133 DECLEXPORT(GLboolean) crStateUseServerArrayElements(void); 134 DECLEXPORT(CRClientPointer*) crStateGetClientPointerByIndex(int index, CRVertexArrays *array); 119 135 120 136 #ifdef __cplusplus -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_client.c
r21911 r22284 304 304 const CRVertexArrays *array = &(c->array); 305 305 const GLboolean vpEnabled = crStateGetCurrent()->program.vpEnabled; 306 307 crDebug("crPackExpandArrayElement(%i)", index); 306 308 307 309 if (array->n.enabled && !(vpEnabled && array->a[VERT_ATTRIB_NORMAL].enabled)) … … 936 938 void 937 939 crPackExpandMultiDrawElementsEXT( GLenum mode, const GLsizei *count, 938 939 940 GLenum type, const GLvoid **indices, 941 GLsizei primcount, CRClientState *c ) 940 942 { 941 943 GLint i; … … 947 949 } 948 950 #endif /* CR_EXT_multi_draw_arrays */ 951 952 static int crPack_GetNumEnabledArrays(CRClientState *c, int *size) 953 { 954 int i, count=0; 955 956 *size = 0; 957 958 if (c->array.v.enabled) 959 { 960 count++; 961 *size += c->array.v.bytesPerIndex; 962 } 963 964 if (c->array.c.enabled) 965 { 966 count++; 967 *size += c->array.c.bytesPerIndex; 968 } 969 970 if (c->array.f.enabled) 971 { 972 count++; 973 *size += c->array.f.bytesPerIndex; 974 } 975 976 if (c->array.s.enabled) 977 { 978 count++; 979 *size += c->array.s.bytesPerIndex; 980 } 981 982 if (c->array.e.enabled) 983 { 984 count++; 985 *size += c->array.e.bytesPerIndex; 986 } 987 988 if (c->array.i.enabled) 989 { 990 count++; 991 *size += c->array.i.bytesPerIndex; 992 } 993 994 if (c->array.n.enabled) 995 { 996 count++; 997 *size += c->array.n.bytesPerIndex; 998 } 999 1000 for (i = 0 ; i < CR_MAX_TEXTURE_UNITS ; i++) 1001 { 1002 if (c->array.t[i].enabled) 1003 { 1004 count++; 1005 *size += c->array.t[i].bytesPerIndex; 1006 } 1007 } 1008 1009 for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) 1010 { 1011 if (c->array.a[i].enabled) 1012 { 1013 count++; 1014 *size += c->array.a[i].bytesPerIndex; 1015 } 1016 } 1017 1018 return count; 1019 } 1020 1021 static void crPackLockClientPointer(GLint first, GLint count, unsigned char **ppData, int index, CRClientState *c) 1022 { 1023 CRClientPointer *cp; 1024 unsigned char *data_ptr = *ppData, *cptr; 1025 GLint i; 1026 1027 cp = crStateGetClientPointerByIndex(index, &c->array); 1028 1029 if (cp->enabled) 1030 { 1031 if (cp->buffer && cp->buffer->name) 1032 { 1033 crWarning("crPackLockClientPointer called when there's VBO enabled!"); 1034 } 1035 1036 WRITE_DATA_AI(int, index); 1037 cptr = cp->p + first*cp->bytesPerIndex; 1038 if (cp->bytesPerIndex==cp->stride) 1039 { 1040 crMemcpy(data_ptr, cptr, count*cp->bytesPerIndex); 1041 data_ptr += count*cp->bytesPerIndex; 1042 } 1043 else 1044 { 1045 for (i=0; i<count; ++i) 1046 { 1047 crMemcpy(data_ptr, cptr, cp->bytesPerIndex); 1048 data_ptr += cp->bytesPerIndex; 1049 cptr += cp->stride; 1050 } 1051 } 1052 *ppData = data_ptr; 1053 } 1054 } 1055 1056 void PACK_APIENTRY crPackLockArraysEXT(GLint first, GLint count) 1057 { 1058 CRContext *g = crStateGetCurrent(); 1059 CRClientState *c = &g->client; 1060 unsigned char *data_ptr, *start_ptr; 1061 int packet_length = sizeof(int); /*extopcode*/ 1062 int vertex_size, i, numenabled; 1063 1064 packet_length += sizeof(first) + sizeof(count); /*params*/ 1065 numenabled = crPack_GetNumEnabledArrays(c, &vertex_size); 1066 packet_length += sizeof(int) + numenabled*sizeof(int); /*numenabled + indices*/ 1067 packet_length += vertex_size * count; /*vertices data*/ 1068 1069 start_ptr = data_ptr = (unsigned char *) crPackAlloc(packet_length); 1070 WRITE_DATA_AI(GLenum, CR_LOCKARRAYSEXT_EXTEND_OPCODE ); 1071 WRITE_DATA_AI(GLint, first); 1072 WRITE_DATA_AI(GLint, count); 1073 WRITE_DATA_AI(int, numenabled); 1074 for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i) 1075 { 1076 crPackLockClientPointer(first, count, &data_ptr, i, c); 1077 } 1078 crHugePacket(CR_EXTEND_OPCODE, start_ptr); 1079 crPackFree(start_ptr); 1080 } -
trunk/src/VBox/GuestHost/OpenGL/packer/packer_special
r22155 r22284 169 169 DeleteFramebuffersEXT 170 170 DeleteRenderbuffersEXT 171 LockArraysEXT -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_client.c
r21765 r22284 54 54 } 55 55 56 static void crStateUnlockClientPointer(CRClientPointer* cp) 57 { 58 if (cp->locked) 59 { 60 #ifndef IN_GUEST 61 if (cp->p) crFree(cp->p); 62 #endif 63 cp->locked = GL_FALSE; 64 } 65 } 66 56 67 void crStateClientDestroy(CRClientState *c) 57 68 { 69 #ifdef CR_EXT_compiled_vertex_array 70 if (c->array.locked) 71 { 72 unsigned int i; 73 74 crStateUnlockClientPointer(&c->array.v); 75 crStateUnlockClientPointer(&c->array.c); 76 crStateUnlockClientPointer(&c->array.f); 77 crStateUnlockClientPointer(&c->array.s); 78 crStateUnlockClientPointer(&c->array.e); 79 crStateUnlockClientPointer(&c->array.i); 80 crStateUnlockClientPointer(&c->array.n); 81 for (i = 0 ; i < CR_MAX_TEXTURE_UNITS ; i++) 82 { 83 crStateUnlockClientPointer(&c->array.t[i]); 84 } 85 for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) 86 { 87 crStateUnlockClientPointer(&c->array.a[i]); 88 } 89 } 90 #endif 58 91 } 59 92 … … 83 116 c->curClientTextureUnit = 0; 84 117 118 #ifdef CR_EXT_compiled_vertex_array 119 c->array.lockFirst = 0; 120 c->array.lockCount = 0; 121 c->array.locked = GL_FALSE; 122 # ifdef IN_GUEST 123 c->array.synced = GL_FALSE; 124 # endif 125 #endif 126 85 127 /* vertex array */ 86 128 c->array.v.p = NULL; … … 92 134 c->array.v.buffer = g->bufferobject.vertexBuffer; 93 135 #endif 136 #ifdef CR_EXT_compiled_vertex_array 137 c->array.v.locked = GL_FALSE; 138 c->array.v.prevPtr = NULL; 139 c->array.v.prevStride = 0; 140 #endif 94 141 95 142 /* color array */ … … 102 149 c->array.c.buffer = g->bufferobject.vertexBuffer; 103 150 #endif 151 #ifdef CR_EXT_compiled_vertex_array 152 c->array.c.locked = GL_FALSE; 153 c->array.c.prevPtr = NULL; 154 c->array.c.prevStride = 0; 155 #endif 104 156 105 157 /* fog array */ … … 112 164 c->array.f.buffer = g->bufferobject.vertexBuffer; 113 165 #endif 166 #ifdef CR_EXT_compiled_vertex_array 167 c->array.f.locked = GL_FALSE; 168 c->array.f.prevPtr = NULL; 169 c->array.f.prevStride = 0; 170 #endif 114 171 115 172 /* secondary color array */ … … 122 179 c->array.s.buffer = g->bufferobject.vertexBuffer; 123 180 #endif 181 #ifdef CR_EXT_compiled_vertex_array 182 c->array.s.locked = GL_FALSE; 183 c->array.s.prevPtr = NULL; 184 c->array.s.prevStride = 0; 185 #endif 124 186 125 187 /* edge flag array */ … … 132 194 c->array.e.buffer = g->bufferobject.vertexBuffer; 133 195 #endif 196 #ifdef CR_EXT_compiled_vertex_array 197 c->array.e.locked = GL_FALSE; 198 c->array.e.prevPtr = NULL; 199 c->array.e.prevStride = 0; 200 #endif 134 201 135 202 /* color index array */ … … 142 209 c->array.i.buffer = g->bufferobject.vertexBuffer; 143 210 #endif 211 #ifdef CR_EXT_compiled_vertex_array 212 c->array.i.locked = GL_FALSE; 213 c->array.i.prevPtr = NULL; 214 c->array.i.prevStride = 0; 215 #endif 144 216 145 217 /* normal array */ … … 152 224 c->array.n.buffer = g->bufferobject.vertexBuffer; 153 225 #endif 226 #ifdef CR_EXT_compiled_vertex_array 227 c->array.n.locked = GL_FALSE; 228 c->array.n.prevPtr = NULL; 229 c->array.n.prevStride = 0; 230 #endif 154 231 155 232 /* texcoord arrays */ … … 163 240 #ifdef CR_ARB_vertex_buffer_object2 164 241 c->array.t[i].buffer = g->bufferobject.vertexBuffer; 242 #endif 243 #ifdef CR_EXT_compiled_vertex_array 244 c->array.t[i].locked = GL_FALSE; 245 c->array.t[i].prevPtr = NULL; 246 c->array.t[i].prevStride = 0; 165 247 #endif 166 248 } … … 175 257 #ifdef CR_ARB_vertex_buffer_object2 176 258 c->array.a[i].buffer = g->bufferobject.vertexBuffer; 259 #endif 260 #ifdef CR_EXT_compiled_vertex_array 261 c->array.a[i].locked = GL_FALSE; 262 c->array.a[i].prevPtr = NULL; 263 c->array.a[i].prevStride = 0; 177 264 #endif 178 265 } … … 466 553 CRContext *g = GetCurrentContext(); 467 554 555 #ifdef CR_EXT_compiled_vertex_array 556 crStateUnlockClientPointer(cp); 557 cp->prevPtr = cp->p; 558 cp->prevStride = cp->stride; 559 #endif 560 468 561 cp->p = (unsigned char *) pointer; 469 562 cp->size = size; … … 855 948 void STATE_APIENTRY crStateGetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) 856 949 { 857 950 crStateGetVertexAttribPointervNV(index, pname, pointer); 858 951 } 859 952 … … 923 1016 cp->enabled = GL_TRUE; 924 1017 1018 #ifdef CR_EXT_compiled_vertex_array 1019 crStateUnlockClientPointer(cp); 1020 #endif 1021 925 1022 switch (format) 926 1023 { … … 999 1096 cp->enabled = GL_TRUE; 1000 1097 cp->stride = stride; 1098 #ifdef CR_EXT_compiled_vertex_array 1099 crStateUnlockClientPointer(cp); 1100 #endif 1101 1001 1102 switch (format) 1002 1103 { … … 1046 1147 cp->enabled = GL_TRUE; 1047 1148 cp->stride = stride; 1149 #ifdef CR_EXT_compiled_vertex_array 1150 crStateUnlockClientPointer(cp); 1151 #endif 1152 1048 1153 switch (format) 1049 1154 { … … 1116 1221 cp->enabled = GL_TRUE; 1117 1222 cp->stride = stride; 1223 #ifdef CR_EXT_compiled_vertex_array 1224 crStateUnlockClientPointer(cp); 1225 #endif 1226 1118 1227 switch (format) 1119 1228 { … … 1307 1416 } 1308 1417 1418 static void crStateLockClientPointer(CRClientPointer* cp) 1419 { 1420 crStateUnlockClientPointer(cp); 1421 if (cp->enabled) 1422 { 1423 cp->locked = GL_TRUE; 1424 } 1425 } 1426 1427 void STATE_APIENTRY crStateLockArraysEXT(GLint first, GLint count) 1428 { 1429 CRContext *g = GetCurrentContext(); 1430 CRClientState *c = &(g->client); 1431 unsigned int i; 1432 1433 c->array.locked = GL_TRUE; 1434 c->array.lockFirst = first; 1435 c->array.lockCount = count; 1436 #ifdef IN_GUEST 1437 c->array.synced = GL_FALSE; 1438 #endif 1439 1440 crStateLockClientPointer(&c->array.v); 1441 crStateLockClientPointer(&c->array.c); 1442 crStateLockClientPointer(&c->array.f); 1443 crStateLockClientPointer(&c->array.s); 1444 crStateLockClientPointer(&c->array.e); 1445 crStateLockClientPointer(&c->array.i); 1446 crStateLockClientPointer(&c->array.n); 1447 for (i = 0 ; i < CR_MAX_TEXTURE_UNITS ; i++) 1448 { 1449 crStateLockClientPointer(&c->array.t[i]); 1450 } 1451 for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) 1452 { 1453 crStateLockClientPointer(&c->array.a[i]); 1454 } 1455 } 1456 1457 void STATE_APIENTRY crStateUnlockArraysEXT() 1458 { 1459 CRContext *g = GetCurrentContext(); 1460 CRClientState *c = &(g->client); 1461 unsigned int i; 1462 1463 c->array.locked = GL_FALSE; 1464 #ifdef IN_GUEST 1465 c->array.synced = GL_FALSE; 1466 #endif 1467 1468 crStateUnlockClientPointer(&c->array.v); 1469 crStateUnlockClientPointer(&c->array.c); 1470 crStateUnlockClientPointer(&c->array.f); 1471 crStateUnlockClientPointer(&c->array.s); 1472 crStateUnlockClientPointer(&c->array.e); 1473 crStateUnlockClientPointer(&c->array.i); 1474 crStateUnlockClientPointer(&c->array.n); 1475 for (i = 0 ; i < CR_MAX_TEXTURE_UNITS ; i++) 1476 { 1477 crStateUnlockClientPointer(&c->array.t[i]); 1478 } 1479 for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) 1480 { 1481 crStateUnlockClientPointer(&c->array.a[i]); 1482 } 1483 } 1309 1484 1310 1485 void STATE_APIENTRY crStateVertexArrayRangeNV(GLsizei length, const GLvoid *pointer) … … 1322 1497 1323 1498 /*Returns if the given clientpointer could be used on server side directly*/ 1324 #define CRSTATE_IS_SERVER_CP(cp) (!(cp).enabled || !(cp).p || ((cp).buffer && (cp).buffer->name) )1499 #define CRSTATE_IS_SERVER_CP(cp) (!(cp).enabled || !(cp).p || ((cp).buffer && (cp).buffer->name) || ((cp).locked)) 1325 1500 1326 1501 static void crStateDumpClientPointer(CRClientPointer *cp, const char *name, int i) … … 1328 1503 if (i<0 && cp->enabled) 1329 1504 { 1330 crDebug("CP(%s): enabled:%d ptr:%p buffer:%p buffer.name:%i %s",1331 name, cp->enabled, cp->p, cp->buffer, cp->buffer? cp->buffer->name:-1, 1505 crDebug("CP(%s): enabled:%d ptr:%p buffer:%p buffer.name:%i locked: %i", 1506 name, cp->enabled, cp->p, cp->buffer, cp->buffer? cp->buffer->name:-1, (int)cp->locked, 1332 1507 CRSTATE_IS_SERVER_CP(*cp) ? "":"!FAIL!"); 1333 1508 } 1334 1509 else if (0==i || cp->enabled) 1335 1510 { 1336 crDebug("CP(%s%i): enabled:%d ptr:%p buffer:%p buffer.name:%i %s",1337 name, i, cp->enabled, cp->p, cp->buffer, cp->buffer? cp->buffer->name:-1, 1511 crDebug("CP(%s%i): enabled:%d ptr:%p buffer:%p buffer.name:%i locked: %i", 1512 name, i, cp->enabled, cp->p, cp->buffer, cp->buffer? cp->buffer->name:-1, (int)cp->locked, 1338 1513 CRSTATE_IS_SERVER_CP(*cp) ? "":"!FAIL!"); 1339 1514 } … … 1360 1535 && CRSTATE_IS_SERVER_CP(c->array.f); 1361 1536 1362 for (i = 0; (unsigned int)i < g->limits.maxTextureUnits; i++) 1363 if (!CRSTATE_IS_SERVER_CP(c->array.t[i])) 1364 { 1365 res = GL_FALSE; 1366 break; 1367 } 1368 1369 for (i = 0; (unsigned int)i < g->limits.maxVertexProgramAttribs; i++) 1370 if (!CRSTATE_IS_SERVER_CP(c->array.a[i])) 1371 { 1372 res = GL_FALSE; 1373 break; 1374 } 1375 1376 #ifdef DEBUG 1537 if (res) 1538 { 1539 for (i = 0; (unsigned int)i < g->limits.maxTextureUnits; i++) 1540 if (!CRSTATE_IS_SERVER_CP(c->array.t[i])) 1541 { 1542 res = GL_FALSE; 1543 break; 1544 } 1545 } 1546 1547 if (res) 1548 { 1549 for (i = 0; (unsigned int)i < g->limits.maxVertexProgramAttribs; i++) 1550 if (!CRSTATE_IS_SERVER_CP(c->array.a[i])) 1551 { 1552 res = GL_FALSE; 1553 break; 1554 } 1555 } 1556 1557 #if defined(DEBUG) && 0 1377 1558 if (!res) 1378 1559 { … … 1810 1991 } 1811 1992 } 1993 1994 CRClientPointer* crStateGetClientPointerByIndex(int index, CRVertexArrays *array) 1995 { 1996 CRASSERT(array && index>=0 && index<CRSTATECLIENT_MAX_VERTEXARRAYS); 1997 1998 if (index<7) 1999 { 2000 switch (index) 2001 { 2002 case 0: return &array->v; 2003 case 1: return &array->c; 2004 case 2: return &array->f; 2005 case 3: return &array->s; 2006 case 4: return &array->e; 2007 case 5: return &array->i; 2008 case 6: return &array->n; 2009 } 2010 } 2011 else if (index<(7+CR_MAX_TEXTURE_UNITS)) 2012 { 2013 return &array->t[index-7]; 2014 } 2015 else 2016 { 2017 return &array->a[index-7-CR_MAX_TEXTURE_UNITS]; 2018 } 2019 2020 /*silence the compiler warning*/ 2021 CRASSERT(false); 2022 return NULL; 2023 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_get.txt
r22155 r22284 304 304 GLint GL_FRAMEBUFFER_BINDING_EXT (g->framebufferobject.framebuffer?g->framebufferobject.framebuffer->id:0) 305 305 GLint GL_RENDERBUFFER_BINDING_EXT (g->framebufferobject.renderbuffer?g->framebufferobject.renderbuffer->id:0) 306 307 #CVA 308 GLint GL_ARRAY_ELEMENT_LOCK_FIRST_EXT g->client.array.lockFirst 309 GLint GL_ARRAY_ELEMENT_LOCK_COUNT_EXT g->client.array.lockCount -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_special
r22155 r22284 363 363 GetFramebufferAttachmentParameterivEXT 364 364 GenerateMipmapEXT 365 LockArraysEXT 366 UnlockArraysEXT
Note:
See TracChangeset
for help on using the changeset viewer.