Changeset 22284 in vbox for trunk/src/VBox/GuestHost/OpenGL/packer/pack_client.c
- Timestamp:
- Aug 17, 2009 8:44:47 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.