2 * mesa 3-D graphics library
5 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
27 * \brief TnL module datatypes and definitions.
28 * \author Keith Whitwell
33 * \mainpage The TNL-module
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.
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.
46 * The initial vertex_buffer data may either come from an ::immediate
47 * structure or client vertex_arrays or display lists:
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
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.
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.
78 #include "math/m_matrix.h"
79 #include "math/m_vector.h"
80 #include "math/m_xform.h"
83 #define MAX_PIPELINE_STAGES 30
86 * Note: The first attributes match the VERT_ATTRIB_* definitions
87 * in mtypes.h. However, the tnl module has additional attributes
88 * for materials, color indexes, edge flags, etc.
90 /* Although it's nice to use these as bit indexes in a DWORD flag, we
91 * could manage without if necessary. Another limit currently is the
92 * number of bits allocated for these numbers in places like vertex
93 * program instruction formats and register layouts.
97 _TNL_ATTRIB_WEIGHT
= 1,
98 _TNL_ATTRIB_NORMAL
= 2,
99 _TNL_ATTRIB_COLOR0
= 3,
100 _TNL_ATTRIB_COLOR1
= 4,
103 _TNL_ATTRIB_SEVEN
= 7,
104 _TNL_ATTRIB_TEX0
= 8,
105 _TNL_ATTRIB_TEX1
= 9,
106 _TNL_ATTRIB_TEX2
= 10,
107 _TNL_ATTRIB_TEX3
= 11,
108 _TNL_ATTRIB_TEX4
= 12,
109 _TNL_ATTRIB_TEX5
= 13,
110 _TNL_ATTRIB_TEX6
= 14,
111 _TNL_ATTRIB_TEX7
= 15,
112 _TNL_ATTRIB_MAT_FRONT_AMBIENT
= 16,
113 _TNL_ATTRIB_MAT_BACK_AMBIENT
= 17,
114 _TNL_ATTRIB_MAT_FRONT_DIFFUSE
= 18,
115 _TNL_ATTRIB_MAT_BACK_DIFFUSE
= 19,
116 _TNL_ATTRIB_MAT_FRONT_SPECULAR
= 20,
117 _TNL_ATTRIB_MAT_BACK_SPECULAR
= 21,
118 _TNL_ATTRIB_MAT_FRONT_EMISSION
= 22,
119 _TNL_ATTRIB_MAT_BACK_EMISSION
= 23,
120 _TNL_ATTRIB_MAT_FRONT_SHININESS
= 24,
121 _TNL_ATTRIB_MAT_BACK_SHININESS
= 25,
122 _TNL_ATTRIB_MAT_FRONT_INDEXES
= 26,
123 _TNL_ATTRIB_MAT_BACK_INDEXES
= 27,
124 _TNL_ATTRIB_INDEX
= 28,
125 _TNL_ATTRIB_EDGEFLAG
= 29,
126 _TNL_ATTRIB_POINTSIZE
= 30,
130 /* Will probably have to revise this scheme fairly shortly, eg. by
131 * compacting all the MAT flags down to one bit, or by using two
132 * dwords to store the flags.
134 #define _TNL_BIT_POS (1<<0)
135 #define _TNL_BIT_WEIGHT (1<<1)
136 #define _TNL_BIT_NORMAL (1<<2)
137 #define _TNL_BIT_COLOR0 (1<<3)
138 #define _TNL_BIT_COLOR1 (1<<4)
139 #define _TNL_BIT_FOG (1<<5)
140 #define _TNL_BIT_SIX (1<<6)
141 #define _TNL_BIT_SEVEN (1<<7)
142 #define _TNL_BIT_TEX0 (1<<8)
143 #define _TNL_BIT_TEX1 (1<<9)
144 #define _TNL_BIT_TEX2 (1<<10)
145 #define _TNL_BIT_TEX3 (1<<11)
146 #define _TNL_BIT_TEX4 (1<<12)
147 #define _TNL_BIT_TEX5 (1<<13)
148 #define _TNL_BIT_TEX6 (1<<14)
149 #define _TNL_BIT_TEX7 (1<<15)
150 #define _TNL_BIT_MAT_FRONT_AMBIENT (1<<16)
151 #define _TNL_BIT_MAT_BACK_AMBIENT (1<<17)
152 #define _TNL_BIT_MAT_FRONT_DIFFUSE (1<<18)
153 #define _TNL_BIT_MAT_BACK_DIFFUSE (1<<19)
154 #define _TNL_BIT_MAT_FRONT_SPECULAR (1<<20)
155 #define _TNL_BIT_MAT_BACK_SPECULAR (1<<21)
156 #define _TNL_BIT_MAT_FRONT_EMISSION (1<<22)
157 #define _TNL_BIT_MAT_BACK_EMISSION (1<<23)
158 #define _TNL_BIT_MAT_FRONT_SHININESS (1<<24)
159 #define _TNL_BIT_MAT_BACK_SHININESS (1<<25)
160 #define _TNL_BIT_MAT_FRONT_INDEXES (1<<26)
161 #define _TNL_BIT_MAT_BACK_INDEXES (1<<27)
162 #define _TNL_BIT_INDEX (1<<28)
163 #define _TNL_BIT_EDGEFLAG (1<<29)
164 #define _TNL_BIT_POINTSIZE (1<<30)
166 #define _TNL_BIT_TEX(u) (1 << (_TNL_ATTRIB_TEX0 + (u)))
170 #define _TNL_BITS_MAT_ANY (_TNL_BIT_MAT_FRONT_AMBIENT | \
171 _TNL_BIT_MAT_BACK_AMBIENT | \
172 _TNL_BIT_MAT_FRONT_DIFFUSE | \
173 _TNL_BIT_MAT_BACK_DIFFUSE | \
174 _TNL_BIT_MAT_FRONT_SPECULAR | \
175 _TNL_BIT_MAT_BACK_SPECULAR | \
176 _TNL_BIT_MAT_FRONT_EMISSION | \
177 _TNL_BIT_MAT_BACK_EMISSION | \
178 _TNL_BIT_MAT_FRONT_SHININESS | \
179 _TNL_BIT_MAT_BACK_SHININESS | \
180 _TNL_BIT_MAT_FRONT_INDEXES | \
181 _TNL_BIT_MAT_BACK_INDEXES)
184 #define _TNL_BITS_TEX_ANY (_TNL_BIT_TEX0 | \
194 #define _TNL_BITS_PROG_ANY (_TNL_BIT_POS | \
206 #define PRIM_BEGIN 0x10
207 #define PRIM_END 0x20
208 #define PRIM_WEAK 0x40
209 #define PRIM_MODE_MASK 0x0f
221 struct tnl_eval1_map
{
222 struct gl_1d_map
*map
;
226 struct tnl_eval2_map
{
227 struct gl_2d_map
*map
;
233 struct tnl_eval1_map map1
[_TNL_ATTRIB_INDEX
+ 1];
234 struct tnl_eval2_map map2
[_TNL_ATTRIB_INDEX
+ 1];
238 #define TNL_MAX_PRIM 16
239 #define TNL_MAX_COPIED_VERTS 3
241 struct tnl_copied_vtx
{
242 GLfloat buffer
[_TNL_ATTRIB_MAX
* 4 * TNL_MAX_COPIED_VERTS
];
246 #define VERT_BUFFER_SIZE 2048 /* 8kbytes */
249 typedef void (*tnl_attrfv_func
)( const GLfloat
* );
252 struct _tnl_dynfn
*next
, *prev
;
257 struct _tnl_dynfn_lists
{
258 struct _tnl_dynfn Vertex
[4];
259 struct _tnl_dynfn Attribute
[4];
262 struct _tnl_dynfn_generators
{
263 struct _tnl_dynfn
*(*Vertex
[4])( GLcontext
*ctx
, int key
);
264 struct _tnl_dynfn
*(*Attribute
[4])( GLcontext
*ctx
, int key
);
267 #define _TNL_MAX_ATTR_CODEGEN 16
270 /* The assembly of vertices in immediate mode is separated from
271 * display list compilation. This allows a simpler immediate mode
272 * treatment and a display list compiler better suited to
273 * hardware-acceleration.
276 GLfloat buffer
[VERT_BUFFER_SIZE
];
277 GLubyte attrsz
[_TNL_ATTRIB_MAX
];
279 struct tnl_prim prim
[TNL_MAX_PRIM
];
281 GLfloat
*vbptr
; /* cursor, points into buffer */
282 GLfloat vertex
[_TNL_ATTRIB_MAX
*4]; /* current vertex */
283 GLfloat
*attrptr
[_TNL_ATTRIB_MAX
]; /* points into vertex */
284 GLfloat
*current
[_TNL_ATTRIB_MAX
]; /* points into ctx->Current, etc */
285 GLuint counter
, initial_counter
;
286 struct tnl_copied_vtx copied
;
288 tnl_attrfv_func tabfv
[_TNL_MAX_ATTR_CODEGEN
+1][4]; /* plus 1 for ERROR_ATTRIB */
290 struct _tnl_dynfn_lists cache
;
291 struct _tnl_dynfn_generators gen
;
293 struct tnl_eval eval
;
294 GLboolean
*edgeflag_tmp
;
295 GLboolean have_materials
;
301 /* For display lists, this structure holds a run of vertices of the
302 * same format, and a strictly well-formed set of begin/end pairs,
303 * starting on the first vertex and ending at the last. Vertex
304 * copying on buffer breaks is precomputed according to these
305 * primitives, though there are situations where the copying will need
306 * correction at execute-time, perhaps by replaying the list as
307 * immediate mode commands.
309 * On executing this list, the 'current' values may be updated with
310 * the values of the final vertex, and often no fixup of the start of
311 * the vertex list is required.
313 * Eval and other commands that don't fit into these vertex lists are
314 * compiled using the fallback opcode mechanism provided by dlist.c.
316 struct tnl_vertex_list
{
317 GLubyte attrsz
[_TNL_ATTRIB_MAX
];
322 GLuint wrap_count
; /* number of copied vertices at start */
323 GLboolean have_materials
; /* bit of a hack - quick check for materials */
324 GLboolean dangling_attr_ref
; /* current attr implicitly referenced
327 GLfloat
*normal_lengths
;
328 struct tnl_prim
*prim
;
331 struct tnl_vertex_store
*vertex_store
;
332 struct tnl_primitive_store
*prim_store
;
335 /* These buffers should be a reasonable size to support upload to
336 * hardware? Maybe drivers should stitch them back together, or
337 * specify a desired size?
339 #define SAVE_BUFFER_SIZE (16*1024)
340 #define SAVE_PRIM_SIZE 128
342 /* Storage to be shared among several vertex_lists.
344 struct tnl_vertex_store
{
345 GLfloat buffer
[SAVE_BUFFER_SIZE
];
350 struct tnl_primitive_store
{
351 struct tnl_prim buffer
[SAVE_PRIM_SIZE
];
358 GLubyte attrsz
[_TNL_ATTRIB_MAX
];
366 struct tnl_prim
*prim
;
367 GLuint prim_count
, prim_max
;
369 struct tnl_vertex_store
*vertex_store
;
370 struct tnl_primitive_store
*prim_store
;
372 GLfloat
*vbptr
; /* cursor, points into buffer */
373 GLfloat vertex
[_TNL_ATTRIB_MAX
*4]; /* current values */
374 GLfloat
*attrptr
[_TNL_ATTRIB_MAX
];
375 GLuint counter
, initial_counter
;
376 GLboolean dangling_attr_ref
;
377 GLboolean have_materials
;
379 GLuint opcode_vertex_list
;
381 struct tnl_copied_vtx copied
;
383 GLfloat
*current
[_TNL_ATTRIB_MAX
]; /* points into ctx->ListState */
384 GLubyte
*currentsz
[_TNL_ATTRIB_MAX
];
386 void (*tabfv
[_TNL_ATTRIB_MAX
][4])( const GLfloat
* );
390 struct tnl_vertex_arrays
392 /* Conventional vertex attribute arrays */
396 GLvector4f SecondaryColor
;
398 GLvector4f TexCoord
[MAX_TEXTURE_COORD_UNITS
];
404 /* These attributes don't alias with the conventional attributes.
405 * The GL_NV_vertex_program extension defines 16 extra sets of vertex
406 * arrays which have precedent over the conventional arrays when enabled.
408 GLvector4f Attribs
[_TNL_ATTRIB_MAX
];
413 * Contains the current state of a running pipeline.
417 /* Constant over life of the vertex_buffer.
421 /* Constant over the pipeline.
423 GLuint Count
; /* for everything except Elts */
425 /* Pointers to current data.
428 GLvector4f
*ObjPtr
; /* _TNL_BIT_POS */
429 GLvector4f
*EyePtr
; /* _TNL_BIT_POS */
430 GLvector4f
*ClipPtr
; /* _TNL_BIT_POS */
431 GLvector4f
*NdcPtr
; /* _TNL_BIT_POS */
432 GLubyte ClipOrMask
; /* _TNL_BIT_POS */
433 GLubyte ClipAndMask
; /* _TNL_BIT_POS */
434 GLubyte
*ClipMask
; /* _TNL_BIT_POS */
435 GLvector4f
*NormalPtr
; /* _TNL_BIT_NORMAL */
436 GLfloat
*NormalLengthPtr
; /* _TNL_BIT_NORMAL */
437 GLboolean
*EdgeFlag
; /* _TNL_BIT_EDGEFLAG */
438 GLvector4f
*TexCoordPtr
[MAX_TEXTURE_COORD_UNITS
]; /* VERT_TEX_0..n */
439 GLvector4f
*IndexPtr
[2]; /* _TNL_BIT_INDEX */
440 GLvector4f
*ColorPtr
[2]; /* _TNL_BIT_COLOR0 */
441 GLvector4f
*SecondaryColorPtr
[2]; /* _TNL_BIT_COLOR1 */
442 GLvector4f
*PointSizePtr
; /* _TNL_BIT_POS */
443 GLvector4f
*FogCoordPtr
; /* _TNL_BIT_FOG */
445 struct tnl_prim
*Primitive
;
446 GLuint PrimitiveCount
;
448 /* Inputs to the vertex program stage */
449 GLvector4f
*AttribPtr
[_TNL_ATTRIB_MAX
]; /* GL_NV_vertex_program */
452 /* Private data from _tnl_render_stage that has no business being
458 /** Describes an individual operation on the pipeline.
460 struct tnl_pipeline_stage
464 /* Private data for the pipeline stage:
468 /* Allocate private data
470 GLboolean (*create
)( GLcontext
*ctx
, struct tnl_pipeline_stage
* );
472 /* Free private data.
474 void (*destroy
)( struct tnl_pipeline_stage
* );
476 /* Called on any statechange or input array size change or
477 * input array change to/from zero stride.
479 void (*validate
)( GLcontext
*ctx
, struct tnl_pipeline_stage
* );
481 /* Called from _tnl_run_pipeline(). The stage.changed_inputs value
482 * encodes all inputs to thee struct which have changed. If
483 * non-zero, recompute all affected outputs of the stage, otherwise
484 * execute any 'sideeffects' of the stage.
486 * Return value: GL_TRUE - keep going
487 * GL_FALSE - finished pipeline
489 GLboolean (*run
)( GLcontext
*ctx
, struct tnl_pipeline_stage
* );
494 /** Contains the array of all pipeline stages.
495 * The default values are defined at the end of t_pipeline.c
497 struct tnl_pipeline
{
499 GLuint last_attrib_stride
[_TNL_ATTRIB_MAX
];
500 GLuint last_attrib_size
[_TNL_ATTRIB_MAX
];
501 GLuint input_changes
;
504 struct tnl_pipeline_stage stages
[MAX_PIPELINE_STAGES
+1];
508 struct tnl_clipspace
;
509 struct tnl_clipspace_attr
;
511 typedef void (*tnl_extract_func
)( const struct tnl_clipspace_attr
*a
,
515 typedef void (*tnl_insert_func
)( const struct tnl_clipspace_attr
*a
,
519 typedef void (*tnl_emit_func
)( GLcontext
*ctx
,
525 * Describes how to convert/move a vertex attribute from a vertex array
526 * to a vertex structure.
528 struct tnl_clipspace_attr
530 GLuint attrib
; /* which vertex attrib (0=position, etc) */
532 GLuint vertoffset
; /* position of the attrib in the vertex struct */
533 GLuint vertattrsize
; /* size of the attribute in bytes */
536 const tnl_insert_func
*insert
;
537 tnl_insert_func emit
;
538 tnl_extract_func extract
;
539 const GLfloat
*vp
; /* NDC->Viewport mapping matrix */
543 struct tnl_clipspace_codegen
{
544 GLboolean (*emit_header
)( struct tnl_clipspace_codegen
*,
545 struct tnl_clipspace
*);
546 GLboolean (*emit_footer
)( struct tnl_clipspace_codegen
* );
547 GLboolean (*emit_attr_header
)( struct tnl_clipspace_codegen
*,
548 struct tnl_clipspace_attr
*,
549 GLint j
, GLenum out_type
,
551 GLboolean (*emit_attr_footer
)( struct tnl_clipspace_codegen
* );
552 GLboolean (*emit_mov
)( struct tnl_clipspace_codegen
*,
554 GLboolean (*emit_const
)( struct tnl_clipspace_codegen
*,
556 GLboolean (*emit_mad
)( struct tnl_clipspace_codegen
*,
557 GLint
, GLint
, GLint
, GLint
);
558 GLboolean (*emit_float_to_chan
)( struct tnl_clipspace_codegen
*,
560 GLboolean (*emit_const_chan
)( struct tnl_clipspace_codegen
*,
562 GLboolean (*emit_float_to_ubyte
)( struct tnl_clipspace_codegen
*,
564 GLboolean (*emit_const_ubyte
)( struct tnl_clipspace_codegen
*,
566 tnl_emit_func (*emit_store_func
)( struct tnl_clipspace_codegen
* );
568 struct _tnl_dynfn codegen_list
;
578 typedef void (*tnl_points_func
)( GLcontext
*ctx
, GLuint first
, GLuint last
);
579 typedef void (*tnl_line_func
)( GLcontext
*ctx
, GLuint v1
, GLuint v2
);
580 typedef void (*tnl_triangle_func
)( GLcontext
*ctx
,
581 GLuint v1
, GLuint v2
, GLuint v3
);
582 typedef void (*tnl_quad_func
)( GLcontext
*ctx
, GLuint v1
, GLuint v2
,
583 GLuint v3
, GLuint v4
);
584 typedef void (*tnl_render_func
)( GLcontext
*ctx
, GLuint start
, GLuint count
,
586 typedef void (*tnl_interp_func
)( GLcontext
*ctx
,
587 GLfloat t
, GLuint dst
, GLuint out
, GLuint in
,
588 GLboolean force_boundary
);
589 typedef void (*tnl_copy_pv_func
)( GLcontext
*ctx
, GLuint dst
, GLuint src
);
590 typedef void (*tnl_setup_func
)( GLcontext
*ctx
,
591 GLuint start
, GLuint end
,
596 * Used to describe conversion of vertex arrays to vertex structures.
597 * I.e. Structure of arrays to arrays of structs.
601 GLboolean need_extras
;
607 GLuint max_vertex_size
;
609 struct tnl_clipspace_attr attr
[_TNL_ATTRIB_MAX
];
613 tnl_interp_func interp
;
614 tnl_copy_pv_func copy_pv
;
616 struct tnl_clipspace_codegen codegen
;
620 struct tnl_device_driver
626 void (*RunPipeline
)(GLcontext
*ctx
);
627 /* Replaces PipelineStart/PipelineFinish -- intended to allow
628 * drivers to wrap _tnl_run_pipeline() with code to validate state
629 * and grab/release hardware locks.
632 void (*NotifyMaterialChange
)(GLcontext
*ctx
);
633 /* Alert tnl-aware drivers of changes to material.
636 GLboolean (*NotifyBegin
)(GLcontext
*ctx
, GLenum p
);
637 /* Allow drivers to hook in optimized begin/end engines.
638 * Return value: GL_TRUE - driver handled the begin
639 * GL_FALSE - driver didn't handle the begin
643 *** Rendering -- These functions called only from t_vb_render.c
647 void (*Start
)(GLcontext
*ctx
);
648 void (*Finish
)(GLcontext
*ctx
);
649 /* Called before and after all rendering operations, including DrawPixels,
650 * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
651 * These are a suitable place for grabbing/releasing hardware locks.
654 void (*PrimitiveNotify
)(GLcontext
*ctx
, GLenum mode
);
655 /* Called between RenderStart() and RenderFinish() to indicate the
656 * type of primitive we're about to draw. Mode will be one of the
657 * modes accepted by glBegin().
660 tnl_interp_func Interp
;
661 /* The interp function is called by the clipping routines when we need
662 * to generate an interpolated vertex. All pertinant vertex ancilliary
663 * data should be computed by interpolating between the 'in' and 'out'
667 tnl_copy_pv_func CopyPV
;
668 /* The copy function is used to make a copy of a vertex. All pertinant
669 * vertex attributes should be copied.
672 void (*ClippedPolygon
)( GLcontext
*ctx
, const GLuint
*elts
, GLuint n
);
673 /* Render a polygon with <n> vertices whose indexes are in the <elts>
677 void (*ClippedLine
)( GLcontext
*ctx
, GLuint v0
, GLuint v1
);
678 /* Render a line between the two vertices given by indexes v0 and v1. */
680 tnl_points_func Points
; /* must now respect vb->elts */
682 tnl_triangle_func Triangle
;
684 /* These functions are called in order to render points, lines,
685 * triangles and quads. These are only called via the T&L module.
688 tnl_render_func
*PrimTabVerts
;
689 tnl_render_func
*PrimTabElts
;
690 /* Render whole unclipped primitives (points, lines, linestrips,
691 * lineloops, etc). The tables are indexed by the GL enum of the
692 * primitive to be rendered. RenderTabVerts is used for non-indexed
693 * arrays of vertices. RenderTabElts is used for indexed arrays of
697 void (*ResetLineStipple
)( GLcontext
*ctx
);
698 /* Reset the hardware's line stipple counter.
701 tnl_setup_func BuildVertices
;
702 /* This function is called whenever new vertices are required for
703 * rendering. The vertices in question are those n such that start
704 * <= n < end. The new_inputs parameter indicates those fields of
705 * the vertex which need to be updated, if only a partial repair of
706 * the vertex is required.
708 * This function is called only from _tnl_render_stage in tnl/t_render.c.
712 GLboolean (*Multipass
)( GLcontext
*ctx
, GLuint passno
);
713 /* Driver may request additional render passes by returning GL_TRUE
714 * when this function is called. This function will be called
715 * after the first pass, and passes will be made until the function
716 * returns GL_FALSE. If no function is registered, only one pass
719 * This function will be first invoked with passno == 1.
726 * Context state for T&L context.
732 struct tnl_device_driver Driver
;
740 struct tnl_save save
;
744 struct tnl_pipeline pipeline
;
745 struct vertex_buffer vb
;
747 /* GLvectors for binding to vb:
749 struct tnl_vertex_arrays vtx_inputs
;
750 struct tnl_vertex_arrays save_inputs
;
751 struct tnl_vertex_arrays current
;
752 struct tnl_vertex_arrays array_inputs
;
754 /* Clipspace/ndc/window vertex managment:
756 struct tnl_clipspace clipspace
;
758 /* Probably need a better configuration mechanism:
760 GLboolean NeedNdcCoords
;
761 GLboolean LoopbackDListCassettes
;
762 GLboolean CalcDListNormalLengths
;
763 GLboolean IsolateMaterials
;
764 GLboolean AllowVertexFog
;
765 GLboolean AllowPixelFog
;
766 GLboolean AllowCodegen
;
768 GLboolean _DoVertexFog
; /* eval fog function at each vertex? */
770 GLuint render_inputs
;
772 GLvertexformat exec_vtxfmt
;
773 GLvertexformat save_vtxfmt
;
779 #define TNL_CONTEXT(ctx) ((TNLcontext *)((ctx)->swtnl_context))
782 #define TYPE_IDX(t) ((t) & 0xf)
783 #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */
785 extern void _tnl_MakeCurrent( GLcontext
*ctx
,
786 GLframebuffer
*drawBuffer
,
787 GLframebuffer
*readBuffer
);