1af69d88dSmrgINTRODUCTION 2af69d88dSmrg 3af69d88dSmrgA helper module which provides glue to bind the software rasterizer to 4af69d88dSmrgthe software t&l module. The main task of this module is to build 5af69d88dSmrgswrast vertices from the t&l vertex_buffer structs, and to use them to 6af69d88dSmrgperform triangle setup functions not implemented in the software 7af69d88dSmrgrasterizer. 8af69d88dSmrg 9af69d88dSmrgThe module implements a full set of functions to plug into the 10af69d88dSmrgt_vb_render.c driver interface (tnl->Driver.Render.*). 11af69d88dSmrg 12af69d88dSmrgThere are strong advantages to decoupling the software rasterizer from 13af69d88dSmrgthe t&l module, primarily allowing hardware drivers better control 14af69d88dSmrgover fallbacks, the removal of implicit knowledge about the software 15af69d88dSmrgrasterizer in the t&l module, allowing the two modules to evolve 16af69d88dSmrgindependently and allowing either to be substituted with equivalent 17af69d88dSmrgfunctionality from another codebase. 18af69d88dSmrg 19af69d88dSmrgThis module implements triangle/quad setup for offset, unfilled and 20af69d88dSmrgtwoside-lit triangles. The software rasterizer doesn't handle these 21af69d88dSmrgprimitives directly. 22af69d88dSmrg 23af69d88dSmrgHardware rasterization drivers typically use this module in situations 24af69d88dSmrgwhere no hardware rasterization is possible, ie during total 25af69d88dSmrgfallbacks. 26af69d88dSmrg 27af69d88dSmrgSTATE 28af69d88dSmrg 29af69d88dSmrgTo create and destroy the module: 30af69d88dSmrg 31af69d88dSmrg GLboolean _swsetup_CreateContext( struct gl_context *ctx ); 32af69d88dSmrg void _swsetup_DestroyContext( struct gl_context *ctx ); 33af69d88dSmrg 34af69d88dSmrgThe module is not active by default, and must be installed by calling 35af69d88dSmrg_swrast_Wakeup(). This function installs internal swrast_setup 36af69d88dSmrgfunctions into all the tnl->Driver.Render driver hooks, thus taking 37af69d88dSmrgover the task of rasterization entirely: 38af69d88dSmrg 39af69d88dSmrg void _swrast_Wakeup( struct gl_context *ctx ); 40af69d88dSmrg 41af69d88dSmrg 42af69d88dSmrgThis module tracks state changes internally and maintains derived 43af69d88dSmrgvalues based on the current state. For this to work, the driver 44af69d88dSmrgensure the following funciton is called whenever the state changes and 45af69d88dSmrgthe swsetup module is 'awake': 46af69d88dSmrg 47af69d88dSmrg void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); 48af69d88dSmrg 49af69d88dSmrgThere is no explicit call to put the swsetup module to sleep. Simply 50af69d88dSmrginstall other function pointers into all the tnl->Driver.Render.* 51af69d88dSmrghooks, and (optionally) cease calling _swsetup_InvalidateState(). 52af69d88dSmrg 53af69d88dSmrgDRIVER INTERFACE 54af69d88dSmrg 55af69d88dSmrgThe module offers a minimal driver interface: 56af69d88dSmrg 57af69d88dSmrg void (*Start)( struct gl_context *ctx ); 58af69d88dSmrg void (*Finish)( struct gl_context *ctx ); 59af69d88dSmrg 60af69d88dSmrgThese are called before and after the completion of all swrast drawing 61af69d88dSmrgactivity. As swrast doesn't call callbacks during triangle, line or 62af69d88dSmrgpoint rasterization, these are necessary to provide locking hooks for 63af69d88dSmrgsome drivers. They may otherwise be left null. 64af69d88dSmrg 65af69d88dSmrg 66