pack_client.c revision 145ea91d89919d9fd788de37de35ca0907629cc2
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync/* Copyright (c) 2001, Stanford University
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * All rights reserved
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * See the file LICENSE.txt for information on redistributing this software.
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync/*Convert from GLint to GLfloat in [-1.f,1.f]*/
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync#define CRP_I2F_NORM(i) ((2.f*((GLint)(i))+1.f) * (1.f/4294967294.f))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync/*Convert from GLshort to GLfloat in [-1.f,1.f]*/
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync#define CRP_S2F_NORM(s) ((2.f*((GLshort)(s))+1.f) * (1.f/65535.f))
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync/*Convert from GLbyte to GLfloat in [-1.f,1.f]*/
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync#define CRP_B2F_NORM(b) ((2.f*((GLbyte)(b))+1.f) * (1.f/255.f))
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync/*Convert from GLuint to GLfloat in [0.f,1.f]*/
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync#define CRP_UI2F_NORM(i) ((GLfloat)(i) * (1.f/4294967295.f))
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync/*Convert from GLushort to GLfloat in [0.f,1.f]*/
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync#define CRP_US2F_NORM(s) ((GLfloat)(s) * (1.f/65535.f))
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync/*Convert from GLubyte to GLfloat in [0.f,1.f]*/
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync#define CRP_UB2F_NORM(b) ((GLfloat)(b) * (1.f/255.f))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsyncstatic void crPackVertexAttrib(const CRVertexArrays *array, unsigned int attr, GLint index)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync unsigned char *p = array->a[attr].p + index * array->a[attr].stride;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->a[attr].buffer && array->a[attr].buffer->data)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->a[attr].buffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackVertexAttrib1fARB(attr, CRP_S2F_NORM(sPtr[0]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackVertexAttrib2fARB(attr, CRP_S2F_NORM(sPtr[0]), CRP_S2F_NORM(sPtr[1]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackVertexAttrib3fARB(attr, CRP_S2F_NORM(sPtr[0]), CRP_S2F_NORM(sPtr[1]), CRP_S2F_NORM(sPtr[2]));
145ea91d89919d9fd788de37de35ca0907629cc2vboxsync crPackVertexAttrib1fARB(attr, CRP_US2F_NORM(usPtr[0]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib2fARB(attr, CRP_US2F_NORM(usPtr[0]), CRP_US2F_NORM(usPtr[1]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib3fARB(attr, CRP_US2F_NORM(usPtr[0]), CRP_US2F_NORM(usPtr[1]), CRP_US2F_NORM(usPtr[2]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackVertexAttrib1fARB(attr, CRP_I2F_NORM(iPtr[0]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackVertexAttrib2fARB(attr, CRP_I2F_NORM(iPtr[0]), CRP_I2F_NORM(iPtr[1]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackVertexAttrib3fARB(attr, CRP_I2F_NORM(iPtr[0]), CRP_I2F_NORM(iPtr[1]), CRP_I2F_NORM(iPtr[2]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib1fARB(attr, CRP_UI2F_NORM(uiPtr[0]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib2fARB(attr, CRP_UI2F_NORM(uiPtr[0]), CRP_UI2F_NORM(uiPtr[1]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib3fARB(attr, CRP_UI2F_NORM(uiPtr[0]), CRP_UI2F_NORM(uiPtr[1]), CRP_UI2F_NORM(uiPtr[2]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 1: crPackVertexAttrib1fvARB(attr, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 2: crPackVertexAttrib2fvARB(attr, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 3: crPackVertexAttrib3fvARB(attr, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 4: crPackVertexAttrib4fvARB(attr, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 1: crPackVertexAttrib1dvARB(attr, (GLdouble *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 2: crPackVertexAttrib2dvARB(attr, (GLdouble *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 3: crPackVertexAttrib3dvARB(attr, (GLdouble *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 4: crPackVertexAttrib4dvARB(attr, (GLdouble *)p); break;
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib1fARB(attr, CRP_B2F_NORM(bPtr[0]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib2fARB(attr, CRP_B2F_NORM(bPtr[0]), CRP_B2F_NORM(bPtr[1]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib3fARB(attr, CRP_B2F_NORM(bPtr[0]), CRP_B2F_NORM(bPtr[1]), CRP_B2F_NORM(bPtr[2]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib1fARB(attr, CRP_UB2F_NORM(ubPtr[0]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib2fARB(attr, CRP_UB2F_NORM(ubPtr[0]), CRP_UB2F_NORM(ubPtr[1]));
fc46b5c3d89b3be1b5da0fda86c9ee094dd02b89vboxsync crPackVertexAttrib3fARB(attr, CRP_UB2F_NORM(ubPtr[0]), CRP_UB2F_NORM(ubPtr[1]), CRP_UB2F_NORM(ubPtr[2]));
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crWarning("Bad datatype for vertex attribute [%d] array: 0x%x\n",
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync * Expand glArrayElement into crPackVertex/Color/Normal/etc.
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsynccrPackExpandArrayElement(GLint index, CRClientState *c)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync unsigned char *p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync const GLboolean vpEnabled = crStateGetCurrent()->program.vpEnabled;
e44afe4f6981a920db4f9371e7199cae6a0f6e64vboxsync /*crDebug("crPackExpandArrayElement(%i)", index);*/
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->n.enabled && !(vpEnabled && array->a[VERT_ATTRIB_NORMAL].enabled))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->n.buffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case GL_SHORT: crPackNormal3sv((GLshort *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case GL_FLOAT: crPackNormal3fv((GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case GL_DOUBLE: crPackNormal3dv((GLdouble *)p); break;
977a7ff905883c1b7d4650a211a089684db421f6vboxsync crWarning("Unhandled: crPackExpandArrayElement, array->n.type 0x%x", array->n.type);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->c.enabled && !(vpEnabled && array->a[VERT_ATTRIB_COLOR0].enabled))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->c.buffer->data) + (unsigned long)p;
977a7ff905883c1b7d4650a211a089684db421f6vboxsync crWarning("Unhandled: crPackExpandArrayElement, array->c.type 0x%x", array->c.type);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->s.enabled && !(vpEnabled && array->a[VERT_ATTRIB_COLOR1].enabled))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->s.buffer->data) + (unsigned long)p;
977a7ff905883c1b7d4650a211a089684db421f6vboxsync crWarning("Unhandled: crPackExpandArrayElement, array->s.type 0x%x", array->s.type);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync#endif // CR_EXT_secondary_color
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->f.enabled && !(vpEnabled && array->a[VERT_ATTRIB_FOG].enabled))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->f.buffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync#endif // CR_EXT_fog_coord
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync for (unit = 0 ; unit < CR_MAX_TEXTURE_UNITS ; unit++)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->t[unit].enabled && !(vpEnabled && array->a[VERT_ATTRIB_TEX0+unit].enabled))
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = array->t[unit].p + index * array->t[unit].stride;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync if (array->t[unit].buffer && array->t[unit].buffer->data)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->t[unit].buffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 1: crPackMultiTexCoord1svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 2: crPackMultiTexCoord2svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 3: crPackMultiTexCoord3svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 4: crPackMultiTexCoord4svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 1: crPackMultiTexCoord1ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 2: crPackMultiTexCoord2ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 3: crPackMultiTexCoord3ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 4: crPackMultiTexCoord4ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 1: crPackMultiTexCoord1fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 2: crPackMultiTexCoord2fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 3: crPackMultiTexCoord3fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 4: crPackMultiTexCoord4fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 1: crPackMultiTexCoord1dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 2: crPackMultiTexCoord2dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 3: crPackMultiTexCoord3dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case 4: crPackMultiTexCoord4dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
977a7ff905883c1b7d4650a211a089684db421f6vboxsync crWarning("Unhandled: crPackExpandArrayElement, array->t[%i].type 0x%x", unit, array->t[unit].type);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->i.buffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync case GL_DOUBLE: crPackIndexdv((GLdouble *)p); break;
977a7ff905883c1b7d4650a211a089684db421f6vboxsync crWarning("Unhandled: crPackExpandArrayElement, array->i.type 0x%x", array->i.type);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->e.buffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(array->v.buffer->data) + (unsigned long)p;
977a7ff905883c1b7d4650a211a089684db421f6vboxsync crWarning("Unhandled: crPackExpandArrayElement, array->v.type 0x%x", array->v.type);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackExpandDrawArrays(GLenum mode, GLint first, GLsizei count, CRClientState *c)
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync __PackError(__LINE__, __FILE__, GL_INVALID_VALUE, "crPackDrawArrays(negative count)");
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync __PackError(__LINE__, __FILE__, GL_INVALID_ENUM, "crPackDrawArrays(bad mode)");
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync for (i=0; i<count; i++)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync return sizeof(GLubyte);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync return sizeof(GLushort);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync return sizeof(GLuint);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crError("Unknown type 0x%x in crPackElementsIndexSize", type);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
4aef33e90cfa798b2e6db5b45f02c2a6c8bbc4aevboxsync int packet_length = sizeof(int) + sizeof(mode) + sizeof(count) + sizeof(type) + sizeof(GLuint);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync CRBufferObject *elementsBuffer = crStateGetCurrent()->bufferobject.elementsBuffer;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync /*@todo not sure it's possible, and not sure what to do*/
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crWarning("crPackDrawElements: trying to use bound but empty elements buffer, ignoring.");
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync start_ptr = data_ptr = (unsigned char *) crPackAlloc(packet_length);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync WRITE_DATA_AI(GLenum, CR_DRAWELEMENTS_EXTEND_OPCODE );
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsynccrPackDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync int packet_length = sizeof(int) + sizeof(mode) + sizeof(start)
4aef33e90cfa798b2e6db5b45f02c2a6c8bbc4aevboxsync + sizeof(end) + sizeof(count) + sizeof(type) + sizeof(GLuint);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync CRBufferObject *elementsBuffer = crStateGetCurrent()->bufferobject.elementsBuffer;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync /*@todo not sure it's possible, and not sure what to do*/
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crWarning("crPackDrawElements: trying to use bound but empty elements buffer, ignoring.");
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync start_ptr = data_ptr = (unsigned char *) crPackAlloc(packet_length);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync WRITE_DATA_AI(GLenum, CR_DRAWRANGEELEMENTS_EXTEND_OPCODE);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Expand glDrawElements into crPackBegin/Vertex/End, etc commands.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Note: if mode==999, don't call glBegin/glEnd.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackExpandDrawElements(GLenum mode, GLsizei count, GLenum type,
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync CRBufferObject *elementsBuffer = crStateGetCurrent()->bufferobject.elementsBuffer;
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync "crPackDrawElements(negative count)");
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync "crPackDrawElements(bad mode)");
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync "crPackDrawElements(bad type)");
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p = (unsigned char *)(elementsBuffer->data) + (unsigned long)p;
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync //crDebug("crPackExpandDrawElements mode:0x%x, count:%d, type:0x%x", mode, count, type);
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync for (i=0; i<count; i++)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync for (i=0; i<count; i++)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackExpandArrayElement((GLint) * (GLushort *) p, c);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p+=sizeof (GLushort);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync for (i=0; i<count; i++)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackExpandArrayElement((GLint) * (GLuint *) p, c);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync p+=sizeof (GLuint);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crError( "this can't happen: array_spu.self.DrawElements" );
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Convert a glDrawElements command into a sequence of ArrayElement() calls.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * NOTE: Caller must issue the glBegin/glEnd.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackUnrollDrawElements(GLsizei count, GLenum type,
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync for (i = 0; i < count; i++)
145ea91d89919d9fd788de37de35ca0907629cc2vboxsync for (i = 0; i < count; i++)
145ea91d89919d9fd788de37de35ca0907629cc2vboxsync for (i = 0; i < count; i++)
54cdd2a4e7676bc8694fa8db62ece5a1447b3597vboxsync "crPackUnrollDrawElements(bad type)");
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * glDrawRangeElements, expanded into crPackBegin/Vertex/End/etc.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackExpandDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, CRClientState *c)
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crWarning("crPackExpandDrawRangeElements start>end (%d>%d)", start, end);
236b6e0fdf652661ff4c655314fe488998c5c17dvboxsync crPackExpandDrawElements(mode, count, type, indices, c);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Pack real DrawArrays commands.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackMultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < primcount; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (count[i] > 0) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackExpandMultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < primcount; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (count[i] > 0) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crPackExpandDrawArrays(mode, first[i], count[i], c);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync * Pack real DrawElements commands.
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackMultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < primcount; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (count[i] > 0) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crPackDrawElements(mode, count[i], type, indices[i]);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsynccrPackExpandMultiDrawElementsEXT( GLenum mode, const GLsizei *count,
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync for (i = 0; i < primcount; i++) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync if (count[i] > 0) {
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync crPackExpandDrawElements(mode, count[i], type, indices[i], c);
e0e0c19eefceaf5d4ec40f9466b58a771f50e799vboxsync#endif /* CR_EXT_multi_draw_arrays */
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsyncstatic int crPack_GetNumEnabledArrays(CRClientState *c, int *size)
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync for (i = 0 ; i < CR_MAX_TEXTURE_UNITS ; i++)
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++)
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsyncstatic void crPackLockClientPointer(GLint first, GLint count, unsigned char **ppData, int index, CRClientState *c)
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync cp = crStateGetClientPointerByIndex(index, &c->array);
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync crWarning("crPackLockClientPointer called when there's VBO enabled!");
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync for (i=0; i<count; ++i)
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsyncvoid PACK_APIENTRY crPackLockArraysEXT(GLint first, GLint count)
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync packet_length += sizeof(first) + sizeof(count); /*params*/
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync numenabled = crPack_GetNumEnabledArrays(c, &vertex_size);
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync packet_length += sizeof(int) + numenabled*sizeof(int); /*numenabled + indices*/
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync packet_length += vertex_size * count; /*vertices data*/
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync start_ptr = data_ptr = (unsigned char *) crPackAlloc(packet_length);
10183353efa12aa94e0f3dc78e0f1c47f7928e8dvboxsync WRITE_DATA_AI(GLenum, CR_LOCKARRAYSEXT_EXTEND_OPCODE );