blob: 42b9d051556335afbfc10a7a5025a4ff3a33543f [file] [log] [blame]
Keith Whitwellad2ac212000-11-24 10:25:05 +00001/* $Id: t_pipeline.c,v 1.4 2000/11/24 10:25:12 keithw 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"
Keith Whitwellad2ac212000-11-24 10:25:05 +000044#include "t_debug.h"
Keith Whitwell23caf202000-11-16 21:05:34 +000045#include "t_fog.h"
46#include "t_light.h"
47#include "t_pipeline.h"
48#include "t_shade.h"
49#include "t_stages.h"
50#include "t_vbcull.h"
51#include "t_vbindirect.h"
52#include "t_vbrender.h"
53#include "t_vbxform.h"
54
55
56
57
58
Keith Whitwellad2ac212000-11-24 10:25:05 +000059void _tnl_print_pipe_ops( const char *msg, GLuint flags )
Keith Whitwell23caf202000-11-16 21:05:34 +000060{
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000061 fprintf(stderr,
Brian Paul189476f2000-11-20 18:06:11 +000062 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n",
Keith Whitwell23caf202000-11-16 21:05:34 +000063 msg,
64 flags,
65 (flags & PIPE_OP_CVA_PREPARE) ? "cva-prepare, " : "",
66 (flags & PIPE_OP_VERT_XFORM) ? "vert-xform, " : "",
67 (flags & PIPE_OP_NORM_XFORM) ? "norm-xform, " : "",
68 (flags & PIPE_OP_LIGHT) ? "light, " : "",
69 (flags & PIPE_OP_FOG) ? "fog, " : "",
70 (flags & PIPE_OP_TEX0) ? "tex-0, " : "",
71 (flags & PIPE_OP_TEX1) ? "tex-1, " : "",
Brian Paul189476f2000-11-20 18:06:11 +000072 (flags & PIPE_OP_TEX2) ? "tex-2, " : "",
73 (flags & PIPE_OP_TEX3) ? "tex-3, " : "",
Keith Whitwell23caf202000-11-16 21:05:34 +000074 (flags & PIPE_OP_RAST_SETUP_0) ? "rast-0, " : "",
75 (flags & PIPE_OP_RAST_SETUP_1) ? "rast-1, " : "",
76 (flags & PIPE_OP_RENDER) ? "render, " : "");
77
78}
79
80
81
82/* Have to reset only those parts of the vb which are being recalculated.
83 */
Keith Whitwellad2ac212000-11-24 10:25:05 +000084void _tnl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages )
Keith Whitwell23caf202000-11-16 21:05:34 +000085{
86 GLcontext *ctx = VB->ctx;
87 TNLcontext *tnl = TNL_CONTEXT(ctx);
88
89 if (MESA_VERBOSE&VERBOSE_PIPELINE)
Keith Whitwellad2ac212000-11-24 10:25:05 +000090 _tnl_print_pipe_ops( "reset cva vb", stages );
Keith Whitwell23caf202000-11-16 21:05:34 +000091
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +000092 if (stages & PIPE_OP_VERT_XFORM)
Keith Whitwell23caf202000-11-16 21:05:34 +000093 {
94 if (VB->ClipOrMask & CLIP_USER_BIT)
95 MEMSET(VB->UserClipMask, 0, VB->Count);
96
97 VB->ClipOrMask = 0;
98 VB->ClipAndMask = CLIP_ALL_BITS;
99 VB->CullMode = 0;
100 VB->CullFlag[0] = VB->CullFlag[1] = 0;
101 VB->Culled = 0;
102 }
103
104 if (stages & PIPE_OP_NORM_XFORM) {
105 VB->NormalPtr = &tnl->CVA.v.Normal;
106 }
107
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000108 if (stages & PIPE_OP_LIGHT)
Keith Whitwell23caf202000-11-16 21:05:34 +0000109 {
110 VB->ColorPtr = VB->Color[0] = VB->Color[1] = &tnl->CVA.v.Color;
111 VB->IndexPtr = VB->Index[0] = VB->Index[1] = &tnl->CVA.v.Index;
112 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000113 else if (stages & PIPE_OP_FOG)
Keith Whitwell23caf202000-11-16 21:05:34 +0000114 {
115 if (ctx->Light.Enabled) {
116 VB->Color[0] = VB->LitColor[0];
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000117 VB->Color[1] = VB->LitColor[1];
Keith Whitwell23caf202000-11-16 21:05:34 +0000118 VB->Index[0] = VB->LitIndex[0];
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000119 VB->Index[1] = VB->LitIndex[1];
Keith Whitwell23caf202000-11-16 21:05:34 +0000120 } else {
121 VB->Color[0] = VB->Color[1] = &tnl->CVA.v.Color;
122 VB->Index[0] = VB->Index[1] = &tnl->CVA.v.Index;
123 }
124 VB->ColorPtr = VB->Color[0];
125 VB->IndexPtr = VB->Index[0];
126 }
127}
128
129
130
131
132
133
134static void pipeline_ctr( struct gl_pipeline *p, GLcontext *ctx, GLuint type )
135{
136 GLuint i;
137 (void) ctx;
138
139 p->state_change = 0;
140 p->cva_state_change = 0;
141 p->inputs = 0;
142 p->outputs = 0;
143 p->type = type;
144 p->ops = 0;
145
Keith Whitwellad2ac212000-11-24 10:25:05 +0000146 for (i = 0 ; i < _tnl_default_nr_stages ; i++)
147 p->state_change |= _tnl_default_pipeline[i].state_change;
Keith Whitwell23caf202000-11-16 21:05:34 +0000148}
149
150
151void _tnl_pipeline_init( GLcontext *ctx )
152{
153 TNLcontext *tnl = TNL_CONTEXT(ctx);
154
Keith Whitwellad2ac212000-11-24 10:25:05 +0000155 MEMCPY( tnl->PipelineStage,
156 _tnl_default_pipeline,
157 sizeof(*_tnl_default_pipeline) * _tnl_default_nr_stages );
158
159 tnl->NrPipelineStages = _tnl_default_nr_stages;
160
Keith Whitwell23caf202000-11-16 21:05:34 +0000161 pipeline_ctr( &tnl->CVA.elt, ctx, PIPE_IMMEDIATE);
162 pipeline_ctr( &tnl->CVA.pre, ctx, PIPE_PRECALC );
163}
164
165
166
167#define MINIMAL_VERT_DATA (VERT_DATA & ~(VERT_TEX0_4 | \
168 VERT_TEX1_4 | \
169 VERT_TEX2_4 | \
170 VERT_TEX3_4 | \
171 VERT_EVAL_ANY))
172
173#define VERT_CURRENT_DATA (VERT_TEX0_1234 | \
174 VERT_TEX1_1234 | \
175 VERT_TEX2_1234 | \
176 VERT_TEX3_1234 | \
177 VERT_RGBA | \
178 VERT_SPEC_RGB | \
179 VERT_FOG_COORD | \
180 VERT_INDEX | \
181 VERT_EDGE | \
182 VERT_NORM | \
183 VERT_MATERIAL)
184
185/* Called prior to every recomputation of the CVA precalc data, except where
186 * the driver is able to calculate the pipeline unassisted.
187 */
188static void build_full_precalc_pipeline( GLcontext *ctx )
189{
190 TNLcontext *tnl = TNL_CONTEXT(ctx);
191 struct gl_pipeline_stage *pipeline = tnl->PipelineStage;
192 struct gl_cva *cva = &tnl->CVA;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000193 struct gl_pipeline *pre = &cva->pre;
Keith Whitwell23caf202000-11-16 21:05:34 +0000194 struct gl_pipeline_stage **stages = pre->stages;
195 GLuint i;
196 GLuint newstate = pre->new_state;
197 GLuint changed_ops = 0;
198 GLuint oldoutputs = pre->outputs;
199 GLuint oldinputs = pre->inputs;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000200 GLuint fallback = (VERT_CURRENT_DATA & tnl->_CurrentFlag &
Keith Whitwell23caf202000-11-16 21:05:34 +0000201 ~tnl->_ArraySummary);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000202 GLuint changed_outputs = (tnl->_ArrayNewState |
Keith Whitwell23caf202000-11-16 21:05:34 +0000203 (fallback & cva->orflag));
204 GLuint available = fallback | tnl->_ArrayFlags;
205
206 pre->cva_state_change = 0;
207 pre->ops = 0;
208 pre->outputs = 0;
209 pre->inputs = 0;
210 pre->forbidden_inputs = 0;
211 pre->fallback = 0;
212
213 /* KW: Disable data reuse during Mesa reorg. Make this more readable...
214 */
215 newstate = ~0;
216
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000217 if (tnl->_ArraySummary & VERT_ELT)
Keith Whitwell23caf202000-11-16 21:05:34 +0000218 cva->orflag &= VERT_MATERIAL;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000219
Keith Whitwell23caf202000-11-16 21:05:34 +0000220 cva->orflag &= ~(tnl->_ArraySummary & ~VERT_OBJ_ANY);
221 available &= ~cva->orflag;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000222
Keith Whitwell23caf202000-11-16 21:05:34 +0000223 pre->outputs = available;
224 pre->inputs = available;
225
226 if (MESA_VERBOSE & VERBOSE_PIPELINE) {
227 fprintf(stderr, ": Rebuild pipeline\n");
Keith Whitwellad2ac212000-11-24 10:25:05 +0000228 _tnl_print_vert_flags("orflag", cva->orflag);
Keith Whitwell23caf202000-11-16 21:05:34 +0000229 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000230
231
Keith Whitwell23caf202000-11-16 21:05:34 +0000232
233 /* If something changes in the pipeline, tag all subsequent stages
234 * using this value for recalcuation. Also used to build the full
235 * pipeline by setting newstate and newinputs to ~0.
236 *
237 * Because all intermediate values are buffered, the new inputs
238 * are enough to fully specify what needs to be calculated, and a
239 * single pass identifies all stages requiring recalculation.
240 */
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000241 for (i = 0 ; i < tnl->NrPipelineStages ; i++)
Keith Whitwell23caf202000-11-16 21:05:34 +0000242 {
243 pipeline[i].check(ctx, &pipeline[i]);
244
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000245 if (pipeline[i].type & PIPE_PRECALC)
Keith Whitwell23caf202000-11-16 21:05:34 +0000246 {
247 if ((newstate & pipeline[i].cva_state_change) ||
248 (changed_outputs & pipeline[i].inputs) ||
249 !pipeline[i].inputs)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000250 {
Keith Whitwell23caf202000-11-16 21:05:34 +0000251 changed_ops |= pipeline[i].ops;
252 changed_outputs |= pipeline[i].outputs;
253 pipeline[i].active &= ~PIPE_PRECALC;
254
255 if ((pipeline[i].inputs & ~available) == 0 &&
256 (pipeline[i].ops & pre->ops) == 0)
257 {
258 pipeline[i].active |= PIPE_PRECALC;
259 *stages++ = &pipeline[i];
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000260 }
Keith Whitwell23caf202000-11-16 21:05:34 +0000261 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000262
Keith Whitwell23caf202000-11-16 21:05:34 +0000263 /* Incompatible with multiple stages structs implementing
264 * the same stage.
265 */
266 available &= ~pipeline[i].outputs;
267 pre->outputs &= ~pipeline[i].outputs;
268
269 if (pipeline[i].active & PIPE_PRECALC) {
270 pre->ops |= pipeline[i].ops;
271 pre->outputs |= pipeline[i].outputs;
272 available |= pipeline[i].outputs;
273 pre->forbidden_inputs |= pipeline[i].pre_forbidden_inputs;
274 }
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000275 }
276 else if (pipeline[i].active & PIPE_PRECALC)
Keith Whitwell23caf202000-11-16 21:05:34 +0000277 {
278 pipeline[i].active &= ~PIPE_PRECALC;
279 changed_outputs |= pipeline[i].outputs;
280 changed_ops |= pipeline[i].ops;
281 }
282 }
283
284 *stages = 0;
285
286 pre->new_outputs = pre->outputs & (changed_outputs | ~oldoutputs);
287 pre->new_inputs = pre->inputs & ~oldinputs;
288 pre->fallback = pre->inputs & fallback;
289 pre->forbidden_inputs |= pre->inputs & fallback;
290
291 pre->changed_ops = changed_ops;
292}
293
Keith Whitwellad2ac212000-11-24 10:25:05 +0000294void _tnl_build_precalc_pipeline( GLcontext *ctx )
Keith Whitwell23caf202000-11-16 21:05:34 +0000295{
296 TNLcontext *tnl = TNL_CONTEXT(ctx);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000297 struct gl_pipeline *pre = &tnl->CVA.pre;
298 struct gl_pipeline *elt = &tnl->CVA.elt;
Keith Whitwell23caf202000-11-16 21:05:34 +0000299
300 if (!ctx->Driver.BuildPrecalcPipeline ||
301 !ctx->Driver.BuildPrecalcPipeline( ctx ))
302 build_full_precalc_pipeline( ctx );
303
304 pre->data_valid = 0;
305 pre->pipeline_valid = 1;
306 elt->pipeline_valid = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000307
Keith Whitwell23caf202000-11-16 21:05:34 +0000308 tnl->CVA.orflag = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000309
Keith Whitwell23caf202000-11-16 21:05:34 +0000310 if (MESA_VERBOSE&VERBOSE_PIPELINE)
Keith Whitwellad2ac212000-11-24 10:25:05 +0000311 _tnl_print_pipeline( ctx, pre );
Keith Whitwell23caf202000-11-16 21:05:34 +0000312}
313
314
315static void build_full_immediate_pipeline( GLcontext *ctx )
316{
317 TNLcontext *tnl = TNL_CONTEXT(ctx);
318 struct gl_pipeline_stage *pipeline = tnl->PipelineStage;
319 struct gl_cva *cva = &tnl->CVA;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000320 struct gl_pipeline *pre = &cva->pre;
Keith Whitwell23caf202000-11-16 21:05:34 +0000321 struct gl_pipeline *elt = &cva->elt;
322 struct gl_pipeline_stage **stages = elt->stages;
323 GLuint i;
324 GLuint newstate = elt->new_state;
325 GLuint active_ops = 0;
326 GLuint available = cva->orflag | MINIMAL_VERT_DATA;
327 GLuint generated = 0;
328 GLuint is_elt = 0;
329
330 if (pre->data_valid && tnl->CompileCVAFlag) {
331 is_elt = 1;
332 active_ops = cva->pre.ops;
333 available |= pre->outputs | VERT_PRECALC_DATA;
334 }
335
336
337 elt->outputs = 0; /* not used */
338 elt->inputs = 0;
339
340 for (i = 0 ; i < tnl->NrPipelineStages ; i++) {
341 pipeline[i].active &= ~PIPE_IMMEDIATE;
342
343 if ((pipeline[i].state_change & newstate) ||
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000344 (pipeline[i].elt_forbidden_inputs & available))
Keith Whitwell23caf202000-11-16 21:05:34 +0000345 {
346 pipeline[i].check(ctx, &pipeline[i]);
347 }
348
349 if ((pipeline[i].type & PIPE_IMMEDIATE) &&
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000350 (pipeline[i].ops & active_ops) == 0 &&
Keith Whitwell23caf202000-11-16 21:05:34 +0000351 (pipeline[i].elt_forbidden_inputs & available) == 0
352 )
353 {
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000354 if (pipeline[i].inputs & ~available)
Keith Whitwell23caf202000-11-16 21:05:34 +0000355 elt->forbidden_inputs |= pipeline[i].inputs & ~available;
356 else
357 {
358 elt->inputs |= pipeline[i].inputs & ~generated;
359 elt->forbidden_inputs |= pipeline[i].elt_forbidden_inputs;
360 pipeline[i].active |= PIPE_IMMEDIATE;
361 *stages++ = &pipeline[i];
362 generated |= pipeline[i].outputs;
363 available |= pipeline[i].outputs;
364 active_ops |= pipeline[i].ops;
365 }
366 }
367 }
368
369 *stages = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000370
Keith Whitwell23caf202000-11-16 21:05:34 +0000371 elt->copy_transformed_data = 1;
372 elt->replay_copied_vertices = 0;
373
374 if (is_elt) {
375 cva->merge = elt->inputs & pre->outputs;
376 elt->ops = active_ops & ~pre->ops;
377 }
378}
379
380
381
Keith Whitwellad2ac212000-11-24 10:25:05 +0000382void _tnl_build_immediate_pipeline( GLcontext *ctx )
Keith Whitwell23caf202000-11-16 21:05:34 +0000383{
384 TNLcontext *tnl = TNL_CONTEXT(ctx);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000385 struct gl_pipeline *elt = &tnl->CVA.elt;
Keith Whitwell23caf202000-11-16 21:05:34 +0000386
387 if (!ctx->Driver.BuildEltPipeline ||
388 !ctx->Driver.BuildEltPipeline( ctx )) {
389 build_full_immediate_pipeline( ctx );
390 }
391
392 elt->pipeline_valid = 1;
393 tnl->CVA.orflag = 0;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000394
Keith Whitwell23caf202000-11-16 21:05:34 +0000395 if (MESA_VERBOSE&VERBOSE_PIPELINE)
Keith Whitwellad2ac212000-11-24 10:25:05 +0000396 _tnl_print_pipeline( ctx, elt );
Keith Whitwell23caf202000-11-16 21:05:34 +0000397}
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000398
Keith Whitwell23caf202000-11-16 21:05:34 +0000399#define INTERESTED ~0
400
Keith Whitwellad2ac212000-11-24 10:25:05 +0000401void _tnl_update_pipelines( GLcontext *ctx )
Keith Whitwell23caf202000-11-16 21:05:34 +0000402{
403 TNLcontext *tnl = TNL_CONTEXT(ctx);
404 GLuint newstate = ctx->NewState;
405 struct gl_cva *cva = &tnl->CVA;
406
407 newstate &= INTERESTED;
408
409 if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_STATE))
410 gl_print_enable_flags("enabled", ctx->_Enabled);
411
412 if (newstate ||
413 cva->lock_changed ||
414 cva->orflag != cva->last_orflag ||
415 tnl->_ArrayFlags != cva->last_array_flags)
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000416 {
Keith Whitwell23caf202000-11-16 21:05:34 +0000417 GLuint flags = VERT_WIN;
418
419 if (ctx->Visual.RGBAflag) {
420 flags |= VERT_RGBA;
421 if (ctx->_TriangleCaps && DD_SEPERATE_SPECULAR)
422 flags |= VERT_SPEC_RGB;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000423 } else
Keith Whitwell23caf202000-11-16 21:05:34 +0000424 flags |= VERT_INDEX;
425
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000426 if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
Keith Whitwell23caf202000-11-16 21:05:34 +0000427 flags |= VERT_TEX0_ANY;
428
429 if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
430 flags |= VERT_TEX1_ANY;
431
432#if MAX_TEXTURE_UNITS > 2
433 if (ctx->Texture._ReallyEnabled & TEXTURE2_ANY)
434 flags |= VERT_TEX2_ANY;
435#endif
436#if MAX_TEXTURE_UNITS > 3
437 if (ctx->Texture._ReallyEnabled & TEXTURE3_ANY)
438 flags |= VERT_TEX3_ANY;
439#endif
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000440
441 if (ctx->Polygon._Unfilled)
Keith Whitwell23caf202000-11-16 21:05:34 +0000442 flags |= VERT_EDGE;
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000443
Keith Whitwell23caf202000-11-16 21:05:34 +0000444 if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT)
445 flags |= VERT_FOG_COORD;
446
447 if (ctx->RenderMode==GL_FEEDBACK) {
448 flags = (VERT_WIN | VERT_RGBA | VERT_INDEX | VERT_NORM | VERT_EDGE
449 | VERT_TEX0_ANY
450 | VERT_TEX1_ANY
451#if MAX_TEXTURE_UNITS > 2
452 | VERT_TEX2_ANY
453#endif
454#if MAX_TEXTURE_UNITS > 3
455 | VERT_TEX3_ANY
456#endif
457 );
458 }
459
460 tnl->_RenderFlags = flags;
461
462 cva->elt.new_state |= newstate;
463 cva->elt.pipeline_valid = 0;
464
465 cva->pre.new_state |= newstate;
466 cva->pre.forbidden_inputs = 0;
467 cva->pre.pipeline_valid = 0;
468 cva->lock_changed = 0;
469 }
470
471 if (tnl->_ArrayNewState != cva->last_array_new_state)
472 cva->pre.pipeline_valid = 0;
473
474 cva->pre.data_valid = 0;
475 cva->last_array_new_state = tnl->_ArrayNewState;
476 cva->last_orflag = cva->orflag;
477 cva->last_array_flags = tnl->_ArrayFlags;
478}
479
Keith Whitwellad2ac212000-11-24 10:25:05 +0000480void _tnl_run_pipeline( struct vertex_buffer *VB )
Keith Whitwell23caf202000-11-16 21:05:34 +0000481{
482 struct gl_pipeline *pipe = VB->pipeline;
483 struct gl_pipeline_stage **stages = pipe->stages;
484 unsigned short x;
485
486 pipe->data_valid = 1; /* optimized stages might want to reset this. */
487
Keith Whitwellad2ac212000-11-24 10:25:05 +0000488 if (0) _tnl_print_pipeline( VB->ctx, pipe );
489
Keith Whitwell23caf202000-11-16 21:05:34 +0000490 START_FAST_MATH(x);
Jouk Jansen5e3bc0c2000-11-22 07:32:16 +0000491
492 for ( VB->Culled = 0; *stages && !VB->Culled ; stages++ )
Keith Whitwell23caf202000-11-16 21:05:34 +0000493 (*stages)->run( VB );
494
495 END_FAST_MATH(x);
496
497 pipe->new_state = 0;
498}
499