Re-commit t_vertex.[ch] changes to fd.o server.
[mesa.git] / src / mesa / tnl / t_vb_texgen.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 5.1
4 *
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 * Brian Paul
26 * Keith Whitwell <keith@tungstengraphics.com>
27 */
28
29
30 #include "glheader.h"
31 #include "colormac.h"
32 #include "context.h"
33 #include "macros.h"
34 #include "imports.h"
35 #include "mtypes.h"
36
37 #include "math/m_xform.h"
38
39 #include "t_context.h"
40 #include "t_pipeline.h"
41
42
43 /***********************************************************************
44 * Automatic texture coordinate generation (texgen) code.
45 */
46
47
48 struct texgen_stage_data;
49
50 typedef void (*texgen_func)( GLcontext *ctx,
51 struct texgen_stage_data *store,
52 GLuint unit);
53
54
55 struct texgen_stage_data {
56
57 /* Per-texunit derived state.
58 */
59 GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS];
60 GLuint TexgenHoles[MAX_TEXTURE_COORD_UNITS];
61 texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS];
62
63 /* Temporary values used in texgen.
64 */
65 GLfloat (*tmp_f)[3];
66 GLfloat *tmp_m;
67
68 /* Buffered outputs of the stage.
69 */
70 GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS];
71 };
72
73
74 #define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->privatePtr)
75
76
77
78 static GLuint all_bits[5] = {
79 0,
80 VEC_SIZE_1,
81 VEC_SIZE_2,
82 VEC_SIZE_3,
83 VEC_SIZE_4,
84 };
85
86 #define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4)
87
88 #define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP)
89 #define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \
90 TEXGEN_REFLECTION_MAP_NV)
91
92
93
94 static void build_m3( GLfloat f[][3], GLfloat m[],
95 const GLvector4f *normal,
96 const GLvector4f *eye )
97 {
98 GLuint stride = eye->stride;
99 GLfloat *coord = (GLfloat *)eye->start;
100 GLuint count = eye->count;
101 const GLfloat *norm = normal->start;
102 GLuint i;
103
104 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(norm,normal->stride)) {
105 GLfloat u[3], two_nu, fx, fy, fz;
106 COPY_3V( u, coord );
107 NORMALIZE_3FV( u );
108 two_nu = 2.0F * DOT3(norm,u);
109 fx = f[i][0] = u[0] - norm[0] * two_nu;
110 fy = f[i][1] = u[1] - norm[1] * two_nu;
111 fz = f[i][2] = u[2] - norm[2] * two_nu;
112 m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
113 if (m[i] != 0.0F) {
114 m[i] = 0.5F * _mesa_inv_sqrtf(m[i]);
115 }
116 }
117 }
118
119
120
121 static void build_m2( GLfloat f[][3], GLfloat m[],
122 const GLvector4f *normal,
123 const GLvector4f *eye )
124 {
125 GLuint stride = eye->stride;
126 GLfloat *coord = eye->start;
127 GLuint count = eye->count;
128
129 GLfloat *norm = normal->start;
130 GLuint i;
131
132 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(norm,normal->stride)) {
133 GLfloat u[3], two_nu, fx, fy, fz;
134 COPY_2V( u, coord );
135 u[2] = 0;
136 NORMALIZE_3FV( u );
137 two_nu = 2.0F * DOT3(norm,u);
138 fx = f[i][0] = u[0] - norm[0] * two_nu;
139 fy = f[i][1] = u[1] - norm[1] * two_nu;
140 fz = f[i][2] = u[2] - norm[2] * two_nu;
141 m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
142 if (m[i] != 0.0F) {
143 m[i] = 0.5F * _mesa_inv_sqrtf(m[i]);
144 }
145 }
146 }
147
148
149
150 typedef void (*build_m_func)( GLfloat f[][3],
151 GLfloat m[],
152 const GLvector4f *normal,
153 const GLvector4f *eye );
154
155
156 static build_m_func build_m_tab[5] = {
157 0,
158 0,
159 build_m2,
160 build_m3,
161 build_m3
162 };
163
164
165 /* This is unusual in that we respect the stride of the output vector
166 * (f). This allows us to pass in either a texcoord vector4f, or a
167 * temporary vector3f.
168 */
169 static void build_f3( GLfloat *f,
170 GLuint fstride,
171 const GLvector4f *normal,
172 const GLvector4f *eye )
173 {
174 GLuint stride = eye->stride;
175 GLfloat *coord = eye->start;
176 GLuint count = eye->count;
177
178 GLfloat *norm = normal->start;
179 GLuint i;
180
181 for (i=0;i<count;i++) {
182 GLfloat u[3], two_nu;
183 COPY_3V( u, coord );
184 NORMALIZE_3FV( u );
185 two_nu = 2.0F * DOT3(norm,u);
186 f[0] = u[0] - norm[0] * two_nu;
187 f[1] = u[1] - norm[1] * two_nu;
188 f[2] = u[2] - norm[2] * two_nu;
189 STRIDE_F(coord,stride);
190 STRIDE_F(f,fstride);
191 STRIDE_F(norm, normal->stride);
192 }
193 }
194
195
196 static void build_f2( GLfloat *f,
197 GLuint fstride,
198 const GLvector4f *normal,
199 const GLvector4f *eye )
200 {
201 GLuint stride = eye->stride;
202 GLfloat *coord = eye->start;
203 GLuint count = eye->count;
204 GLfloat *norm = normal->start;
205 GLuint i;
206
207 for (i=0;i<count;i++) {
208
209 GLfloat u[3], two_nu;
210 COPY_2V( u, coord );
211 u[2] = 0;
212 NORMALIZE_3FV( u );
213 two_nu = 2.0F * DOT3(norm,u);
214 f[0] = u[0] - norm[0] * two_nu;
215 f[1] = u[1] - norm[1] * two_nu;
216 f[2] = u[2] - norm[2] * two_nu;
217
218 STRIDE_F(coord,stride);
219 STRIDE_F(f,fstride);
220 STRIDE_F(norm, normal->stride);
221 }
222 }
223
224 typedef void (*build_f_func)( GLfloat *f,
225 GLuint fstride,
226 const GLvector4f *normal_vec,
227 const GLvector4f *eye );
228
229
230
231 /* Just treat 4-vectors as 3-vectors.
232 */
233 static build_f_func build_f_tab[5] = {
234 0,
235 0,
236 build_f2,
237 build_f3,
238 build_f3
239 };
240
241
242 /* Special case texgen functions.
243 */
244 static void texgen_reflection_map_nv( GLcontext *ctx,
245 struct texgen_stage_data *store,
246 GLuint unit )
247 {
248 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
249 GLvector4f *in = VB->TexCoordPtr[unit];
250 GLvector4f *out = &store->texcoord[unit];
251
252 build_f_tab[VB->EyePtr->size]( out->start,
253 out->stride,
254 VB->NormalPtr,
255 VB->EyePtr );
256
257 if (in) {
258 out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
259 out->count = in->count;
260 out->size = MAX2(in->size, 3);
261 if (in->size == 4)
262 _mesa_copy_tab[0x8]( out, in );
263 }
264 else {
265 out->flags |= VEC_SIZE_3;
266 out->size = 3;
267 out->count = in->count;
268 }
269
270 }
271
272
273
274 static void texgen_normal_map_nv( GLcontext *ctx,
275 struct texgen_stage_data *store,
276 GLuint unit )
277 {
278 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
279 GLvector4f *in = VB->TexCoordPtr[unit];
280 GLvector4f *out = &store->texcoord[unit];
281 GLvector4f *normal = VB->NormalPtr;
282 GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start;
283 GLuint count = VB->Count;
284 GLuint i;
285 const GLfloat *norm = normal->start;
286
287 for (i=0;i<count;i++, STRIDE_F(norm, normal->stride)) {
288 texcoord[i][0] = norm[0];
289 texcoord[i][1] = norm[1];
290 texcoord[i][2] = norm[2];
291 }
292
293
294 if (in) {
295 out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3;
296 out->count = in->count;
297 out->size = MAX2(in->size, 3);
298 if (in->size == 4)
299 _mesa_copy_tab[0x8]( out, in );
300 }
301 else {
302 out->flags |= VEC_SIZE_3;
303 out->size = 3;
304 out->count = in->count;
305 }
306 }
307
308
309 static void texgen_sphere_map( GLcontext *ctx,
310 struct texgen_stage_data *store,
311 GLuint unit )
312 {
313 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
314 GLvector4f *in = VB->TexCoordPtr[unit];
315 GLvector4f *out = &store->texcoord[unit];
316 GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start;
317 GLuint count = VB->Count;
318 GLuint i;
319 GLfloat (*f)[3] = store->tmp_f;
320 GLfloat *m = store->tmp_m;
321
322 (build_m_tab[VB->EyePtr->size])( store->tmp_f,
323 store->tmp_m,
324 VB->NormalPtr,
325 VB->EyePtr );
326
327 for (i=0;i<count;i++) {
328 texcoord[i][0] = f[i][0] * m[i] + 0.5F;
329 texcoord[i][1] = f[i][1] * m[i] + 0.5F;
330 }
331
332 if (in) {
333 out->size = MAX2(in->size,2);
334 out->count = in->count;
335 out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2;
336 if (in->size > 2)
337 _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in );
338 } else {
339 out->size = 2;
340 out->flags |= VEC_SIZE_2;
341 out->count = in->count;
342 }
343 }
344
345
346
347 static void texgen( GLcontext *ctx,
348 struct texgen_stage_data *store,
349 GLuint unit )
350 {
351 TNLcontext *tnl = TNL_CONTEXT(ctx);
352 struct vertex_buffer *VB = &tnl->vb;
353 GLvector4f *in = VB->TexCoordPtr[unit];
354 GLvector4f *out = &store->texcoord[unit];
355 const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
356 const GLvector4f *obj = VB->ObjPtr;
357 const GLvector4f *eye = VB->EyePtr;
358 const GLvector4f *normal = VB->NormalPtr;
359 const GLfloat *m = store->tmp_m;
360 const GLuint count = VB->Count;
361 GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data;
362 GLfloat (*f)[3] = store->tmp_f;
363 GLuint holes = 0;
364
365 if (texUnit->_GenFlags & TEXGEN_NEED_M) {
366 build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye );
367 } else if (texUnit->_GenFlags & TEXGEN_NEED_F) {
368 build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye );
369 }
370
371 if (!in) {
372 ASSERT(0);
373 in = out;
374 in->count = VB->Count;
375
376 out->size = store->TexgenSize[unit];
377 out->flags |= texUnit->TexGenEnabled;
378 out->count = VB->Count;
379 holes = store->TexgenHoles[unit];
380 }
381 else {
382 GLuint copy = (all_bits[in->size] & ~texUnit->TexGenEnabled);
383 if (copy)
384 _mesa_copy_tab[copy]( out, in );
385
386 out->size = MAX2(in->size, store->TexgenSize[unit]);
387 out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled;
388 out->count = in->count;
389
390 holes = ~all_bits[in->size] & store->TexgenHoles[unit];
391 }
392
393 if (holes) {
394 if (holes & VEC_DIRTY_3) _mesa_vector4f_clean_elem(out, count, 3);
395 if (holes & VEC_DIRTY_2) _mesa_vector4f_clean_elem(out, count, 2);
396 if (holes & VEC_DIRTY_1) _mesa_vector4f_clean_elem(out, count, 1);
397 if (holes & VEC_DIRTY_0) _mesa_vector4f_clean_elem(out, count, 0);
398 }
399
400 if (texUnit->TexGenEnabled & S_BIT) {
401 GLuint i;
402 switch (texUnit->GenModeS) {
403 case GL_OBJECT_LINEAR:
404 _mesa_dotprod_tab[obj->size]( (GLfloat *)out->data,
405 sizeof(out->data[0]), obj,
406 texUnit->ObjectPlaneS );
407 break;
408 case GL_EYE_LINEAR:
409 _mesa_dotprod_tab[eye->size]( (GLfloat *)out->data,
410 sizeof(out->data[0]), eye,
411 texUnit->EyePlaneS );
412 break;
413 case GL_SPHERE_MAP:
414 for (i = 0; i < count; i++)
415 texcoord[i][0] = f[i][0] * m[i] + 0.5F;
416 break;
417 case GL_REFLECTION_MAP_NV:
418 for (i=0;i<count;i++)
419 texcoord[i][0] = f[i][0];
420 break;
421 case GL_NORMAL_MAP_NV: {
422 const GLfloat *norm = normal->start;
423 for (i=0;i<count;i++, STRIDE_F(norm, normal->stride)) {
424 texcoord[i][0] = norm[0];
425 }
426 break;
427 }
428 default:
429 _mesa_problem(ctx, "Bad S texgen");
430 }
431 }
432
433 if (texUnit->TexGenEnabled & T_BIT) {
434 GLuint i;
435 switch (texUnit->GenModeT) {
436 case GL_OBJECT_LINEAR:
437 _mesa_dotprod_tab[obj->size]( &(out->data[0][1]),
438 sizeof(out->data[0]), obj,
439 texUnit->ObjectPlaneT );
440 break;
441 case GL_EYE_LINEAR:
442 _mesa_dotprod_tab[eye->size]( &(out->data[0][1]),
443 sizeof(out->data[0]), eye,
444 texUnit->EyePlaneT );
445 break;
446 case GL_SPHERE_MAP:
447 for (i = 0; i < count; i++)
448 texcoord[i][1] = f[i][1] * m[i] + 0.5F;
449 break;
450 case GL_REFLECTION_MAP_NV:
451 for (i=0;i<count;i++)
452 texcoord[i][1] = f[i][1];
453 break;
454 case GL_NORMAL_MAP_NV: {
455 const GLfloat *norm = normal->start;
456 for (i=0;i<count;i++, STRIDE_F(norm, normal->stride)) {
457 texcoord[i][1] = norm[1];
458 }
459 break;
460 }
461 default:
462 _mesa_problem(ctx, "Bad T texgen");
463 }
464 }
465
466 if (texUnit->TexGenEnabled & R_BIT) {
467 GLuint i;
468 switch (texUnit->GenModeR) {
469 case GL_OBJECT_LINEAR:
470 _mesa_dotprod_tab[obj->size]( &(out->data[0][2]),
471 sizeof(out->data[0]), obj,
472 texUnit->ObjectPlaneR );
473 break;
474 case GL_EYE_LINEAR:
475 _mesa_dotprod_tab[eye->size]( &(out->data[0][2]),
476 sizeof(out->data[0]), eye,
477 texUnit->EyePlaneR );
478 break;
479 case GL_REFLECTION_MAP_NV:
480 for (i=0;i<count;i++)
481 texcoord[i][2] = f[i][2];
482 break;
483 case GL_NORMAL_MAP_NV: {
484 const GLfloat *norm = normal->start;
485 for (i=0;i<count;i++,STRIDE_F(norm, normal->stride)) {
486 texcoord[i][2] = norm[2];
487 }
488 break;
489 }
490 default:
491 _mesa_problem(ctx, "Bad R texgen");
492 }
493 }
494
495 if (texUnit->TexGenEnabled & Q_BIT) {
496 switch (texUnit->GenModeQ) {
497 case GL_OBJECT_LINEAR:
498 _mesa_dotprod_tab[obj->size]( &(out->data[0][3]),
499 sizeof(out->data[0]), obj,
500 texUnit->ObjectPlaneQ );
501 break;
502 case GL_EYE_LINEAR:
503 _mesa_dotprod_tab[eye->size]( &(out->data[0][3]),
504 sizeof(out->data[0]), eye,
505 texUnit->EyePlaneQ );
506 break;
507 default:
508 _mesa_problem(ctx, "Bad Q texgen");
509 }
510 }
511 }
512
513
514
515 static GLboolean run_texgen_stage( GLcontext *ctx,
516 struct tnl_pipeline_stage *stage )
517 {
518 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
519 struct texgen_stage_data *store = TEXGEN_STAGE_DATA( stage );
520 GLuint i;
521
522 for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
523 if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) {
524 if (stage->changed_inputs & (_TNL_BIT_POS | _TNL_BIT_NORMAL | _TNL_BIT_TEX(i)))
525 store->TexgenFunc[i]( ctx, store, i );
526
527 VB->AttribPtr[VERT_ATTRIB_TEX0+i] =
528 VB->TexCoordPtr[i] = &store->texcoord[i];
529 }
530
531 return GL_TRUE;
532 }
533
534
535
536
537 static GLboolean run_validate_texgen_stage( GLcontext *ctx,
538 struct tnl_pipeline_stage *stage )
539 {
540 struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage);
541 GLuint i;
542
543 for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
544 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
545
546 if (texUnit->TexGenEnabled) {
547 GLuint sz;
548
549 if (texUnit->TexGenEnabled & Q_BIT)
550 sz = 4;
551 else if (texUnit->TexGenEnabled & R_BIT)
552 sz = 3;
553 else if (texUnit->TexGenEnabled & T_BIT)
554 sz = 2;
555 else
556 sz = 1;
557
558 store->TexgenSize[i] = sz;
559 store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled);
560 store->TexgenFunc[i] = texgen; /* general solution */
561
562 /* look for special texgen cases */
563 if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) {
564 if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) {
565 store->TexgenFunc[i] = texgen_reflection_map_nv;
566 }
567 else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) {
568 store->TexgenFunc[i] = texgen_normal_map_nv;
569 }
570 }
571 else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) &&
572 texUnit->_GenFlags == TEXGEN_SPHERE_MAP) {
573 store->TexgenFunc[i] = texgen_sphere_map;
574 }
575 }
576 }
577
578 stage->run = run_texgen_stage;
579 return stage->run( ctx, stage );
580 }
581
582
583 static void check_texgen( GLcontext *ctx, struct tnl_pipeline_stage *stage )
584 {
585 GLuint i;
586 stage->active = 0;
587
588 if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) {
589 GLuint inputs = 0;
590 GLuint outputs = 0;
591
592 if (ctx->Texture._GenFlags & (TEXGEN_OBJ_LINEAR | TEXGEN_NEED_EYE_COORD))
593 inputs |= _TNL_BIT_POS;
594
595 if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS)
596 inputs |= _TNL_BIT_NORMAL;
597
598 for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
599 if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i))
600 {
601 outputs |= _TNL_BIT_TEX(i);
602
603 /* Need the original input in case it contains a Q coord:
604 * (sigh)
605 */
606 inputs |= _TNL_BIT_TEX(i);
607
608 /* Something for Feedback? */
609 }
610
611 if (stage->privatePtr)
612 stage->run = run_validate_texgen_stage;
613 stage->active = 1;
614 stage->inputs = inputs;
615 stage->outputs = outputs;
616 }
617 }
618
619
620
621
622 /* Called the first time stage->run() is invoked.
623 */
624 static GLboolean alloc_texgen_data( GLcontext *ctx,
625 struct tnl_pipeline_stage *stage )
626 {
627 struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
628 struct texgen_stage_data *store;
629 GLuint i;
630
631 stage->privatePtr = CALLOC(sizeof(*store));
632 store = TEXGEN_STAGE_DATA(stage);
633 if (!store)
634 return GL_FALSE;
635
636 for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
637 _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 );
638
639 store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3);
640 store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat));
641
642 /* Now validate and run the stage.
643 */
644 stage->run = run_validate_texgen_stage;
645 return stage->run( ctx, stage );
646 }
647
648
649 static void free_texgen_data( struct tnl_pipeline_stage *stage )
650
651 {
652 struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage);
653 GLuint i;
654
655 if (store) {
656 for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++)
657 if (store->texcoord[i].data)
658 _mesa_vector4f_free( &store->texcoord[i] );
659
660
661 if (store->tmp_f) FREE( store->tmp_f );
662 if (store->tmp_m) FREE( store->tmp_m );
663 FREE( store );
664 stage->privatePtr = NULL;
665 }
666 }
667
668
669
670 const struct tnl_pipeline_stage _tnl_texgen_stage =
671 {
672 "texgen", /* name */
673 _NEW_TEXTURE, /* when to call check() */
674 _NEW_TEXTURE, /* when to invalidate stored data */
675 GL_FALSE, /* active? */
676 0, /* inputs */
677 0, /* outputs */
678 0, /* changed_inputs */
679 NULL, /* private data */
680 free_texgen_data, /* destructor */
681 check_texgen, /* check */
682 alloc_texgen_data /* run -- initially set to alloc data */
683 };