summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@vmware.com>2009-01-22 09:43:42 +0000
committerAlan Hourihane <alanh@vmware.com>2009-01-22 09:43:42 +0000
commit4df482086ebf0663c708b089d8d8d22de0ef972c (patch)
treee802cc36b266bfdeb80ab9e55643c50f5a5e6d9c /src/mesa/tnl
parent01cbd764962ff49bf104e5997914ced53360ef81 (diff)
parentb8bd0b0ddc357f9b430bb6ddeb60c5a2179d3791 (diff)
Merge commit 'origin/master' into gallium-0.2
Conflicts: windows/VC8/mesa/osmesa/osmesa.vcproj windows/VC8/progs/demos/gears.vcproj windows/VC8/progs/progs.sln
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_vertex.c45
-rw-r--r--src/mesa/tnl/t_vertex.h12
2 files changed, 56 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index b661524c87..10b78f820e 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -376,6 +376,22 @@ void _tnl_notify_pipeline_output_change( GLcontext *ctx )
invalidate_funcs(vtx);
}
+
+static void adjust_input_ptrs( GLcontext *ctx, GLint diff)
+{
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
+ struct tnl_clipspace_attr *a = vtx->attr;
+ const GLuint count = vtx->attr_count;
+ int j;
+
+ diff -= 1;
+ for (j=0; j<count; ++j) {
+ register GLvector4f *vptr = VB->AttribPtr[a->attrib];
+ (a++)->inputptr += diff*vptr->stride;
+ }
+}
+
static void update_input_ptrs( GLcontext *ctx, GLuint start )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
@@ -431,13 +447,40 @@ void *_tnl_emit_vertices_to_buffer( GLcontext *ctx,
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
update_input_ptrs(ctx, start);
-
/* Note: dest should not be adjusted for non-zero 'start' values:
*/
vtx->emit( ctx, end - start, (GLubyte*) dest );
return (void *)((GLubyte *)dest + vtx->vertex_size * (end - start));
}
+/* Emit indexed VB vertices start..end to dest. Note that VB vertex at
+ * postion start will be emitted to dest at position zero.
+ */
+
+void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx,
+ const GLuint *elts,
+ GLuint start,
+ GLuint end,
+ void *dest )
+{
+ struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
+ GLuint oldIndex;
+ GLubyte *cdest = dest;
+
+ update_input_ptrs(ctx, oldIndex = elts[start++]);
+ vtx->emit( ctx, 1, cdest );
+ cdest += vtx->vertex_size;
+
+ for (; start < end; ++start) {
+ adjust_input_ptrs(ctx, elts[start] - oldIndex);
+ oldIndex = elts[start];
+ vtx->emit( ctx, 1, cdest);
+ cdest += vtx->vertex_size;
+ }
+
+ return (void *) cdest;
+}
+
void _tnl_init_vertices( GLcontext *ctx,
GLuint vb_size,
diff --git a/src/mesa/tnl/t_vertex.h b/src/mesa/tnl/t_vertex.h
index 712311a146..2dfd7b57f0 100644
--- a/src/mesa/tnl/t_vertex.h
+++ b/src/mesa/tnl/t_vertex.h
@@ -119,6 +119,18 @@ extern void *_tnl_emit_vertices_to_buffer( GLcontext *ctx,
GLuint end,
void *dest );
+/* This function isn't optimal. Check out
+ * gallium/auxilary/translate for a more comprehensive implementation of
+ * the same functionality.
+ */
+
+extern void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx,
+ const GLuint *elts,
+ GLuint start,
+ GLuint end,
+ void *dest );
+
+
extern void _tnl_build_vertices( GLcontext *ctx,
GLuint start,
GLuint end,