Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5563 | serge | 1 | INTRODUCTION |
2 | |||
3 | A helper module which provides glue to bind the software rasterizer to |
||
4 | the software t&l module. The main task of this module is to build |
||
5 | swrast vertices from the t&l vertex_buffer structs, and to use them to |
||
6 | perform triangle setup functions not implemented in the software |
||
7 | rasterizer. |
||
8 | |||
9 | The module implements a full set of functions to plug into the |
||
10 | t_vb_render.c driver interface (tnl->Driver.Render.*). |
||
11 | |||
12 | There are strong advantages to decoupling the software rasterizer from |
||
13 | the t&l module, primarily allowing hardware drivers better control |
||
14 | over fallbacks, the removal of implicit knowledge about the software |
||
15 | rasterizer in the t&l module, allowing the two modules to evolve |
||
16 | independently and allowing either to be substituted with equivalent |
||
17 | functionality from another codebase. |
||
18 | |||
19 | This module implements triangle/quad setup for offset, unfilled and |
||
20 | twoside-lit triangles. The software rasterizer doesn't handle these |
||
21 | primitives directly. |
||
22 | |||
23 | Hardware rasterization drivers typically use this module in situations |
||
24 | where no hardware rasterization is possible, ie during total |
||
25 | fallbacks. |
||
26 | |||
27 | STATE |
||
28 | |||
29 | To create and destroy the module: |
||
30 | |||
31 | GLboolean _swsetup_CreateContext( struct gl_context *ctx ); |
||
32 | void _swsetup_DestroyContext( struct gl_context *ctx ); |
||
33 | |||
34 | The module is not active by default, and must be installed by calling |
||
35 | _swrast_Wakeup(). This function installs internal swrast_setup |
||
36 | functions into all the tnl->Driver.Render driver hooks, thus taking |
||
37 | over the task of rasterization entirely: |
||
38 | |||
39 | void _swrast_Wakeup( struct gl_context *ctx ); |
||
40 | |||
41 | |||
42 | This module tracks state changes internally and maintains derived |
||
43 | values based on the current state. For this to work, the driver |
||
44 | ensure the following funciton is called whenever the state changes and |
||
45 | the swsetup module is 'awake': |
||
46 | |||
47 | void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state ); |
||
48 | |||
49 | There is no explicit call to put the swsetup module to sleep. Simply |
||
50 | install other function pointers into all the tnl->Driver.Render.* |
||
51 | hooks, and (optionally) cease calling _swsetup_InvalidateState(). |
||
52 | |||
53 | DRIVER INTERFACE |
||
54 | |||
55 | The module offers a minimal driver interface: |
||
56 | |||
57 | void (*Start)( struct gl_context *ctx ); |
||
58 | void (*Finish)( struct gl_context *ctx ); |
||
59 | |||
60 | These are called before and after the completion of all swrast drawing |
||
61 | activity. As swrast doesn't call callbacks during triangle, line or |
||
62 | point rasterization, these are necessary to provide locking hooks for |
||
63 | some drivers. They may otherwise be left null. |
||
64 |