From 12bab63f09975504c20a5dc9b9831a8072c43506 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 21 Apr 2002 20:37:04 +0000 Subject: Vertex program attribute arrays seem to work now. This includes fallbacks to the conventional arrays when attribute arrays aren't enabled. --- src/mesa/tnl/t_vb_program.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/mesa/tnl/t_vb_program.c') diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index fea8c11f2b..d89d006d4f 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_program.c,v 1.11 2002/04/04 18:25:40 kschultz Exp $ */ +/* $Id: t_vb_program.c,v 1.12 2002/04/21 20:37:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -182,10 +182,6 @@ static GLboolean run_vp( GLcontext *ctx, struct gl_pipeline_stage *stage ) VB->AttribPtr[2]->data[i][3]); #endif - /* XXXX - * We have to deal with stride!=16 bytes, size!=4, etc in these loops!!! - */ - /* load the input attribute registers */ if (VB->Flag) { /* the traditional glBegin/glVertex/glEnd case */ @@ -199,13 +195,14 @@ static GLboolean run_vp( GLcontext *ctx, struct gl_pipeline_stage *stage ) else { /* the vertex array case */ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { - const GLubyte *ptr = (const GLubyte *) VB->AttribPtr[attr]->data; - const GLint stride = VB->AttribPtr[attr]->stride; - const GLfloat *data = (GLfloat *) (ptr + stride * i); - const GLint size = VB->AttribPtr[attr]->size; - COPY_4V(machine->Registers[VP_INPUT_REG_START + attr], data); - if (size == 3) - machine->Registers[VP_INPUT_REG_START + attr][3] = 1.0; + if (program->InputsRead & (1 << attr)) { + const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data; + const GLuint stride = VB->AttribPtr[attr]->stride; + const GLfloat *data = (GLfloat *) (ptr + stride * i); + COPY_4V(machine->Registers[VP_INPUT_REG_START + attr], data); + /*ASSERT(VB->AttribPtr[attr]->size == 4);*/ + ASSERT(stride == 4 * sizeof(GLfloat) || stride == 0); + } } } @@ -406,10 +403,12 @@ static void check_vp( GLcontext *ctx, struct gl_pipeline_stage *stage ) stage->active = ctx->VertexProgram.Enabled; if (stage->active) { - /* XXX what do we need here??? */ - /* - GLbitfield vpInput = ctx->VertexProgram.Current->InputsRead; - */ + /* XXX what do we need here??? + * + * I think that: + * stage->inputs = ctx->VertexProgram.Current->InputsRead; + * would be correct, and something similar for the outputs. + */ #if 000 if (stage->privatePtr) -- cgit v1.2.3