summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast_setup/NOTES
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast_setup/NOTES')
-rw-r--r--src/mesa/swrast_setup/NOTES79
1 files changed, 32 insertions, 47 deletions
diff --git a/src/mesa/swrast_setup/NOTES b/src/mesa/swrast_setup/NOTES
index 4445b332d96..c6cb4ab3484 100644
--- a/src/mesa/swrast_setup/NOTES
+++ b/src/mesa/swrast_setup/NOTES
@@ -6,10 +6,8 @@ swrast vertices from the t&l vertex_buffer structs, and to use them to
perform triangle setup functions not implemented in the software
rasterizer.
-The module provides a RasterSetup function to plug into the t&l driver
-interface. This hook had previously been used for hardware
-rasterizers, with the software rasterizer taking its data directly
-from the vertex buffer.
+The module implements a full set of functions to plug into the
+t_vb_render.c driver interface (tnl->Driver.Render.*).
There are strong advantages to decoupling the software rasterizer from
the t&l module, primarily allowing hardware drivers better control
@@ -18,63 +16,50 @@ rasterizer in the t&l module, allowing the two modules to evolve
independently and allowing either to be substituted with equivalent
functionality from another codebase.
-This module provides helpers for triangle/quad setup for offset,
-unfilled and twoside-lit triangles. The software rasterizer doesn't
-handle these primitives directly.
+This module implements triangle/quad setup for offset, unfilled and
+twoside-lit triangles. The software rasterizer doesn't handle these
+primitives directly.
-Hardware rasterization drivers probably have little use for this
-module. Rather, they might provide a layer that translates their
-native (hardware) vertices to swrast vertices before calling into the
-swrast module for fallbacks.
+Hardware rasterization drivers typically use this module in situations
+where no hardware rasterization is possible, ie during total
+fallbacks.
STATE
-This module associates an array of SWvertex structs with each VB.
-Thus there are:
-
- GLboolean _swsetup_RegisterVB( struct vertex_buffer *VB );
- void _swsetup_UnregisterVB( struct vertex_buffer *VB );
-
-Which must be called to create and destroy internal vertex storage for
-this module.
-
-To create and destroy the module itself:
+To create and destroy the module:
GLboolean _swsetup_CreateContext( GLcontext *ctx );
void _swsetup_DestroyContext( GLcontext *ctx );
-Like the software rasterizer, this module tracks state changes
-internally and maintains a set of entry points which will always
-reflect the current state. For this to work, the driver must call:
-
- void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
+The module is not active by default, and must be installed by calling
+_swrast_Wakeup(). This function installs internal swrast_setup
+functions into all the tnl->Driver.Render driver hooks, thus taking
+over the task of rasterization entirely:
-SERVICES
+ void _swrast_Wakeup( GLcontext *ctx );
-The module provides the following entrypoints:
+
+This module tracks state changes internally and maintains derived
+values based on the current state. For this to work, the driver
+ensure the following funciton is called whenever the state changes and
+the swsetup module is 'awake':
- void _swrast_RasterSetup( struct vertex_buffer *VB,
- GLuint start, GLuint end );
-
-Build SWvertices for <VB> between indices start and end.
-
- void _swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint v3, GLuint pv );
-
- void _swsetup_Triangle( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint pv );
+ void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
- void _swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv );
+There is no explicit call to put the swsetup module to sleep. Simply
+install other function pointers into all the tnl->Driver.Render.*
+hooks, and (optionally) cease calling _swsetup_InvalidateState().
+DRIVER INTERFACE
- void _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last );
+The module offers a minimal driver interface:
-Draw quad, triangle, line, points. Note that these are in the format
-expected by core mesa. The Quad and Triangle functions handle
-unfilled, offset, twoside-lit and flat-shaded primitives correctly.
+ void (*Start)( GLcontext *ctx );
+ void (*Finish)( GLcontext *ctx );
+
+These are called before and after the completion of all swrast drawing
+activity. As swrast doesn't call callbacks during triangle, line or
+point rasterization, these are necessary to provide locking hooks for
+some drivers. They may otherwise be left null.
-These functions can thus be plugged into the ctx->Driver struct and
-left permanently in place, providing the InvalidateState() routine is
-correctly called on state changes.
- \ No newline at end of file