Fix compiler warnings.
Add missing code for translating non-GLuint elements.
This commit is contained in:
@@ -41,13 +41,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static GLfloat *get_space(GLcontext *ctx, GLuint bytes)
|
static GLubyte *get_space(GLcontext *ctx, GLuint bytes)
|
||||||
{
|
{
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
GLubyte *space = _mesa_malloc(bytes);
|
GLubyte *space = _mesa_malloc(bytes);
|
||||||
|
|
||||||
tnl->block[tnl->nr_blocks++] = space;
|
tnl->block[tnl->nr_blocks++] = space;
|
||||||
return (GLfloat *)space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ static void _tnl_import_array( GLcontext *ctx,
|
|||||||
GLuint start,
|
GLuint start,
|
||||||
GLuint end,
|
GLuint end,
|
||||||
const struct gl_client_array *input,
|
const struct gl_client_array *input,
|
||||||
const char *ptr )
|
const GLubyte *ptr )
|
||||||
{
|
{
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
struct vertex_buffer *VB = &tnl->vb;
|
struct vertex_buffer *VB = &tnl->vb;
|
||||||
@@ -108,7 +108,7 @@ static void _tnl_import_array( GLcontext *ctx,
|
|||||||
|
|
||||||
if (input->Type != GL_FLOAT) {
|
if (input->Type != GL_FLOAT) {
|
||||||
const GLuint sz = input->Size;
|
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;
|
GLfloat *fptr = (GLfloat *)buf;
|
||||||
|
|
||||||
switch (input->Type) {
|
switch (input->Type) {
|
||||||
@@ -263,6 +263,8 @@ static void bind_indicies( GLcontext *ctx,
|
|||||||
{
|
{
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
struct vertex_buffer *VB = &tnl->vb;
|
struct vertex_buffer *VB = &tnl->vb;
|
||||||
|
GLuint i;
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
if (!ib)
|
if (!ib)
|
||||||
return;
|
return;
|
||||||
@@ -278,19 +280,31 @@ static void bind_indicies( GLcontext *ctx,
|
|||||||
assert(ib->obj->Pointer);
|
assert(ib->obj->Pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
VB->Elts = (GLuint *)ADD_POINTERS(ib->obj->Pointer,
|
ptr = ADD_POINTERS(ib->obj->Pointer, ib->ptr);
|
||||||
ib->ptr);
|
|
||||||
|
|
||||||
|
if (ib->type == GL_UNSIGNED_INT) {
|
||||||
|
VB->Elts = (GLuint *) ptr;
|
||||||
VB->Elts += ib->rebase;
|
VB->Elts += ib->rebase;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GLuint *elts = (GLuint *)get_space(ctx, ib->count * sizeof(GLuint));
|
||||||
|
VB->Elts = elts;
|
||||||
|
|
||||||
switch (ib->type) {
|
switch (ib->type) {
|
||||||
case GL_UNSIGNED_INT:
|
case GL_UNSIGNED_SHORT: {
|
||||||
return;
|
const GLushort *in = ((GLushort *)ptr) + ib->rebase;
|
||||||
case GL_UNSIGNED_SHORT:
|
for (i = 0; i < ib->count; i++)
|
||||||
|
*elts++ = *in++;
|
||||||
break;
|
break;
|
||||||
case GL_UNSIGNED_BYTE:
|
}
|
||||||
|
case GL_UNSIGNED_BYTE: {
|
||||||
|
const GLubyte *in = ((GLubyte *)ptr) + ib->rebase;
|
||||||
|
for (i = 0; i < ib->count; i++)
|
||||||
|
*elts++ = *in++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmap_vbos( GLcontext *ctx,
|
static void unmap_vbos( GLcontext *ctx,
|
||||||
|
Reference in New Issue
Block a user