summaryrefslogtreecommitdiff
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-10-30 16:44:13 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-10-30 16:44:13 +0000
commit99efde461d3b8615863bdb7308e05289e0db0422 (patch)
tree95b9e3f4f612957a93547892f3559cfaa44dccb7 /src/mesa/vbo/vbo_exec_draw.c
parentefef291dc71eb57f90785a26957f4b3e01733156 (diff)
better handling of current attributes. Trivial dlist and varray tests work
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index f665c64c7a..c1898aea49 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -132,25 +132,49 @@ static GLuint vbo_copy_vertices( struct vbo_exec_context *exec )
}
+
/* TODO: populate these as the vertex is defined:
*/
-static void vbo_exec_bind_arrays( struct vbo_exec_context *exec )
+static void vbo_exec_bind_arrays( GLcontext *ctx )
{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
struct gl_client_array *arrays = exec->vtx.arrays;
GLuint count = exec->vtx.vert_count;
GLubyte *data = exec->vtx.buffer_map;
+ const GLuint *map;
GLuint attr;
- memcpy(arrays, exec->legacy_currval, 16 * sizeof(arrays[0]));
- memcpy(arrays + 16, exec->mat_currval, 16 * sizeof(arrays[0]));
+ /* Install the default (ie Current) attributes first, then overlay
+ * all active ones.
+ */
+ switch (get_program_mode(exec->ctx)) {
+ case VP_NONE:
+ memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
+ memcpy(arrays + 16, vbo->mat_currval, 16 * sizeof(arrays[0]));
+ map = vbo->map_vp_none;
+ break;
+ case VP_NV:
+ case VP_ARB:
+ /* The aliasing of attributes for NV vertex programs has already
+ * occurred. NV vertex programs cannot access material values,
+ * nor attributes greater than VERT_ATTRIB_TEX7.
+ */
+ memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
+ memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
+ map = vbo->map_vp_arb;
+ break;
+ }
/* Make all active attributes (including edgeflag) available as
* arrays of floats.
*/
- for (attr = 0; attr < VBO_ATTRIB_MAX ; attr++) {
- if (exec->vtx.attrsz[attr]) {
+ for (attr = 0; attr < VERT_ATTRIB_MAX ; attr++) {
+ GLuint src = map[attr];
+
+ if (exec->vtx.attrsz[src]) {
arrays[attr].Ptr = (void *)data;
- arrays[attr].Size = exec->vtx.attrsz[attr];
+ arrays[attr].Size = exec->vtx.attrsz[src];
arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Type = GL_FLOAT;
@@ -181,7 +205,7 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
if (exec->vtx.copied.nr != exec->vtx.vert_count) {
GLcontext *ctx = exec->ctx;
- vbo_exec_bind_arrays( exec );
+ vbo_exec_bind_arrays( ctx );
vbo_context(ctx)->draw_prims( ctx,
exec->vtx.inputs,