1af69d88dSmrgINTRODUCTION
2af69d88dSmrg
3af69d88dSmrgA generic, configurable software implementation of GL transformation &
4af69d88dSmrglighting.
5af69d88dSmrg
6af69d88dSmrgThis module provides an implementation of the routines required by the
7af69d88dSmrg'vtxfmt' mechanism of core mesa for tnl functionality in all
8af69d88dSmrgcombinations of compile and execute modes.
9af69d88dSmrg
10af69d88dSmrgMost current drivers use the tnl module exclusively to provide this
11af69d88dSmrgfunctionality.
12af69d88dSmrg
13af69d88dSmrg
14af69d88dSmrgSTATE
15af69d88dSmrg
16af69d88dSmrgTo create and destroy the module:
17af69d88dSmrg
18af69d88dSmrg	GLboolean _tnl_CreateContext( struct gl_context *ctx );
19af69d88dSmrg	void _tnl_DestroyContext( struct gl_context *ctx );
20af69d88dSmrg
21af69d88dSmrgThe module is not active by default, and must be installed by calling
22af69d88dSmrg_tnl_Wakeup().  This function installs internal tnl functions into all
23af69d88dSmrgthe vtxfmt dispatch hooks, thus taking over the task of transformation
24af69d88dSmrgand lighting entirely:
25af69d88dSmrg
26af69d88dSmrg        void _tnl_wakeup_exec( struct gl_context *ctx );
27af69d88dSmrg	void _tnl_wakeup_save_exec( struct gl_context *ctx );
28af69d88dSmrg
29af69d88dSmrg   
30af69d88dSmrgThis module tracks state changes internally and maintains derived
31af69d88dSmrgvalues based on the current state.  For this to work, the driver
32af69d88dSmrgensure the following funciton is called whenever the state changes and
33af69d88dSmrgthe swsetup module is 'awake':
34af69d88dSmrg
35af69d88dSmrg	void _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state );
36af69d88dSmrg
37af69d88dSmrgThere is no explicit call to put the tnl module to sleep.  Simply
38af69d88dSmrginstall other function pointers into all the vtxfmt dispatch slots,
39af69d88dSmrgand (optionally) cease calling _tnl_InvalidateState().
40af69d88dSmrg
41af69d88dSmrgCUSTOMIZATION
42af69d88dSmrg
43af69d88dSmrgThe module provides customizability through several mechanisms.  The
44af69d88dSmrgmost important is by allowing drivers to specify the pipeline through
45af69d88dSmrgwhich vertex data is passed, including its eventual transfer to
46af69d88dSmrgrasterization hardware (or software).
47af69d88dSmrg
48af69d88dSmrgThe default pipeline is specified in t_pipeline.c, and is usually a
49af69d88dSmrgstarting point for driver pipelines.  Some drivers will remove a stage
50af69d88dSmrgwhere hardware provides support for the implemented operation (for
51af69d88dSmrginstance fog where per-pixel hardware fog is available),
52af69d88dSmrgor add stages to shortcircuit latter operations (for
53af69d88dSmrgexample taking advantage of hardware support for strips and other
54af69d88dSmrghigher-level primitives (for example the radeon driver).
55af69d88dSmrg
56af69d88dSmrgIn addition, the following functions provide further tweaks:
57af69d88dSmrg
58af69d88dSmrgextern void
59af69d88dSmrg_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
60af69d88dSmrg
61af69d88dSmrg	- Direct the default vertex transformation stage to
62af69d88dSmrg          produce/not produce projected clip coordinates.
63af69d88dSmrg	  
64af69d88dSmrgextern void
65af69d88dSmrg_tnl_need_dlist_loopback( struct gl_context *ctx, GLboolean flag );
66af69d88dSmrg      
67af69d88dSmrg        - Direct the display list component of the tnl module to
68af69d88dSmrg          replay display lists as 'glVertex' type calls, rather than
69af69d88dSmrg          passing the display list data directly into the tnl pipeline
70af69d88dSmrg          mechanism.  
71af69d88dSmrg
72af69d88dSmrg	  This allows display lists to be replayed by the tnl module
73af69d88dSmrg	  even when the module is not strictly active.
74af69d88dSmrg
75af69d88dSmrg
76af69d88dSmrgextern void
77af69d88dSmrg_tnl_need_dlist_norm_lengths( struct gl_context *ctx, GLboolean flag );
78af69d88dSmrg
79af69d88dSmrg	- Direct the display list component to enable/disable caching
80af69d88dSmrg          1/length values for display list normals.  Doing so is
81af69d88dSmrg          ususally helpful when lighting is performed in software, but
82af69d88dSmrg          wasteful otherwise.
83af69d88dSmrg
84af69d88dSmrg
85af69d88dSmrgDRIVER INTERFACE
86af69d88dSmrg
87af69d88dSmrgThe module itself offers a minimal driver interface:
88af69d88dSmrg
89af69d88dSmrg	 void (*RunPipeline)( struct gl_context *ctx );
90af69d88dSmrg
91af69d88dSmrgNormally this is set to _tnl_RunPipeline(), however the driver can use
92af69d88dSmrgthis hook to wrap checks or other code around this call. 
93af69d88dSmrg
94af69d88dSmrgIn addition, the driver interface for the default render pipeline
95af69d88dSmrgstage is housed in the tnl context struct (this could be cleaner).  
96af69d88dSmrg
97af69d88dSmrg
98af69d88dSmrgRENDER DRIVER INTERFACE
99af69d88dSmrg
100af69d88dSmrgSee t_context.h for the definition and explanation of this.