From 4973136e2062fe6930cee1a44f97aefa6b423295 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 17 Aug 2007 12:23:26 -0600 Subject: load machine.Inputs based on vs.inputs_read --- src/mesa/pipe/softpipe/sp_draw_arrays.c | 41 ++++++++++++--------------------- 1 file changed, 15 insertions(+), 26 deletions(-) (limited to 'src/mesa/pipe/softpipe/sp_draw_arrays.c') diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/mesa/pipe/softpipe/sp_draw_arrays.c index ac7ae9a887..be03ae8657 100644 --- a/src/mesa/pipe/softpipe/sp_draw_arrays.c +++ b/src/mesa/pipe/softpipe/sp_draw_arrays.c @@ -131,32 +131,21 @@ run_vertex_program(struct draw_context *draw, /* load machine inputs */ for (j = 0; j < count; j++) { - const void *mapped = vbuffer; - const float *vIn, *cIn; - vIn = (const float *) ((const ubyte *) mapped - + draw->vertex_buffer[0].buffer_offset - + draw->vertex_element[0].src_offset - + elts[j] * draw->vertex_buffer[0].pitch); - - cIn = (const float *) ((const ubyte *) mapped - + draw->vertex_buffer[3].buffer_offset - + draw->vertex_element[3].src_offset - + elts[j] * draw->vertex_buffer[3].pitch); - - machine.Inputs[0].xyzw[0].f[j] = vIn[0]; /*X*/ - machine.Inputs[0].xyzw[1].f[j] = vIn[1]; /*Y*/ - machine.Inputs[0].xyzw[2].f[j] = vIn[2]; /*Z*/ - machine.Inputs[0].xyzw[3].f[j] = 1.0; /*W*/ - - machine.Inputs[3].xyzw[0].f[j] = cIn[0]; - machine.Inputs[3].xyzw[1].f[j] = cIn[1]; - machine.Inputs[3].xyzw[2].f[j] = cIn[2]; - machine.Inputs[3].xyzw[3].f[j] = 1.0; - -#if 0 - printf("VS Input %d: %f %f %f %f\n", - j, vIn[0], vIn[1], vIn[2], 1.0); -#endif + unsigned attr; + for (attr = 0; attr < 16; attr++) { + if (sp->vs.inputs_read & (1 << attr)) { + const float *p + = (const float *) ((const ubyte *) vbuffer + + draw->vertex_buffer[attr].buffer_offset + + draw->vertex_element[attr].src_offset + + elts[j] * draw->vertex_buffer[attr].pitch); + + machine.Inputs[attr].xyzw[0].f[j] = p[0]; /*X*/ + machine.Inputs[attr].xyzw[1].f[j] = p[1]; /*Y*/ + machine.Inputs[attr].xyzw[2].f[j] = p[2]; /*Z*/ + machine.Inputs[attr].xyzw[3].f[j] = 1.0; /*W*/ + } + } } #if 0 -- cgit v1.2.3