diff options
author | Keith Whitwell <[email protected]> | 2004-02-16 15:15:24 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2004-02-16 15:15:24 +0000 |
commit | 477363455d250bf7545f1cf89271025f9183dfb5 (patch) | |
tree | d6aff2d6c9eea9a7d35710f6191c194b0a386426 | |
parent | 7b5199e8a44dc478f8800950422efe94fa364de4 (diff) |
Add _tnl_set_attr() to complement existing get_attr() call.
-rw-r--r-- | src/mesa/tnl/t_vertex.c | 30 | ||||
-rw-r--r-- | src/mesa/tnl/t_vertex.h | 6 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index 87931aae62f..172733f575d 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -937,11 +937,31 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin, } } - /* Else return the value from ctx->Current + /* Else return the value from ctx->Current -- dangerous??? */ _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat)); } + +/* Complementary operation to the above. + */ +void _tnl_set_attr( GLcontext *ctx, void *vout, + GLenum attr, const GLfloat *src ) +{ + struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); + const struct tnl_clipspace_attr *a = vtx->attr; + int attr_count = vtx->attr_count; + int j; + + for (j = 0; j < attr_count; j++) { + if (a[j].attrib == (int)attr) { + a[j].insert[4-1]( &a[j], (GLubyte *)vout + a[j].vertoffset, src ); + return; + } + } +} + + void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); @@ -981,8 +1001,8 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, if (format == EMIT_PAD) { offset += map[i].offset; -/* fprintf(stderr, "%d: pad %d, offset now %d\n", i, */ -/* map[i].offset, offset); */ +/* fprintf(stderr, "%d: pad %d, offset now %d\n", i, */ +/* map[i].offset, offset); */ } else { @@ -997,8 +1017,8 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, else vtx->attr[j].vertoffset = offset; -/* fprintf(stderr, "%d: %s offset %d\n", i, */ -/* format_info[format].name, vtx->attr[j].vertoffset); */ +/* fprintf(stderr, "%d: %s offset %d\n", i, */ +/* format_info[format].name, vtx->attr[j].vertoffset); */ offset += format_info[format].attrsize; j++; diff --git a/src/mesa/tnl/t_vertex.h b/src/mesa/tnl/t_vertex.h index 6c58ca994b3..04106264ff2 100644 --- a/src/mesa/tnl/t_vertex.h +++ b/src/mesa/tnl/t_vertex.h @@ -82,6 +82,12 @@ extern void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); extern void _tnl_get_attr( GLcontext *ctx, const void *vertex, GLenum attrib, GLfloat *dest ); +/* Complementary to the above. + */ +extern void _tnl_set_attr( GLcontext *ctx, void *vout, GLenum attrib, + const GLfloat *src ); + + extern void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ); |