blob: d61f63f9b3d7d03b9de7d278b25d77c28faf2c6e [file] [log] [blame]
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00001/* $Id: t_pipeline.c,v 1.3 2000/11/22 07:32:18 joukj Exp $ */
Keith Whitwell23caf202000-11-16 21:05:34 +00002
3/*
4 * Mesa 3-D graphics library
5 * Version: 3.5
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00006 *
Keith Whitwell23caf202000-11-16 21:05:34 +00007 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +00008 *
Keith Whitwell23caf202000-11-16 21:05:34 +00009 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000015 *
Keith Whitwell23caf202000-11-16 21:05:34 +000016 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000018 *
Keith Whitwell23caf202000-11-16 21:05:34 +000019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27/* Dynamic pipelines, support for CVA.
28 * Copyright (C) 1999 Keith Whitwell.
29 */
30
31#include "glheader.h"
32#include "context.h"
33#include "mem.h"
34#include "mmath.h"
35#include "state.h"
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000036#include "mtypes.h"
Keith Whitwell23caf202000-11-16 21:05:34 +000037
38#include "math/m_translate.h"
39#include "math/m_xform.h"
40
41#include "t_bbox.h"
42#include "t_clip.h"
43#include "t_cva.h"
44#include "t_fog.h"
45#include "t_light.h"
46#include "t_pipeline.h"
47#include "t_shade.h"
48#include "t_stages.h"
49#include "t_vbcull.h"
50#include "t_vbindirect.h"
51#include "t_vbrender.h"
52#include "t_vbxform.h"
53
54
55
56
57
58void gl_print_pipe_ops( const char *msg, GLuint flags )
59{
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000060 fprintf(stderr,
Brian Paul189476f2000-11-20 18:06:11 +000061 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n",
Keith Whitwell23caf202000-11-16 21:05:34 +000062 msg,
63 flags,
64 (flags & PIPE_OP_CVA_PREPARE) ? "cva-prepare, " : "",
65 (flags & PIPE_OP_VERT_XFORM) ? "vert-xform, " : "",
66 (flags & PIPE_OP_NORM_XFORM) ? "norm-xform, " : "",
67 (flags & PIPE_OP_LIGHT) ? "light, " : "",
68 (flags & PIPE_OP_FOG) ? "fog, " : "",
69 (flags & PIPE_OP_TEX0) ? "tex-0, " : "",
70 (flags & PIPE_OP_TEX1) ? "tex-1, " : "",
Brian Paul189476f2000-11-20 18:06:11 +000071 (flags & PIPE_OP_TEX2) ? "tex-2, " : "",
72 (flags & PIPE_OP_TEX3) ? "tex-3, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +000073 (flags & PIPE_OP_RAST_SETUP_0) ? "rast-0, " : "",
74 (flags & PIPE_OP_RAST_SETUP_1) ? "rast-1, " : "",
75 (flags & PIPE_OP_RENDER) ? "render, " : "");
76
77}
78
79
80
81/* Have to reset only those parts of the vb which are being recalculated.
82 */
83void gl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages )
84{
85 GLcontext *ctx = VB->ctx;
86 TNLcontext *tnl = TNL_CONTEXT(ctx);
87
88 if (MESA_VERBOSE&VERBOSE_PIPELINE)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000089 gl_print_pipe_ops( "reset cva vb", stages );
Keith Whitwell23caf202000-11-16 21:05:34 +000090
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000091 if (stages & PIPE_OP_VERT_XFORM)
Keith Whitwell23caf202000-11-16 21:05:34 +000092 {
93 if (VB->ClipOrMask & CLIP_USER_BIT)
94 MEMSET(VB->UserClipMask, 0, VB->Count);
95
96 VB->ClipOrMask = 0;
97 VB->ClipAndMask = CLIP_ALL_BITS;
98 VB->CullMode = 0;
99 VB->CullFlag[0] = VB->CullFlag[1] = 0;
100 VB->Culled = 0;
101 }
102
103 if (stages & PIPE_OP_NORM_XFORM) {
104 VB->NormalPtr = &tnl->CVA.v.Normal;
105 }
106
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000107 if (stages & PIPE_OP_LIGHT)
Keith Whitwell23caf202000-11-16 21:05:34 +0000108 {
109 VB->ColorPtr = VB->Color[0] = VB->Color[1] = &tnl->CVA.v.Color;
110 VB->IndexPtr = VB->Index[0] = VB->Index[1] = &tnl->CVA.v.Index;
111 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000112 else if (stages & PIPE_OP_FOG)
Keith Whitwell23caf202000-11-16 21:05:34 +0000113 {
114 if (ctx->Light.Enabled) {
115 VB->Color[0] = VB->LitColor[0];
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000116 VB->Color[1] = VB->LitColor[1];
Keith Whitwell23caf202000-11-16 21:05:34 +0000117 VB->Index[0] = VB->LitIndex[0];
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000118 VB->Index[1] = VB->LitIndex[1];
Keith Whitwell23caf202000-11-16 21:05:34 +0000119 } else {
120 VB->Color[0] = VB->Color[1] = &tnl->CVA.v.Color;
121 VB->Index[0] = VB->Index[1] = &tnl->CVA.v.Index;
122 }
123 VB->ColorPtr = VB->Color[0];
124 VB->IndexPtr = VB->Index[0];
125 }
126}
127
128
129
130
131
132
133static void pipeline_ctr( struct gl_pipeline *p, GLcontext *ctx, GLuint type )
134{
135 GLuint i;
136 (void) ctx;
137
138 p->state_change = 0;
139 p->cva_state_change = 0;
140 p->inputs = 0;
141 p->outputs = 0;
142 p->type = type;
143 p->ops = 0;
144
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000145 for (i = 0 ; i < gl_default_nr_stages ; i++)
Keith Whitwell23caf202000-11-16 21:05:34 +0000146 p->state_change |= gl_default_pipeline[i].state_change;
147}
148
149
150void _tnl_pipeline_init( GLcontext *ctx )
151{
152 TNLcontext *tnl = TNL_CONTEXT(ctx);
153
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000154 MEMCPY( tnl->PipelineStage,
155 gl_default_pipeline,
Keith Whitwell23caf202000-11-16 21:05:34 +0000156 sizeof(*gl_default_pipeline) * gl_default_nr_stages );
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000157
Keith Whitwell23caf202000-11-16 21:05:34 +0000158 tnl->NrPipelineStages = gl_default_nr_stages;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000159
Keith Whitwell23caf202000-11-16 21:05:34 +0000160 pipeline_ctr( &tnl->CVA.elt, ctx, PIPE_IMMEDIATE);
161 pipeline_ctr( &tnl->CVA.pre, ctx, PIPE_PRECALC );
162}
163
164
165
166#define MINIMAL_VERT_DATA (VERT_DATA & ~(VERT_TEX0_4 | \
167 VERT_TEX1_4 | \
168 VERT_TEX2_4 | \
169 VERT_TEX3_4 | \
170 VERT_EVAL_ANY))
171
172#define VERT_CURRENT_DATA (VERT_TEX0_1234 | \
173 VERT_TEX1_1234 | \
174 VERT_TEX2_1234 | \
175 VERT_TEX3_1234 | \
176 VERT_RGBA | \
177 VERT_SPEC_RGB | \
178 VERT_FOG_COORD | \
179 VERT_INDEX | \
180 VERT_EDGE | \
181 VERT_NORM | \
182 VERT_MATERIAL)
183
184/* Called prior to every recomputation of the CVA precalc data, except where
185 * the driver is able to calculate the pipeline unassisted.
186 */
187static void build_full_precalc_pipeline( GLcontext *ctx )
188{
189 TNLcontext *tnl = TNL_CONTEXT(ctx);
190 struct gl_pipeline_stage *pipeline = tnl->PipelineStage;
191 struct gl_cva *cva = &tnl->CVA;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000192 struct gl_pipeline *pre = &cva->pre;
Keith Whitwell23caf202000-11-16 21:05:34 +0000193 struct gl_pipeline_stage **stages = pre->stages;
194 GLuint i;
195 GLuint newstate = pre->new_state;
196 GLuint changed_ops = 0;
197 GLuint oldoutputs = pre->outputs;
198 GLuint oldinputs = pre->inputs;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000199 GLuint fallback = (VERT_CURRENT_DATA & tnl->_CurrentFlag &
Keith Whitwell23caf202000-11-16 21:05:34 +0000200 ~tnl->_ArraySummary);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000201 GLuint changed_outputs = (tnl->_ArrayNewState |
Keith Whitwell23caf202000-11-16 21:05:34 +0000202 (fallback & cva->orflag));
203 GLuint available = fallback | tnl->_ArrayFlags;
204
205 pre->cva_state_change = 0;
206 pre->ops = 0;
207 pre->outputs = 0;
208 pre->inputs = 0;
209 pre->forbidden_inputs = 0;
210 pre->fallback = 0;
211
212 /* KW: Disable data reuse during Mesa reorg. Make this more readable...
213 */
214 newstate = ~0;
215
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000216 if (tnl->_ArraySummary & VERT_ELT)
Keith Whitwell23caf202000-11-16 21:05:34 +0000217 cva->orflag &= VERT_MATERIAL;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000218
Keith Whitwell23caf202000-11-16 21:05:34 +0000219 cva->orflag &= ~(tnl->_ArraySummary & ~VERT_OBJ_ANY);
220 available &= ~cva->orflag;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000221
Keith Whitwell23caf202000-11-16 21:05:34 +0000222 pre->outputs = available;
223 pre->inputs = available;
224
225 if (MESA_VERBOSE & VERBOSE_PIPELINE) {
226 fprintf(stderr, ": Rebuild pipeline\n");
227 gl_print_vert_flags("orflag", cva->orflag);
228 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000229
230
Keith Whitwell23caf202000-11-16 21:05:34 +0000231
232 /* If something changes in the pipeline, tag all subsequent stages
233 * using this value for recalcuation. Also used to build the full
234 * pipeline by setting newstate and newinputs to ~0.
235 *
236 * Because all intermediate values are buffered, the new inputs
237 * are enough to fully specify what needs to be calculated, and a
238 * single pass identifies all stages requiring recalculation.
239 */
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000240 for (i = 0 ; i < tnl->NrPipelineStages ; i++)
Keith Whitwell23caf202000-11-16 21:05:34 +0000241 {
242 pipeline[i].check(ctx, &pipeline[i]);
243
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000244 if (pipeline[i].type & PIPE_PRECALC)
Keith Whitwell23caf202000-11-16 21:05:34 +0000245 {
246 if ((newstate & pipeline[i].cva_state_change) ||
247 (changed_outputs & pipeline[i].inputs) ||
248 !pipeline[i].inputs)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000249 {
Keith Whitwell23caf202000-11-16 21:05:34 +0000250 changed_ops |= pipeline[i].ops;
251 changed_outputs |= pipeline[i].outputs;
252 pipeline[i].active &= ~PIPE_PRECALC;
253
254 if ((pipeline[i].inputs & ~available) == 0 &&
255 (pipeline[i].ops & pre->ops) == 0)
256 {
257 pipeline[i].active |= PIPE_PRECALC;
258 *stages++ = &pipeline[i];
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000259 }
Keith Whitwell23caf202000-11-16 21:05:34 +0000260 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000261
Keith Whitwell23caf202000-11-16 21:05:34 +0000262 /* Incompatible with multiple stages structs implementing
263 * the same stage.
264 */
265 available &= ~pipeline[i].outputs;
266 pre->outputs &= ~pipeline[i].outputs;
267
268 if (pipeline[i].active & PIPE_PRECALC) {
269 pre->ops |= pipeline[i].ops;
270 pre->outputs |= pipeline[i].outputs;
271 available |= pipeline[i].outputs;
272 pre->forbidden_inputs |= pipeline[i].pre_forbidden_inputs;
273 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000274 }
275 else if (pipeline[i].active & PIPE_PRECALC)
Keith Whitwell23caf202000-11-16 21:05:34 +0000276 {
277 pipeline[i].active &= ~PIPE_PRECALC;
278 changed_outputs |= pipeline[i].outputs;
279 changed_ops |= pipeline[i].ops;
280 }
281 }
282
283 *stages = 0;
284
285 pre->new_outputs = pre->outputs & (changed_outputs | ~oldoutputs);
286 pre->new_inputs = pre->inputs & ~oldinputs;
287 pre->fallback = pre->inputs & fallback;
288 pre->forbidden_inputs |= pre->inputs & fallback;
289
290 pre->changed_ops = changed_ops;
291}
292
293void gl_build_precalc_pipeline( GLcontext *ctx )
294{
295 TNLcontext *tnl = TNL_CONTEXT(ctx);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000296 struct gl_pipeline *pre = &tnl->CVA.pre;
297 struct gl_pipeline *elt = &tnl->CVA.elt;
Keith Whitwell23caf202000-11-16 21:05:34 +0000298
299 if (!ctx->Driver.BuildPrecalcPipeline ||
300 !ctx->Driver.BuildPrecalcPipeline( ctx ))
301 build_full_precalc_pipeline( ctx );
302
303 pre->data_valid = 0;
304 pre->pipeline_valid = 1;
305 elt->pipeline_valid = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000306
Keith Whitwell23caf202000-11-16 21:05:34 +0000307 tnl->CVA.orflag = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000308
Keith Whitwell23caf202000-11-16 21:05:34 +0000309 if (MESA_VERBOSE&VERBOSE_PIPELINE)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000310 gl_print_pipeline( ctx, pre );
Keith Whitwell23caf202000-11-16 21:05:34 +0000311}
312
313
314static void build_full_immediate_pipeline( GLcontext *ctx )
315{
316 TNLcontext *tnl = TNL_CONTEXT(ctx);
317 struct gl_pipeline_stage *pipeline = tnl->PipelineStage;
318 struct gl_cva *cva = &tnl->CVA;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000319 struct gl_pipeline *pre = &cva->pre;
Keith Whitwell23caf202000-11-16 21:05:34 +0000320 struct gl_pipeline *elt = &cva->elt;
321 struct gl_pipeline_stage **stages = elt->stages;
322 GLuint i;
323 GLuint newstate = elt->new_state;
324 GLuint active_ops = 0;
325 GLuint available = cva->orflag | MINIMAL_VERT_DATA;
326 GLuint generated = 0;
327 GLuint is_elt = 0;
328
329 if (pre->data_valid && tnl->CompileCVAFlag) {
330 is_elt = 1;
331 active_ops = cva->pre.ops;
332 available |= pre->outputs | VERT_PRECALC_DATA;
333 }
334
335
336 elt->outputs = 0; /* not used */
337 elt->inputs = 0;
338
339 for (i = 0 ; i < tnl->NrPipelineStages ; i++) {
340 pipeline[i].active &= ~PIPE_IMMEDIATE;
341
342 if ((pipeline[i].state_change & newstate) ||
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000343 (pipeline[i].elt_forbidden_inputs & available))
Keith Whitwell23caf202000-11-16 21:05:34 +0000344 {
345 pipeline[i].check(ctx, &pipeline[i]);
346 }
347
348 if ((pipeline[i].type & PIPE_IMMEDIATE) &&
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000349 (pipeline[i].ops & active_ops) == 0 &&
Keith Whitwell23caf202000-11-16 21:05:34 +0000350 (pipeline[i].elt_forbidden_inputs & available) == 0
351 )
352 {
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000353 if (pipeline[i].inputs & ~available)
Keith Whitwell23caf202000-11-16 21:05:34 +0000354 elt->forbidden_inputs |= pipeline[i].inputs & ~available;
355 else
356 {
357 elt->inputs |= pipeline[i].inputs & ~generated;
358 elt->forbidden_inputs |= pipeline[i].elt_forbidden_inputs;
359 pipeline[i].active |= PIPE_IMMEDIATE;
360 *stages++ = &pipeline[i];
361 generated |= pipeline[i].outputs;
362 available |= pipeline[i].outputs;
363 active_ops |= pipeline[i].ops;
364 }
365 }
366 }
367
368 *stages = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000369
Keith Whitwell23caf202000-11-16 21:05:34 +0000370 elt->copy_transformed_data = 1;
371 elt->replay_copied_vertices = 0;
372
373 if (is_elt) {
374 cva->merge = elt->inputs & pre->outputs;
375 elt->ops = active_ops & ~pre->ops;
376 }
377}
378
379
380
381void gl_build_immediate_pipeline( GLcontext *ctx )
382{
383 TNLcontext *tnl = TNL_CONTEXT(ctx);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000384 struct gl_pipeline *elt = &tnl->CVA.elt;
Keith Whitwell23caf202000-11-16 21:05:34 +0000385
386 if (!ctx->Driver.BuildEltPipeline ||
387 !ctx->Driver.BuildEltPipeline( ctx )) {
388 build_full_immediate_pipeline( ctx );
389 }
390
391 elt->pipeline_valid = 1;
392 tnl->CVA.orflag = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000393
Keith Whitwell23caf202000-11-16 21:05:34 +0000394 if (MESA_VERBOSE&VERBOSE_PIPELINE)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000395 gl_print_pipeline( ctx, elt );
Keith Whitwell23caf202000-11-16 21:05:34 +0000396}
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000397
Keith Whitwell23caf202000-11-16 21:05:34 +0000398#define INTERESTED ~0
399
400void gl_update_pipelines( GLcontext *ctx )
401{
402 TNLcontext *tnl = TNL_CONTEXT(ctx);
403 GLuint newstate = ctx->NewState;
404 struct gl_cva *cva = &tnl->CVA;
405
406 newstate &= INTERESTED;
407
408 if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_STATE))
409 gl_print_enable_flags("enabled", ctx->_Enabled);
410
411 if (newstate ||
412 cva->lock_changed ||
413 cva->orflag != cva->last_orflag ||
414 tnl->_ArrayFlags != cva->last_array_flags)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000415 {
Keith Whitwell23caf202000-11-16 21:05:34 +0000416 GLuint flags = VERT_WIN;
417
418 if (ctx->Visual.RGBAflag) {
419 flags |= VERT_RGBA;
420 if (ctx->_TriangleCaps && DD_SEPERATE_SPECULAR)
421 flags |= VERT_SPEC_RGB;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000422 } else
Keith Whitwell23caf202000-11-16 21:05:34 +0000423 flags |= VERT_INDEX;
424
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000425 if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
Keith Whitwell23caf202000-11-16 21:05:34 +0000426 flags |= VERT_TEX0_ANY;
427
428 if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
429 flags |= VERT_TEX1_ANY;
430
431#if MAX_TEXTURE_UNITS > 2
432 if (ctx->Texture._ReallyEnabled & TEXTURE2_ANY)
433 flags |= VERT_TEX2_ANY;
434#endif
435#if MAX_TEXTURE_UNITS > 3
436 if (ctx->Texture._ReallyEnabled & TEXTURE3_ANY)
437 flags |= VERT_TEX3_ANY;
438#endif
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000439
440 if (ctx->Polygon._Unfilled)
Keith Whitwell23caf202000-11-16 21:05:34 +0000441 flags |= VERT_EDGE;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000442
Keith Whitwell23caf202000-11-16 21:05:34 +0000443 if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
444 flags |= VERT_FOG_COORD;
445
446 if (ctx->RenderMode==GL_FEEDBACK) {
447 flags = (VERT_WIN | VERT_RGBA | VERT_INDEX | VERT_NORM | VERT_EDGE
448 | VERT_TEX0_ANY
449 | VERT_TEX1_ANY
450#if MAX_TEXTURE_UNITS > 2
451 | VERT_TEX2_ANY
452#endif
453#if MAX_TEXTURE_UNITS > 3
454 | VERT_TEX3_ANY
455#endif
456 );
457 }
458
459 tnl->_RenderFlags = flags;
460
461 cva->elt.new_state |= newstate;
462 cva->elt.pipeline_valid = 0;
463
464 cva->pre.new_state |= newstate;
465 cva->pre.forbidden_inputs = 0;
466 cva->pre.pipeline_valid = 0;
467 cva->lock_changed = 0;
468 }
469
470 if (tnl->_ArrayNewState != cva->last_array_new_state)
471 cva->pre.pipeline_valid = 0;
472
473 cva->pre.data_valid = 0;
474 cva->last_array_new_state = tnl->_ArrayNewState;
475 cva->last_orflag = cva->orflag;
476 cva->last_array_flags = tnl->_ArrayFlags;
477}
478
479void gl_run_pipeline( struct vertex_buffer *VB )
480{
481 struct gl_pipeline *pipe = VB->pipeline;
482 struct gl_pipeline_stage **stages = pipe->stages;
483 unsigned short x;
484
485 pipe->data_valid = 1; /* optimized stages might want to reset this. */
486
487 if (0) gl_print_pipeline( VB->ctx, pipe );
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000488
Keith Whitwell23caf202000-11-16 21:05:34 +0000489 START_FAST_MATH(x);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000490
491 for ( VB->Culled = 0; *stages && !VB->Culled ; stages++ )
Keith Whitwell23caf202000-11-16 21:05:34 +0000492 (*stages)->run( VB );
493
494 END_FAST_MATH(x);
495
496 pipe->new_state = 0;
497}
498