Added a bunch of const qualifiers. Use _mesa_memcpy() instead of memcpy(), etc.tags/R300_DRIVER_0
| @@ -2638,7 +2638,7 @@ grammar_check (dict * di, const GLubyte * text, GLubyte ** production, | |||
| 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); | |||
| @@ -83,13 +83,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
| * 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; | |||
| @@ -103,23 +103,23 @@ static GLuint _save_copy_vertices( GLcontext *ctx, | |||
| 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: | |||
| @@ -128,11 +128,11 @@ static GLuint _save_copy_vertices( GLcontext *ctx, | |||
| 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: | |||
| @@ -143,7 +143,7 @@ static GLuint _save_copy_vertices( GLcontext *ctx, | |||
| 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); | |||
| @@ -237,7 +237,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) | |||
| /* 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; | |||
| @@ -295,7 +295,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) | |||
| /* Deal with GL_COMPILE_AND_EXECUTE: | |||
| */ | |||
| if (ctx->ExecuteFlag) { | |||
| _tnl_playback_vertex_list( ctx, (void *)node ); | |||
| _tnl_playback_vertex_list( ctx, (void *) node ); | |||
| } | |||
| } | |||
| @@ -350,7 +350,7 @@ static void _save_wrap_filled_vertex( GLcontext *ctx ) | |||
| 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--; | |||
| @@ -51,7 +51,7 @@ extern void _tnl_save_init( GLcontext *ctx ); | |||
| 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 ); | |||
| @@ -183,8 +183,8 @@ struct loopback_attr { | |||
| * 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; | |||
| @@ -195,7 +195,8 @@ static void loopback_prim( GLcontext *ctx, | |||
| if (prim->mode & PRIM_BEGIN) { | |||
| glBegin( prim->mode & PRIM_MODE_MASK ); | |||
| } else { | |||
| } | |||
| else { | |||
| assert(i == 0); | |||
| assert(begin == 0); | |||
| begin += list->wrap_count; | |||
| @@ -231,8 +232,8 @@ static void loopback_prim( GLcontext *ctx, | |||
| * 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 ); | |||
| @@ -255,7 +256,8 @@ static void loopback_weak_prim( GLcontext *ctx, | |||
| 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; | |||
| @@ -1,8 +1,8 @@ | |||
| /* | |||
| * 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"), | |||
| @@ -50,7 +50,7 @@ static GLint get_size( const GLfloat *f ) | |||
| * 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; | |||
| @@ -118,10 +118,10 @@ static void _tnl_bind_vertex_list( GLcontext *ctx, | |||
| } | |||
| 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) | |||
| @@ -170,13 +170,12 @@ static void _playback_copy_to_current( GLcontext *ctx, | |||
| */ | |||
| 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)) { | |||
| @@ -185,7 +184,7 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) | |||
| * 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 || | |||
| @@ -193,7 +192,7 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) | |||
| /* 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; | |||
| } | |||
| @@ -216,8 +215,3 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) | |||
| */ | |||
| _playback_copy_to_current( ctx, node ); | |||
| } | |||
| @@ -765,9 +765,9 @@ static void generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) | |||
| 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 ); | |||
| } | |||
| } | |||
| } | |||
| @@ -931,7 +931,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin, | |||
| /* 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 ) | |||
| @@ -98,7 +98,7 @@ static void _tnl_wrap_filled_vertex( GLcontext *ctx ) | |||
| 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--; | |||
| @@ -275,7 +275,7 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, | |||
| 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) { | |||
| @@ -893,13 +893,13 @@ static void GLAPIENTRY _tnl_EvalCoord1f( GLfloat u ) | |||
| } | |||
| 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 ) | |||
| @@ -924,13 +924,13 @@ 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 ) | |||
| @@ -202,23 +202,23 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx ) | |||
| 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: | |||
| @@ -227,11 +227,11 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx ) | |||
| 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: | |||
| @@ -242,7 +242,7 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx ) | |||
| 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; | |||