1af69d88dSmrgINTRODUCTION 2af69d88dSmrg 3af69d88dSmrgMesa's native software rasterizer. This module provides the fallback 4af69d88dSmrgpaths for rasterization operations and states that aren't accelerated 5af69d88dSmrgin hardware drivers, and as the full rasterization engine in software 6af69d88dSmrgdrivers. 7af69d88dSmrg 8af69d88dSmrgThe swrast module 'stands alone', relying only on interfaces to core 9af69d88dSmrgmesa and it's own driver interface. It knows nothing about the tnl or 10af69d88dSmrgother modules, allowing it to be used for fallback paths in future tnl 11af69d88dSmrgschemes without modification. 12af69d88dSmrg 13af69d88dSmrgAs well as providing triangle/line/point rasterization functionality, 14af69d88dSmrgthe module provides implementations of the pixel operations 15af69d88dSmrg(ReadPixels, etc), and texture operations (CopyTexSubImage) which may 16af69d88dSmrgbe plugged in to the core Mesa driver interface where accelerated 17af69d88dSmrgversions of these operations are unavailable. 18af69d88dSmrg 19af69d88dSmrg 20af69d88dSmrgSTATE 21af69d88dSmrg 22af69d88dSmrgTo create and destroy the module: 23af69d88dSmrg 24af69d88dSmrg GLboolean _swrast_CreateContext( struct gl_context *ctx ); 25af69d88dSmrg void _swrast_DestroyContext( struct gl_context *ctx ); 26af69d88dSmrg 27af69d88dSmrgThis module tracks state changes internally and maintains derived 28af69d88dSmrgvalues based on the current state. For this to work, the driver 29af69d88dSmrgensure the following funciton is called whenever the state changes and 30af69d88dSmrgthe swsetup module is 'awake': 31af69d88dSmrg 32af69d88dSmrg void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state ); 33af69d88dSmrg 34af69d88dSmrgThere is no explicit call to put the swrast module to sleep. 35af69d88dSmrg 36af69d88dSmrg 37af69d88dSmrgCUSTOMIZATION 38af69d88dSmrg 39af69d88dSmrg void (*choose_point)( struct gl_context * ); 40af69d88dSmrg void (*choose_line)( struct gl_context * ); 41af69d88dSmrg void (*choose_triangle)( struct gl_context * ); 42af69d88dSmrg 43af69d88dSmrgDrivers may add additional triangle/line/point functions to swrast by 44af69d88dSmrgoverriding these functions. It is necessary for the driver to be very 45af69d88dSmrgcareful that it doesn't return an inappropriate function, eg a 46af69d88dSmrgrasterization function in feedback mode. See the X11 driver for 47af69d88dSmrgexamples. 48af69d88dSmrg 49af69d88dSmrgDRIVER INTERFACE 50af69d88dSmrg 51af69d88dSmrgThe swrast device driver provides swrast primarily with span- and 52af69d88dSmrgpixel- level interfaces to a framebuffer, with a few additional hooks 53af69d88dSmrgfor locking and setting the read buffer. 54af69d88dSmrg 55af69d88dSmrgSee the definition of struct swrast_device_driver in swrast.h.