15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)INTRODUCTION 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)Mesa's native software rasterizer. This module provides the fallback 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)paths for rasterization operations and states that aren't accelerated 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)in hardware drivers, and as the full rasterization engine in software 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)drivers. 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)The swrast module 'stands alone', relying only on interfaces to core 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)mesa and it's own driver interface. It knows nothing about the tnl or 1003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)other modules, allowing it to be used for fallback paths in future tnl 116d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)schemes without modification. 120529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)As well as providing triangle/line/point rasterization functionality, 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)the module provides implementations of the pixel operations 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)(ReadPixels, etc), and texture operations (CopyTexSubImage) which may 161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccibe plugged in to the core Mesa driver interface where accelerated 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)versions of these operations are unavailable. 181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)STATE 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)To create and destroy the module: 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 240529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch GLboolean _swrast_CreateContext( struct gl_context *ctx ); 250529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch void _swrast_DestroyContext( struct gl_context *ctx ); 26a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)This module tracks state changes internally and maintains derived 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)values based on the current state. For this to work, the driver 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)ensure the following funciton is called whenever the state changes and 30a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochthe swsetup module is 'awake': 310529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 32c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state ); 33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)There is no explicit call to put the swrast module to sleep. 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 37a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)CUSTOMIZATION 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void (*choose_point)( struct gl_context * ); 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void (*choose_line)( struct gl_context * ); 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void (*choose_triangle)( struct gl_context * ); 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)Drivers may add additional triangle/line/point functions to swrast by 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)overriding these functions. It is necessary for the driver to be very 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)careful that it doesn't return an inappropriate function, eg a 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)rasterization function in feedback mode. See the X11 driver for 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)examples. 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 49a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)DRIVER INTERFACE 50a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)The swrast device driver provides swrast primarily with span- and 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)pixel- level interfaces to a framebuffer, with a few additional hooks 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)for locking and setting the read buffer. 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)See the definition of struct swrast_device_driver in swrast.h.