-static GLfloat *get_space(GLcontext *ctx, GLuint bytes)
+static GLubyte *get_space(GLcontext *ctx, GLuint bytes)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLubyte *space = _mesa_malloc(bytes);
tnl->block[tnl->nr_blocks++] = space;
- return (GLfloat *)space;
+ return space;
}
GLuint start,
GLuint end,
const struct gl_client_array *input,
- const char *ptr )
+ const GLubyte *ptr )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
if (input->Type != GL_FLOAT) {
const GLuint sz = input->Size;
- char *buf = get_space(ctx, count * sz * sizeof(GLfloat));
+ GLubyte *buf = get_space(ctx, count * sz * sizeof(GLfloat));
GLfloat *fptr = (GLfloat *)buf;
switch (input->Type) {
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
+ GLuint i;
+ void *ptr;
if (!ib)
return;
assert(ib->obj->Pointer);
}
- VB->Elts = (GLuint *)ADD_POINTERS(ib->obj->Pointer,
- ib->ptr);
-
- VB->Elts += ib->rebase;
+ ptr = ADD_POINTERS(ib->obj->Pointer, ib->ptr);
- switch (ib->type) {
- case GL_UNSIGNED_INT:
- return;
- case GL_UNSIGNED_SHORT:
- break;
- case GL_UNSIGNED_BYTE:
- break;
+ if (ib->type == GL_UNSIGNED_INT) {
+ VB->Elts = (GLuint *) ptr;
+ VB->Elts += ib->rebase;
+ }
+ else {
+ GLuint *elts = (GLuint *)get_space(ctx, ib->count * sizeof(GLuint));
+ VB->Elts = elts;
+
+ switch (ib->type) {
+ case GL_UNSIGNED_SHORT: {
+ const GLushort *in = ((GLushort *)ptr) + ib->rebase;
+ for (i = 0; i < ib->count; i++)
+ *elts++ = *in++;
+ break;
+ }
+ case GL_UNSIGNED_BYTE: {
+ const GLubyte *in = ((GLubyte *)ptr) + ib->rebase;
+ for (i = 0; i < ib->count; i++)
+ *elts++ = *in++;
+ break;
+ }
+ }
}
}