I've just committed a biggish change which includes a few different items:
- Swappable t&l modules. Drivers can turn off the standard 'tnl'
module and replace its dispatch hooks with functions of their own.
There are functions provided to wake the tnl module up again and
recalculate all its internal state.
An example of this is included in FX/fxvtxfmt.c which accelerates
similar states to the fastpath, but via the glVertex interface. In
addition, it also calculates lighting by one or more infinite lights.
The FX code is somewhat buggy, and is disabled by default. It
exists as a testbed for ideas rather than a necessarily permanent
piece of the FX driver. It is quicker in isosurf by 50% or so, but
the tdfx-3-0-0 code might be quicker still, though for different
reasons.
To avoid the requirement for such drivers to implement the entire set
of allowable entrypoints in Begin/End objects, I've implemented a set
of non-core functions (like glColor3s, glVertex2iv, etc) which simply
translate their arguments to more common types (typically floats) and
call the equivalent entrypoint in that type. For example:
static void
loopback_Color3b( GLbyte red, GLbyte green, GLbyte blue )
{
GLubyte col[4];
col[0] = BYTE_TO_UBYTE(red);
col[1] = BYTE_TO_UBYTE(green);
col[2] = BYTE_TO_UBYTE(blue);
col[3] = 255;
glColor4ubv(col);
}
This allows drivers to concentrate on the core set of entrypoints,
which are listed in a struct "GLvertexformat" in dd.h.
- Cleanup of tnl module functions which decompose complex operations
like 'glRectf' or 'glDrawArrays' into Begin/Vertex/End commands.
These always had issues with compilation into display lists because it
was difficult to preserve the OUTSIDE_BEGIN_END requirement, and
dealing with this led to various bugs.
I've introduced a new internal entrypoint '_tnl_hard_begin' which will
preserve the check for OUTSIDE_BEGIN_END when compiled. I've also
improved the tracking of begin/end state through display list
compilation, so we are able to tell whether the list has settled down
to a known state, and hence whether the check can be executed at
compile time instead.
As a result of this, calling Rectf should now have no overhead
compared to calling the corresponding begin/vert/end commands
directly, and those vertices can co-exist in a VB with vertices from
normal operations or other rects.
- Renamed all tnl functions to start with _tnl_, some math functions
to start with _math_.
Keith
|