1848b8605SmrgINTRODUCTION 2848b8605Smrg 3848b8605SmrgMesa's native software rasterizer. This module provides the fallback 4848b8605Smrgpaths for rasterization operations and states that aren't accelerated 5848b8605Smrgin hardware drivers, and as the full rasterization engine in software 6848b8605Smrgdrivers. 7848b8605Smrg 8848b8605SmrgThe swrast module 'stands alone', relying only on interfaces to core 9848b8605Smrgmesa and it's own driver interface. It knows nothing about the tnl or 10848b8605Smrgother modules, allowing it to be used for fallback paths in future tnl 11848b8605Smrgschemes without modification. 12848b8605Smrg 13848b8605SmrgAs well as providing triangle/line/point rasterization functionality, 14848b8605Smrgthe module provides implementations of the pixel operations 15848b8605Smrg(ReadPixels, etc), and texture operations (CopyTexSubImage) which may 16848b8605Smrgbe plugged in to the core Mesa driver interface where accelerated 17848b8605Smrgversions of these operations are unavailable. 18848b8605Smrg 19848b8605Smrg 20848b8605SmrgSTATE 21848b8605Smrg 22848b8605SmrgTo create and destroy the module: 23848b8605Smrg 24848b8605Smrg GLboolean _swrast_CreateContext( struct gl_context *ctx ); 25848b8605Smrg void _swrast_DestroyContext( struct gl_context *ctx ); 26848b8605Smrg 27848b8605SmrgThis module tracks state changes internally and maintains derived 28848b8605Smrgvalues based on the current state. For this to work, the driver 29848b8605Smrgensure the following funciton is called whenever the state changes and 30848b8605Smrgthe swsetup module is 'awake': 31848b8605Smrg 32848b8605Smrg void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state ); 33848b8605Smrg 34848b8605SmrgThere is no explicit call to put the swrast module to sleep. 35848b8605Smrg 36848b8605Smrg 37848b8605SmrgCUSTOMIZATION 38848b8605Smrg 39848b8605Smrg void (*choose_point)( struct gl_context * ); 40848b8605Smrg void (*choose_line)( struct gl_context * ); 41848b8605Smrg void (*choose_triangle)( struct gl_context * ); 42848b8605Smrg 43848b8605SmrgDrivers may add additional triangle/line/point functions to swrast by 44848b8605Smrgoverriding these functions. It is necessary for the driver to be very 45848b8605Smrgcareful that it doesn't return an inappropriate function, eg a 46848b8605Smrgrasterization function in feedback mode. See the X11 driver for 47848b8605Smrgexamples. 48848b8605Smrg 49848b8605SmrgDRIVER INTERFACE 50848b8605Smrg 51848b8605SmrgThe swrast device driver provides swrast primarily with span- and 52848b8605Smrgpixel- level interfaces to a framebuffer, with a few additional hooks 53848b8605Smrgfor locking and setting the read buffer. 54848b8605Smrg 55848b8605SmrgSee the definition of struct swrast_device_driver in swrast.h.