Fix TCL_LIGHT_MODEL_CTL setting in radeonColorMaterial.
[mesa.git] / src / mesa / tnl / t_context.h
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
25 /**
26 * \file t_context.h
27 * \brief TnL module datatypes and definitions.
28 * \author Keith Whitwell
29 */
30
31
32 /**
33 * \mainpage The TNL-module
34 *
35 * TNL stands for "transform and lighting", i.e. this module implements
36 * a pipeline that receives as input a buffer of vertices and does all
37 * necessary transformations (rotations, clipping, vertex shader etc.)
38 * and passes then the output to the rasterizer.
39 *
40 * The tnl_pipeline contains the array of all stages, which should be
41 * applied. Each stage is a black-box, which is described by an
42 * tnl_pipeline_stage. The function ::_tnl_run_pipeline applies all the
43 * stages to the vertex_buffer TNLcontext::vb, where the vertex data
44 * is stored. The last stage in the pipeline is the rasterizer.
45 *
46 * The initial vertex_buffer data may either come from an ::immediate
47 * structure or client vertex_arrays or display lists:
48 *
49 *
50 * - The ::immediate structure records all the GL commands issued between
51 * glBegin and glEnd. \n
52 * The structure accumulates data, until it is either full or it is
53 * flushed (usually by a state change). Before starting then the pipeline,
54 * the collected vertex data in ::immediate has to be pushed into
55 * TNLcontext::vb.
56 * This happens in ::_tnl_vb_bind_immediate. The pipeline is then run by
57 * calling tnl_device_driver::RunPipeline = ::_tnl_run_pipeline, which
58 * is stored in TNLcontext::Driver. \n
59 * An ::immediate does (for performance reasons) usually not finish with a
60 * glEnd, and hence it also does not need to start with a glBegin.
61 * This means that the last vertices of one ::immediate may need to be
62 * saved for the next one.
63 *
64 *
65 * - NOT SURE ABOUT THIS: The vertex_arrays structure is used to handle
66 * glDrawArrays etc. \n
67 * Here, the data of the vertex_arrays is copied by ::_tnl_vb_bind_arrays
68 * into TNLcontext::vb, so that the pipeline can be started.
69 */
70
71
72 #ifndef _T_CONTEXT_H
73 #define _T_CONTEXT_H
74
75 #include "glheader.h"
76 #include "mtypes.h"
77
78 #include "math/m_matrix.h"
79 #include "math/m_vector.h"
80 #include "math/m_xform.h"
81
82
83 #define MAX_PIPELINE_STAGES 30
84
85
86 enum {
87 _TNL_ATTRIB_POS = 0,
88 _TNL_ATTRIB_WEIGHT = 1,
89 _TNL_ATTRIB_NORMAL = 2,
90 _TNL_ATTRIB_COLOR0 = 3,
91 _TNL_ATTRIB_COLOR1 = 4,
92 _TNL_ATTRIB_FOG = 5,
93 _TNL_ATTRIB_SIX = 6,
94 _TNL_ATTRIB_SEVEN = 7,
95 _TNL_ATTRIB_TEX0 = 8,
96 _TNL_ATTRIB_TEX1 = 9,
97 _TNL_ATTRIB_TEX2 = 10,
98 _TNL_ATTRIB_TEX3 = 11,
99 _TNL_ATTRIB_TEX4 = 12,
100 _TNL_ATTRIB_TEX5 = 13,
101 _TNL_ATTRIB_TEX6 = 14,
102 _TNL_ATTRIB_TEX7 = 15,
103 _TNL_ATTRIB_MAT_FRONT_AMBIENT = 16,
104 _TNL_ATTRIB_MAT_BACK_AMBIENT = 17,
105 _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18,
106 _TNL_ATTRIB_MAT_BACK_DIFFUSE = 19,
107 _TNL_ATTRIB_MAT_FRONT_SPECULAR = 20,
108 _TNL_ATTRIB_MAT_BACK_SPECULAR = 21,
109 _TNL_ATTRIB_MAT_FRONT_EMISSION = 22,
110 _TNL_ATTRIB_MAT_BACK_EMISSION = 23,
111 _TNL_ATTRIB_MAT_FRONT_SHININESS = 24,
112 _TNL_ATTRIB_MAT_BACK_SHININESS = 25,
113 _TNL_ATTRIB_MAT_FRONT_INDEXES = 26,
114 _TNL_ATTRIB_MAT_BACK_INDEXES = 27,
115 _TNL_ATTRIB_INDEX = 28,
116 _TNL_ATTRIB_EDGEFLAG = 29,
117 _TNL_ATTRIB_MAX = 30
118 } ;
119
120 /* Will probably have to revise this scheme fairly shortly, eg. by
121 * compacting all the MAT flags down to one bit, or by using two
122 * dwords to store the flags.
123 */
124 #define _TNL_BIT_POS (1<<0)
125 #define _TNL_BIT_WEIGHT (1<<1)
126 #define _TNL_BIT_NORMAL (1<<2)
127 #define _TNL_BIT_COLOR0 (1<<3)
128 #define _TNL_BIT_COLOR1 (1<<4)
129 #define _TNL_BIT_FOG (1<<5)
130 #define _TNL_BIT_SIX (1<<6)
131 #define _TNL_BIT_SEVEN (1<<7)
132 #define _TNL_BIT_TEX0 (1<<8)
133 #define _TNL_BIT_TEX1 (1<<9)
134 #define _TNL_BIT_TEX2 (1<<10)
135 #define _TNL_BIT_TEX3 (1<<11)
136 #define _TNL_BIT_TEX4 (1<<12)
137 #define _TNL_BIT_TEX5 (1<<13)
138 #define _TNL_BIT_TEX6 (1<<14)
139 #define _TNL_BIT_TEX7 (1<<15)
140 #define _TNL_BIT_MAT_FRONT_AMBIENT (1<<16)
141 #define _TNL_BIT_MAT_BACK_AMBIENT (1<<17)
142 #define _TNL_BIT_MAT_FRONT_DIFFUSE (1<<18)
143 #define _TNL_BIT_MAT_BACK_DIFFUSE (1<<19)
144 #define _TNL_BIT_MAT_FRONT_SPECULAR (1<<20)
145 #define _TNL_BIT_MAT_BACK_SPECULAR (1<<21)
146 #define _TNL_BIT_MAT_FRONT_EMISSION (1<<22)
147 #define _TNL_BIT_MAT_BACK_EMISSION (1<<23)
148 #define _TNL_BIT_MAT_FRONT_SHININESS (1<<24)
149 #define _TNL_BIT_MAT_BACK_SHININESS (1<<25)
150 #define _TNL_BIT_MAT_FRONT_INDEXES (1<<26)
151 #define _TNL_BIT_MAT_BACK_INDEXES (1<<27)
152 #define _TNL_BIT_INDEX (1<<28)
153 #define _TNL_BIT_EDGEFLAG (1<<29)
154
155 #define _TNL_BIT_TEX(u) (1 << (_TNL_ATTRIB_TEX0 + (u)))
156
157
158 #define _TNL_BITS_MAT_ANY (_TNL_BIT_MAT_FRONT_AMBIENT | \
159 _TNL_BIT_MAT_BACK_AMBIENT | \
160 _TNL_BIT_MAT_FRONT_DIFFUSE | \
161 _TNL_BIT_MAT_BACK_DIFFUSE | \
162 _TNL_BIT_MAT_FRONT_SPECULAR | \
163 _TNL_BIT_MAT_BACK_SPECULAR | \
164 _TNL_BIT_MAT_FRONT_EMISSION | \
165 _TNL_BIT_MAT_BACK_EMISSION | \
166 _TNL_BIT_MAT_FRONT_SHININESS | \
167 _TNL_BIT_MAT_BACK_SHININESS | \
168 _TNL_BIT_MAT_FRONT_INDEXES | \
169 _TNL_BIT_MAT_BACK_INDEXES)
170
171
172 #define _TNL_BITS_TEX_ANY (_TNL_BIT_TEX0 | \
173 _TNL_BIT_TEX1 | \
174 _TNL_BIT_TEX2 | \
175 _TNL_BIT_TEX3 | \
176 _TNL_BIT_TEX4 | \
177 _TNL_BIT_TEX5 | \
178 _TNL_BIT_TEX6 | \
179 _TNL_BIT_TEX7)
180
181
182 #define _TNL_BITS_PROG_ANY (_TNL_BIT_POS | \
183 _TNL_BIT_WEIGHT | \
184 _TNL_BIT_NORMAL | \
185 _TNL_BIT_COLOR0 | \
186 _TNL_BIT_COLOR1 | \
187 _TNL_BIT_FOG | \
188 _TNL_BIT_SIX | \
189 _TNL_BIT_SEVEN | \
190 _TNL_BITS_TEX_ANY)
191
192
193
194 #define PRIM_BEGIN 0x10
195 #define PRIM_END 0x20
196 #define PRIM_WEAK 0x40
197 #define PRIM_MODE_MASK 0x0f
198
199 /*
200 */
201 struct tnl_prim {
202 GLuint mode;
203 GLuint start;
204 GLuint count;
205 };
206
207
208
209 struct tnl_eval1_map {
210 struct gl_1d_map *map;
211 GLuint sz;
212 };
213
214 struct tnl_eval2_map {
215 struct gl_2d_map *map;
216 GLuint sz;
217 };
218
219 struct tnl_eval {
220 GLuint new_state;
221 struct tnl_eval1_map map1[_TNL_ATTRIB_INDEX + 1];
222 struct tnl_eval2_map map2[_TNL_ATTRIB_INDEX + 1];
223 };
224
225
226 #define TNL_MAX_PRIM 16
227 #define TNL_MAX_COPIED_VERTS 3
228
229 struct tnl_copied_vtx {
230 GLfloat buffer[_TNL_ATTRIB_MAX * 4 * TNL_MAX_COPIED_VERTS];
231 GLuint nr;
232 };
233
234 #define VERT_BUFFER_SIZE 2048 /* 8kbytes */
235
236 typedef void (*attrfv_func)( const GLfloat * );
237
238 /* The assembly of vertices in immediate mode is separated from
239 * display list compilation. This allows a simpler immediate mode
240 * treatment and a display list compiler better suited to
241 * hardware-acceleration.
242 */
243 struct tnl_vtx {
244 GLfloat buffer[VERT_BUFFER_SIZE];
245 GLubyte attrsz[_TNL_ATTRIB_MAX];
246 GLuint vertex_size;
247 struct tnl_prim prim[TNL_MAX_PRIM];
248 GLuint prim_count;
249 GLfloat *vbptr; /* cursor, points into buffer */
250 GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current vertex */
251 GLfloat *attrptr[_TNL_ATTRIB_MAX]; /* points into vertex */
252 GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->Current, etc */
253 GLuint counter, initial_counter;
254 struct tnl_copied_vtx copied;
255 attrfv_func tabfv[_TNL_ATTRIB_MAX][4];
256 struct tnl_eval eval;
257 GLboolean *edgeflag_tmp;
258 GLboolean have_materials;
259 };
260
261
262
263
264 /* For display lists, this structure holds a run of vertices of the
265 * same format, and a strictly well-formed set of begin/end pairs,
266 * starting on the first vertex and ending at the last. Vertex
267 * copying on buffer breaks is precomputed according to these
268 * primitives, though there are situations where the copying will need
269 * correction at execute-time, perhaps by replaying the list as
270 * immediate mode commands.
271 *
272 * On executing this list, the 'current' values may be updated with
273 * the values of the final vertex, and often no fixup of the start of
274 * the vertex list is required.
275 *
276 * Eval and other commands that don't fit into these vertex lists are
277 * compiled using the fallback opcode mechanism provided by dlist.c.
278 */
279 struct tnl_vertex_list {
280 GLubyte attrsz[_TNL_ATTRIB_MAX];
281 GLuint vertex_size;
282
283 GLfloat *buffer;
284 GLuint count;
285 GLuint wrap_count; /* number of copied vertices at start */
286 GLboolean have_materials; /* bit of a hack - quick check for materials */
287 GLboolean dangling_attr_ref; /* current attr implicitly referenced
288 outside the list */
289
290 GLfloat *normal_lengths;
291 struct tnl_prim *prim;
292 GLuint prim_count;
293
294 struct tnl_vertex_store *vertex_store;
295 struct tnl_primitive_store *prim_store;
296 };
297
298 /* These buffers should be a reasonable size to support upload to
299 * hardware? Maybe drivers should stitch them back together, or
300 * specify a desired size?
301 */
302 #define SAVE_BUFFER_SIZE (16*1024)
303 #define SAVE_PRIM_SIZE 128
304
305 /* Storage to be shared among several vertex_lists.
306 */
307 struct tnl_vertex_store {
308 GLfloat buffer[SAVE_BUFFER_SIZE];
309 GLuint used;
310 GLuint refcount;
311 };
312
313 struct tnl_primitive_store {
314 struct tnl_prim buffer[SAVE_PRIM_SIZE];
315 GLuint used;
316 GLuint refcount;
317 };
318
319
320 struct tnl_save {
321 GLubyte attrsz[_TNL_ATTRIB_MAX];
322 GLuint vertex_size;
323
324 GLfloat *buffer;
325 GLuint count;
326 GLuint wrap_count;
327
328 struct tnl_prim *prim;
329 GLuint prim_count, prim_max;
330
331 struct tnl_vertex_store *vertex_store;
332 struct tnl_primitive_store *prim_store;
333
334 GLfloat *vbptr; /* cursor, points into buffer */
335 GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current values */
336 GLfloat *attrptr[_TNL_ATTRIB_MAX];
337 GLuint counter, initial_counter;
338 GLboolean dangling_attr_ref;
339 GLboolean have_materials;
340
341 GLuint opcode_vertex_list;
342
343 struct tnl_copied_vtx copied;
344
345 GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->ListState */
346 GLubyte *currentsz[_TNL_ATTRIB_MAX];
347
348 void (*tabfv[_TNL_ATTRIB_MAX][4])( const GLfloat * );
349 };
350
351
352
353
354
355
356
357 struct tnl_vertex_arrays
358 {
359 /* Conventional vertex attribute arrays */
360 GLvector4f Obj;
361 GLvector4f Normal;
362 GLvector4f Color;
363 GLvector4f SecondaryColor;
364 GLvector4f FogCoord;
365 GLvector4f TexCoord[MAX_TEXTURE_COORD_UNITS];
366 GLvector4f Index;
367
368 GLubyte *EdgeFlag;
369 GLuint *Elt;
370
371 /* These attributes don't alias with the conventional attributes.
372 * The GL_NV_vertex_program extension defines 16 extra sets of vertex
373 * arrays which have precedent over the conventional arrays when enabled.
374 */
375 GLvector4f Attribs[_TNL_ATTRIB_MAX];
376 };
377
378
379 /**
380 * Contains the current state of a running pipeline.
381 */
382 struct vertex_buffer
383 {
384 /* Constant over life of the vertex_buffer.
385 */
386 GLuint Size;
387
388 /* Constant over the pipeline.
389 */
390 GLuint Count; /* for everything except Elts */
391
392 /* Pointers to current data.
393 */
394 GLuint *Elts;
395 GLvector4f *ObjPtr; /* _TNL_BIT_POS */
396 GLvector4f *EyePtr; /* _TNL_BIT_POS */
397 GLvector4f *ClipPtr; /* _TNL_BIT_POS */
398 GLvector4f *NdcPtr; /* _TNL_BIT_POS */
399 GLubyte ClipOrMask; /* _TNL_BIT_POS */
400 GLubyte *ClipMask; /* _TNL_BIT_POS */
401 GLvector4f *NormalPtr; /* _TNL_BIT_NORMAL */
402 GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */
403 GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */
404 GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */
405 GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */
406 GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */
407 GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */
408 GLvector4f *PointSizePtr; /* _TNL_BIT_POS */
409 GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */
410
411 struct tnl_prim *Primitive;
412 GLuint PrimitiveCount;
413
414 /* Inputs to the vertex program stage */
415 GLvector4f *AttribPtr[_TNL_ATTRIB_MAX]; /* GL_NV_vertex_program */
416
417 GLuint LastClipped;
418 /* Private data from _tnl_render_stage that has no business being
419 * in this struct.
420 */
421
422 };
423
424
425
426 /** Describes an individual operation on the pipeline.
427 */
428 struct tnl_pipeline_stage {
429 const char *name;
430 GLuint check_state; /* All state referenced in check() --
431 * When is the pipeline_stage struct
432 * itself invalidated? Must be
433 * constant.
434 */
435
436 /* Usually constant or set by the 'check' callback:
437 */
438 GLuint run_state; /* All state referenced in run() --
439 * When is the cached output of the
440 * stage invalidated?
441 */
442
443 GLboolean active; /* True if runnable in current state */
444 GLuint inputs; /* VERT_* inputs to the stage */
445 GLuint outputs; /* VERT_* outputs of the stage */
446
447 /* Set in _tnl_run_pipeline():
448 */
449 GLuint changed_inputs; /* Generated value -- inputs to the
450 * stage that have changed since last
451 * call to 'run'.
452 */
453
454 /* Private data for the pipeline stage:
455 */
456 void *privatePtr;
457
458 /* Free private data. May not be null.
459 */
460 void (*destroy)( struct tnl_pipeline_stage * );
461
462 /* Called from _tnl_validate_pipeline(). Must update all fields in
463 * the pipeline_stage struct for the current state.
464 */
465 void (*check)( GLcontext *ctx, struct tnl_pipeline_stage * );
466
467 /* Called from _tnl_run_pipeline(). The stage.changed_inputs value
468 * encodes all inputs to thee struct which have changed. If
469 * non-zero, recompute all affected outputs of the stage, otherwise
470 * execute any 'sideeffects' of the stage.
471 *
472 * Return value: GL_TRUE - keep going
473 * GL_FALSE - finished pipeline
474 */
475 GLboolean (*run)( GLcontext *ctx, struct tnl_pipeline_stage * );
476 };
477
478 /** Contains the array of all pipeline stages.
479 * The default values are defined at the end of t_pipeline.c */
480 struct tnl_pipeline {
481 GLuint build_state_trigger; /**< state changes which require build */
482 GLuint build_state_changes; /**< state changes since last build */
483 GLuint run_state_changes; /**< state changes since last run */
484 GLuint run_input_changes; /**< VERT_* changes since last run */
485 GLuint inputs; /**< VERT_* inputs to pipeline */
486 /** This array has to end with a NULL-pointer. */
487 struct tnl_pipeline_stage stages[MAX_PIPELINE_STAGES+1];
488 GLuint nr_stages;
489 };
490
491
492
493
494 typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
495 typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
496 typedef void (*triangle_func)( GLcontext *ctx,
497 GLuint v1, GLuint v2, GLuint v3 );
498 typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
499 GLuint v3, GLuint v4 );
500 typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
501 GLuint flags );
502 typedef void (*interp_func)( GLcontext *ctx,
503 GLfloat t, GLuint dst, GLuint out, GLuint in,
504 GLboolean force_boundary );
505 typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
506 typedef void (*setup_func)( GLcontext *ctx,
507 GLuint start, GLuint end,
508 GLuint new_inputs);
509
510
511 struct tnl_device_driver {
512 /***
513 *** TNL Pipeline
514 ***/
515
516 void (*RunPipeline)(GLcontext *ctx);
517 /* Replaces PipelineStart/PipelineFinish -- intended to allow
518 * drivers to wrap _tnl_run_pipeline() with code to validate state
519 * and grab/release hardware locks.
520 */
521
522 void (*NotifyMaterialChange)(GLcontext *ctx);
523 /* Alert tnl-aware drivers of changes to material.
524 */
525
526 GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p);
527 /* Allow drivers to hook in optimized begin/end engines.
528 * Return value: GL_TRUE - driver handled the begin
529 * GL_FALSE - driver didn't handle the begin
530 */
531
532 /***
533 *** Rendering -- These functions called only from t_vb_render.c
534 ***/
535 struct {
536 void (*Start)(GLcontext *ctx);
537 void (*Finish)(GLcontext *ctx);
538 /* Called before and after all rendering operations, including DrawPixels,
539 * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
540 * These are a suitable place for grabbing/releasing hardware locks.
541 */
542
543 void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode);
544 /* Called between RenderStart() and RenderFinish() to indicate the
545 * type of primitive we're about to draw. Mode will be one of the
546 * modes accepted by glBegin().
547 */
548
549 interp_func Interp;
550 /* The interp function is called by the clipping routines when we need
551 * to generate an interpolated vertex. All pertinant vertex ancilliary
552 * data should be computed by interpolating between the 'in' and 'out'
553 * vertices.
554 */
555
556 copy_pv_func CopyPV;
557 /* The copy function is used to make a copy of a vertex. All pertinant
558 * vertex attributes should be copied.
559 */
560
561 void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
562 /* Render a polygon with <n> vertices whose indexes are in the <elts>
563 * array.
564 */
565
566 void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
567 /* Render a line between the two vertices given by indexes v0 and v1. */
568
569 points_func Points; /* must now respect vb->elts */
570 line_func Line;
571 triangle_func Triangle;
572 quad_func Quad;
573 /* These functions are called in order to render points, lines,
574 * triangles and quads. These are only called via the T&L module.
575 */
576
577 render_func *PrimTabVerts;
578 render_func *PrimTabElts;
579 /* Render whole unclipped primitives (points, lines, linestrips,
580 * lineloops, etc). The tables are indexed by the GL enum of the
581 * primitive to be rendered. RenderTabVerts is used for non-indexed
582 * arrays of vertices. RenderTabElts is used for indexed arrays of
583 * vertices.
584 */
585
586 void (*ResetLineStipple)( GLcontext *ctx );
587 /* Reset the hardware's line stipple counter.
588 */
589
590 setup_func BuildVertices;
591 /* This function is called whenever new vertices are required for
592 * rendering. The vertices in question are those n such that start
593 * <= n < end. The new_inputs parameter indicates those fields of
594 * the vertex which need to be updated, if only a partial repair of
595 * the vertex is required.
596 *
597 * This function is called only from _tnl_render_stage in tnl/t_render.c.
598 */
599
600
601 GLboolean (*Multipass)( GLcontext *ctx, GLuint passno );
602 /* Driver may request additional render passes by returning GL_TRUE
603 * when this function is called. This function will be called
604 * after the first pass, and passes will be made until the function
605 * returns GL_FALSE. If no function is registered, only one pass
606 * is made.
607 *
608 * This function will be first invoked with passno == 1.
609 */
610 } Render;
611 };
612
613
614 typedef struct {
615
616 /* Driver interface.
617 */
618 struct tnl_device_driver Driver;
619
620 /* Execute:
621 */
622 struct tnl_vtx vtx;
623
624 /* Compile:
625 */
626 struct tnl_save save;
627
628 /* Pipeline
629 */
630 struct tnl_pipeline pipeline;
631 struct vertex_buffer vb;
632
633 /* GLvectors for binding to vb:
634 */
635 struct tnl_vertex_arrays vtx_inputs;
636 struct tnl_vertex_arrays save_inputs;
637 struct tnl_vertex_arrays current;
638 struct tnl_vertex_arrays array_inputs;
639
640
641 /* Probably need a better configuration mechanism:
642 */
643 GLboolean NeedNdcCoords;
644 GLboolean LoopbackDListCassettes;
645 GLboolean CalcDListNormalLengths;
646 GLboolean IsolateMaterials;
647
648
649 GLvertexformat exec_vtxfmt;
650 GLvertexformat save_vtxfmt;
651
652 } TNLcontext;
653
654
655
656 #define TNL_CONTEXT(ctx) ((TNLcontext *)(ctx->swtnl_context))
657
658
659 #define TYPE_IDX(t) ((t) & 0xf)
660 #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */
661
662 extern void _tnl_MakeCurrent( GLcontext *ctx,
663 GLframebuffer *drawBuffer,
664 GLframebuffer *readBuffer );
665
666
667
668
669 #endif