Home | History | Annotate | Line # | Download | only in tnl
      1  1.1  mrg INTRODUCTION
      2  1.1  mrg 
      3  1.1  mrg A generic, configurable software implementation of GL transformation &
      4  1.1  mrg lighting.
      5  1.1  mrg 
      6  1.1  mrg This module provides an implementation of the routines required by the
      7  1.1  mrg 'vtxfmt' mechanism of core mesa for tnl functionality in all
      8  1.1  mrg combinations of compile and execute modes.
      9  1.1  mrg 
     10  1.1  mrg Most current drivers use the tnl module exclusively to provide this
     11  1.1  mrg functionality.
     12  1.1  mrg 
     13  1.1  mrg 
     14  1.1  mrg STATE
     15  1.1  mrg 
     16  1.1  mrg To create and destroy the module:
     17  1.1  mrg 
     18  1.1  mrg 	GLboolean _tnl_CreateContext( struct gl_context *ctx );
     19  1.1  mrg 	void _tnl_DestroyContext( struct gl_context *ctx );
     20  1.1  mrg 
     21  1.1  mrg The module is not active by default, and must be installed by calling
     22  1.1  mrg _tnl_Wakeup().  This function installs internal tnl functions into all
     23  1.1  mrg the vtxfmt dispatch hooks, thus taking over the task of transformation
     24  1.1  mrg and lighting entirely:
     25  1.1  mrg 
     26  1.1  mrg         void _tnl_wakeup_exec( struct gl_context *ctx );
     27  1.1  mrg 	void _tnl_wakeup_save_exec( struct gl_context *ctx );
     28  1.1  mrg 
     29  1.1  mrg    
     30  1.1  mrg This module tracks state changes internally and maintains derived
     31  1.1  mrg values based on the current state.  For this to work, the driver
     32  1.1  mrg ensure the following funciton is called whenever the state changes and
     33  1.1  mrg the swsetup module is 'awake':
     34  1.1  mrg 
     35  1.1  mrg 	void _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state );
     36  1.1  mrg 
     37  1.1  mrg There is no explicit call to put the tnl module to sleep.  Simply
     38  1.1  mrg install other function pointers into all the vtxfmt dispatch slots,
     39  1.1  mrg and (optionally) cease calling _tnl_InvalidateState().
     40  1.1  mrg 
     41  1.1  mrg CUSTOMIZATION
     42  1.1  mrg 
     43  1.1  mrg The module provides customizability through several mechanisms.  The
     44  1.1  mrg most important is by allowing drivers to specify the pipeline through
     45  1.1  mrg which vertex data is passed, including its eventual transfer to
     46  1.1  mrg rasterization hardware (or software).
     47  1.1  mrg 
     48  1.1  mrg The default pipeline is specified in t_pipeline.c, and is usually a
     49  1.1  mrg starting point for driver pipelines.  Some drivers will remove a stage
     50  1.1  mrg where hardware provides support for the implemented operation (for
     51  1.1  mrg instance fog where per-pixel hardware fog is available),
     52  1.1  mrg or add stages to shortcircuit latter operations (for
     53  1.1  mrg example taking advantage of hardware support for strips and other
     54  1.1  mrg higher-level primitives (for example the radeon driver).
     55  1.1  mrg 
     56  1.1  mrg In addition, the following functions provide further tweaks:
     57  1.1  mrg 
     58  1.1  mrg extern void
     59  1.1  mrg _tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
     60  1.1  mrg 
     61  1.1  mrg 	- Direct the default vertex transformation stage to
     62  1.1  mrg           produce/not produce projected clip coordinates.
     63  1.1  mrg 	  
     64  1.1  mrg extern void
     65  1.1  mrg _tnl_need_dlist_loopback( struct gl_context *ctx, GLboolean flag );
     66  1.1  mrg       
     67  1.1  mrg         - Direct the display list component of the tnl module to
     68  1.1  mrg           replay display lists as 'glVertex' type calls, rather than
     69  1.1  mrg           passing the display list data directly into the tnl pipeline
     70  1.1  mrg           mechanism.  
     71  1.1  mrg 
     72  1.1  mrg 	  This allows display lists to be replayed by the tnl module
     73  1.1  mrg 	  even when the module is not strictly active.
     74  1.1  mrg 
     75  1.1  mrg 
     76  1.1  mrg extern void
     77  1.1  mrg _tnl_need_dlist_norm_lengths( struct gl_context *ctx, GLboolean flag );
     78  1.1  mrg 
     79  1.1  mrg 	- Direct the display list component to enable/disable caching
     80  1.1  mrg           1/length values for display list normals.  Doing so is
     81  1.1  mrg           ususally helpful when lighting is performed in software, but
     82  1.1  mrg           wasteful otherwise.
     83  1.1  mrg 
     84  1.1  mrg 
     85  1.1  mrg DRIVER INTERFACE
     86  1.1  mrg 
     87  1.1  mrg The module itself offers a minimal driver interface:
     88  1.1  mrg 
     89  1.1  mrg 	 void (*RunPipeline)( struct gl_context *ctx );
     90  1.1  mrg 
     91  1.1  mrg Normally this is set to _tnl_RunPipeline(), however the driver can use
     92  1.1  mrg this hook to wrap checks or other code around this call. 
     93  1.1  mrg 
     94  1.1  mrg In addition, the driver interface for the default render pipeline
     95  1.1  mrg stage is housed in the tnl context struct (this could be cleaner).  
     96  1.1  mrg 
     97  1.1  mrg 
     98  1.1  mrg RENDER DRIVER INTERFACE
     99  1.1  mrg 
    100  1.1  mrg See t_context.h for the definition and explanation of this.