Added a bunch of const qualifiers.
Use _mesa_memcpy() instead of memcpy(), etc.
return 0;
}
- memcpy (*production, ba->data, ba->len * sizeof (GLubyte));
+ _mesa_memcpy(*production, ba->data, ba->len * sizeof (GLubyte));
*size = ba->len;
barray_destroy (&ba);
* wrong-footed on replay.
*/
static GLuint _save_copy_vertices( GLcontext *ctx,
- struct tnl_vertex_list *node )
+ const struct tnl_vertex_list *node )
{
TNLcontext *tnl = TNL_CONTEXT( ctx );
- struct tnl_prim *prim = &node->prim[node->prim_count-1];
+ const struct tnl_prim *prim = &node->prim[node->prim_count-1];
GLuint nr = prim->count;
GLuint sz = tnl->save.vertex_size;
- GLfloat *src = node->buffer + prim->start * sz;
+ const GLfloat *src = node->buffer + prim->start * sz;
GLfloat *dst = tnl->save.copied.buffer;
GLuint ovf, i;
case GL_LINES:
ovf = nr&1;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
case GL_TRIANGLES:
ovf = nr%3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
case GL_QUADS:
ovf = nr&3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
case GL_LINE_STRIP:
if (nr == 0)
return 0;
else {
- memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) );
return 1;
}
case GL_LINE_LOOP:
if (nr == 0)
return 0;
else if (nr == 1) {
- memcpy( dst, src+0, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) );
return 1;
} else {
- memcpy( dst, src+0, sz*sizeof(GLfloat) );
- memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) );
return 2;
}
case GL_TRIANGLE_STRIP:
default: ovf = 2 + (nr&1); break;
}
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) );
return i;
default:
assert(0);
/* Duplicate our template, increment refcounts to the storage structs:
*/
- memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz));
+ _mesa_memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz));
node->vertex_size = tnl->save.vertex_size;
node->buffer = tnl->save.buffer;
node->wrap_count = tnl->save.copied.nr;
/* Deal with GL_COMPILE_AND_EXECUTE:
*/
if (ctx->ExecuteFlag) {
- _tnl_playback_vertex_list( ctx, (void *)node );
+ _tnl_playback_vertex_list( ctx, (void *) node );
}
}
assert(tnl->save.counter > tnl->save.copied.nr);
for (i = 0 ; i < tnl->save.copied.nr ; i++) {
- memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat));
data += tnl->save.vertex_size;
tnl->save.vbptr += tnl->save.vertex_size;
tnl->save.counter--;
extern void _tnl_save_destroy( GLcontext *ctx );
extern void _tnl_loopback_vertex_list( GLcontext *ctx,
- struct tnl_vertex_list *list );
+ const struct tnl_vertex_list *list );
extern void _tnl_playback_vertex_list( GLcontext *ctx, void *data );
* precalculated wrapping is wrong.
*/
static void loopback_prim( GLcontext *ctx,
- struct tnl_vertex_list *list, GLuint i,
- struct loopback_attr *la, GLuint nr )
+ const struct tnl_vertex_list *list, GLuint i,
+ const struct loopback_attr *la, GLuint nr )
{
struct tnl_prim *prim = &list->prim[i];
GLint begin = prim->start;
if (prim->mode & PRIM_BEGIN) {
glBegin( prim->mode & PRIM_MODE_MASK );
- } else {
+ }
+ else {
assert(i == 0);
assert(begin == 0);
begin += list->wrap_count;
* primitives.
*/
static void loopback_weak_prim( GLcontext *ctx,
- struct tnl_vertex_list *list, GLuint i,
- struct loopback_attr *la, GLuint nr )
+ const struct tnl_vertex_list *list, GLuint i,
+ const struct loopback_attr *la, GLuint nr )
{
if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END)
loopback_prim( ctx, list, i, la, nr );
-void _tnl_loopback_vertex_list( GLcontext *ctx, struct tnl_vertex_list *list )
+void _tnl_loopback_vertex_list( GLcontext *ctx,
+ const struct tnl_vertex_list *list )
{
struct loopback_attr la[_TNL_ATTRIB_MAX];
GLuint i, nr = 0;
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.0
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* TODO - remove VB->ColorPtr, etc and just use the AttrPtr's.
*/
static void _tnl_bind_vertex_list( GLcontext *ctx,
- struct tnl_vertex_list *node )
+ const struct tnl_vertex_list *node )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
}
static void _playback_copy_to_current( GLcontext *ctx,
- struct tnl_vertex_list *node )
+ const struct tnl_vertex_list *node )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLfloat *data;
+ const GLfloat *data;
GLuint i;
if (node->count)
*/
void _tnl_playback_vertex_list( GLcontext *ctx, void *data )
{
- struct tnl_vertex_list *node = (struct tnl_vertex_list *)data;
+ const struct tnl_vertex_list *node = (const struct tnl_vertex_list *) data;
TNLcontext *tnl = TNL_CONTEXT(ctx);
FLUSH_CURRENT(ctx, 0);
- if (node->prim_count &&
- node->count) {
+ if (node->prim_count > 0 && node->count > 0) {
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END &&
(node->prim[0].mode & PRIM_BEGIN)) {
* includes operations such as glBegin or glDrawArrays.
*/
_mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin");
- _tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data );
+ _tnl_loopback_vertex_list( ctx, node );
return;
}
else if (tnl->LoopbackDListCassettes ||
/* Degenerate case: list references current data and would
* require fixup. Take the easier option & loop it back.
*/
- _tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data );
+ _tnl_loopback_vertex_list( ctx, node );
return;
}
*/
_playback_copy_to_current( ctx, node );
}
-
-
-
-
-
if (a[j].attrib == VERT_ATTRIB_COLOR0 ||
a[j].attrib == VERT_ATTRIB_COLOR1) {
- memcpy( vdst + a[j].vertoffset,
- vsrc + a[j].vertoffset,
- a[j].vertattrsize );
+ _mesa_memcpy( vdst + a[j].vertoffset,
+ vsrc + a[j].vertoffset,
+ a[j].vertattrsize );
}
}
}
/* Else return the value from ctx->Current
*/
- memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
+ _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
}
void *_tnl_get_vertex( GLcontext *ctx, GLuint nr )
assert(tnl->vtx.counter > tnl->vtx.copied.nr);
for (i = 0 ; i < tnl->vtx.copied.nr ; i++) {
- memcpy( tnl->vtx.vbptr, data, tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.vbptr, data, tnl->vtx.vertex_size * sizeof(GLfloat));
tnl->vtx.vbptr += tnl->vtx.vertex_size;
data += tnl->vtx.vertex_size;
tnl->vtx.counter--;
static void _tnl_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- static float id[4] = { 0, 0, 0, 1 };
+ static const GLfloat id[4] = { 0, 0, 0, 1 };
int i;
if (tnl->vtx.attrsz[attr] < sz) {
}
- memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
_tnl_do_EvalCoord1f( ctx, u );
- memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
}
static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v )
_tnl_fixup_vertex( ctx, _TNL_ATTRIB_NORMAL, 3 );
}
- memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
_tnl_do_EvalCoord2f( ctx, u, v );
- memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
- tnl->vtx.vertex_size * sizeof(GLfloat));
+ _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer,
+ tnl->vtx.vertex_size * sizeof(GLfloat));
}
static void GLAPIENTRY _tnl_EvalCoord1fv( const GLfloat *u )
case GL_LINES:
ovf = nr&1;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_TRIANGLES:
ovf = nr%3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_QUADS:
ovf = nr&3;
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_LINE_STRIP:
if (nr == 0)
return 0;
else {
- memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) );
return 1;
}
case GL_LINE_LOOP:
if (nr == 0)
return 0;
else if (nr == 1) {
- memcpy( dst, src+0, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) );
return 1;
} else {
- memcpy( dst, src+0, sz * sizeof(GLfloat) );
- memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) );
return 2;
}
case GL_TRIANGLE_STRIP:
default: ovf = 2 + (nr&1); break;
}
for (i = 0 ; i < ovf ; i++)
- memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
+ _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) );
return i;
case GL_POLYGON+1:
return 0;