1848b8605SmrgINTRODUCTION
2848b8605Smrg
3848b8605SmrgA helper module which provides glue to bind the software rasterizer to
4848b8605Smrgthe software t&l module.  The main task of this module is to build
5848b8605Smrgswrast vertices from the t&l vertex_buffer structs, and to use them to
6848b8605Smrgperform triangle setup functions not implemented in the software
7848b8605Smrgrasterizer.
8848b8605Smrg
9848b8605SmrgThe module implements a full set of functions to plug into the
10848b8605Smrgt_vb_render.c driver interface (tnl->Driver.Render.*).  
11848b8605Smrg
12848b8605SmrgThere are strong advantages to decoupling the software rasterizer from
13848b8605Smrgthe t&l module, primarily allowing hardware drivers better control
14848b8605Smrgover fallbacks, the removal of implicit knowledge about the software
15848b8605Smrgrasterizer in the t&l module, allowing the two modules to evolve
16848b8605Smrgindependently and allowing either to be substituted with equivalent
17848b8605Smrgfunctionality from another codebase.
18848b8605Smrg
19848b8605SmrgThis module implements triangle/quad setup for offset, unfilled and
20848b8605Smrgtwoside-lit triangles.  The software rasterizer doesn't handle these
21848b8605Smrgprimitives directly.
22848b8605Smrg
23848b8605SmrgHardware rasterization drivers typically use this module in situations
24848b8605Smrgwhere no hardware rasterization is possible, ie during total
25848b8605Smrgfallbacks. 
26848b8605Smrg
27848b8605SmrgSTATE
28848b8605Smrg
29848b8605SmrgTo create and destroy the module:
30848b8605Smrg
31848b8605Smrg	GLboolean _swsetup_CreateContext( struct gl_context *ctx );
32848b8605Smrg	void _swsetup_DestroyContext( struct gl_context *ctx );
33848b8605Smrg
34848b8605SmrgThe module is not active by default, and must be installed by calling
35848b8605Smrg_swrast_Wakeup().  This function installs internal swrast_setup
36848b8605Smrgfunctions into all the tnl->Driver.Render driver hooks, thus taking
37848b8605Smrgover the task of rasterization entirely:
38848b8605Smrg
39848b8605Smrg        void _swrast_Wakeup( struct gl_context *ctx );
40848b8605Smrg
41848b8605Smrg   
42848b8605SmrgThis module tracks state changes internally and maintains derived
43848b8605Smrgvalues based on the current state.  For this to work, the driver
44848b8605Smrgensure the following funciton is called whenever the state changes and
45848b8605Smrgthe swsetup module is 'awake':
46848b8605Smrg
47848b8605Smrg	void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state );
48848b8605Smrg
49848b8605SmrgThere is no explicit call to put the swsetup module to sleep.  Simply
50848b8605Smrginstall other function pointers into all the tnl->Driver.Render.*
51848b8605Smrghooks, and (optionally) cease calling _swsetup_InvalidateState().
52848b8605Smrg
53848b8605SmrgDRIVER INTERFACE
54848b8605Smrg
55848b8605SmrgThe module offers a minimal driver interface:
56848b8605Smrg
57848b8605Smrg	 void (*Start)( struct gl_context *ctx );
58848b8605Smrg	 void (*Finish)( struct gl_context *ctx );
59848b8605Smrg	 
60848b8605SmrgThese are called before and after the completion of all swrast drawing
61848b8605Smrgactivity.  As swrast doesn't call callbacks during triangle, line or
62848b8605Smrgpoint rasterization, these are necessary to provide locking hooks for
63848b8605Smrgsome drivers.  They may otherwise be left null.
64848b8605Smrg
65848b8605Smrg
66