diff options
author | Brian <[email protected]> | 2007-08-17 12:23:26 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-17 12:23:26 -0600 |
commit | 4973136e2062fe6930cee1a44f97aefa6b423295 (patch) | |
tree | 59f3d72832904aa900fb81769f45057ebfb39fe7 | |
parent | a30939714cdc73cb633672cad7d86b425781526d (diff) |
load machine.Inputs based on vs.inputs_read
-rw-r--r-- | src/mesa/pipe/softpipe/sp_draw_arrays.c | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/mesa/pipe/softpipe/sp_draw_arrays.c index ac7ae9a887d..be03ae86575 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 |