summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorBrian <brian@nostromo.localnet.net>2007-02-25 17:29:00 -0700
committerBrian <brian@nostromo.localnet.net>2007-02-25 17:29:00 -0700
commite71a33bbf87649150bc748b85ca7213af7c737f4 (patch)
treef904403845d430f0912afb6a442153acfb504ddc /src/mesa/tnl
parentf68067e101d596e59b39f94fafc39483f1c71233 (diff)
Optimize the loop for copying output results.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_vb_program.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 82e007a3ac..4ea134a97e 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -196,7 +196,8 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
struct vertex_buffer *VB = &tnl->vb;
struct gl_vertex_program *program = ctx->VertexProgram._Current;
struct gl_program_machine machine;
- GLuint i;
+ GLuint outputs[VERT_RESULT_MAX], numOutputs;
+ GLuint i, j;
#define FORCE_PROG_EXECUTE_C 1
#if FORCE_PROG_EXECUTE_C
@@ -214,6 +215,13 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
_mesa_load_state_parameters(ctx, program->Base.Parameters);
}
+ numOutputs = 0;
+ for (i = 0; i < VERT_RESULT_MAX; i++) {
+ if (program->Base.OutputsWritten & (1 << i)) {
+ outputs[numOutputs++] = i;
+ }
+ }
+
for (i = 0; i < VB->Count; i++) {
GLuint attr;
@@ -264,10 +272,9 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
}
/* copy the output registers into the VB->attribs arrays */
- for (attr = 0; attr < VERT_RESULT_MAX; attr++) {
- if (program->Base.OutputsWritten & (1 << attr)) {
- COPY_4V(store->attribs[attr].data[i], machine.Outputs[attr]);
- }
+ for (j = 0; j < numOutputs; j++) {
+ const GLuint attr = outputs[j];
+ COPY_4V(store->attribs[attr].data[i], machine.Outputs[attr]);
}
#if 0
printf("HPOS: %f %f %f %f\n",