Fixed 'IRound' to 'IROUND' in mmath.h
[mesa.git] / src / mesa / drivers / glide / fxdrv.h
index 1c6e3f0639ba47cabc50b449bc60b2a0e681d246..cefd6d0e1a9e6f9cb58aba0c891415acb2444e40 100644 (file)
@@ -1,4 +1,3 @@
-/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
 
 /*
  * Mesa 3-D graphics library
  * you turn debugging on/off from the debugger.
  */
 
-#ifndef XFree86Server
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <assert.h>
-#else 
-#include "GL/xf86glx.h"
-#endif
+#include "glheader.h"
 
 
 #if defined(__linux__)
 #include "matrix.h"
 #include "mem.h"
 #include "texture.h"
-#include "types.h"
-#include "vb.h"
-#include "xform.h"
-#include "clip.h"
-#include "vbrender.h"
-
-#ifdef XF86DRI
-typedef struct tfxMesaContext *fxMesaContext;
-#else
+#include "mtypes.h"
+
 #include "GL/fxmesa.h"
-#endif
 #include "fxglidew.h"
-/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of WINGDIAPI/APIENTRY/CALLBACK, */
-/* these are defined in mesa gl/gl.h - tjump@spgs.com */
 
-
-
-#if defined(MESA_DEBUG) && 0
-extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
-#define grDrawTriangle fx_sanity_triangle
-#endif
+#include "math/m_vector.h"
 
 
 /* Define some shorter names for these things.
@@ -111,39 +87,39 @@ extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
 #define T1COORD  GR_VERTEX_TOW_TMU1_OFFSET
 
 
-#if FX_USE_PARGB
+extern float gl_ubyte_to_float_255_color_tab[256];
+#define UBYTE_COLOR_TO_FLOAT_255_COLOR(c) gl_ubyte_to_float_255_color_tab[c]
+#define UBYTE_COLOR_TO_FLOAT_255_COLOR2(f,c) \
+    (*(int *)&(f)) = ((int *)gl_ubyte_to_float_255_color_tab)[c]
 
-#define CLIP_XCOORD 0          /* normal place */
-#define CLIP_YCOROD 1          /* normal place */
-#define CLIP_ZCOORD 2          /* normal place */
-#define CLIP_WCOORD 3          /* normal place */
-#define CLIP_GCOORD 4          /* GR_VERTEX_PARGB_OFFSET */
-#define CLIP_BCOORD 5          /* GR_VERTEX_SOW_TMU0_OFFSET */
-#define CLIP_RCOORD 6          /* GR_VERTEX_TOW_TMU0_OFFSET */
-#define CLIP_ACOORD 7          /* GR_VERTEX_OOW_TMU0_OFFSET */
-
-#else
-
-#define CLIP_XCOORD 0          /* normal place */
-#define CLIP_YCOROD 1          /* normal place */
-#define CLIP_ZCOORD 2          /* GR_VERTEX_Z_OFFSET */
-#define CLIP_WCOORD 3          /* GR_VERTEX_R_OFFSET */
-#define CLIP_GCOORD 4          /* normal place */
-#define CLIP_BCOORD 5          /* normal place */
-#define CLIP_RCOORD 6          /* GR_VERTEX_OOZ_OFFSET */
-#define CLIP_ACOORD 7          /* normal place */
 
 
-#endif
 
 /* Should have size == 16 * sizeof(float).
  */
-typedef struct {
-   GLfloat f[15];              /* Same layout as GrVertex */
-   GLubyte mask;               /* Unsued  */
-   GLubyte usermask;           /* Unused */
+typedef union {
+  GrVertex v;
+  GLfloat f[16];       
+  GLuint ui[16];
 } fxVertex;
 
+/* Used in the fxvtxfmt t&l engine.
+ */
+typedef struct {
+   GrVertex v;
+   GLfloat clip[4];
+   GLfloat texcoord[2][2];
+   GLubyte mask;
+   GLfloat normal[3];          /* for replay & fallback */
+} fxClipVertex;
+
+
+
+typedef void (*vfmt_project_func)( GLcontext *ctx, fxClipVertex *v );
+typedef void (*vfmt_interpolate_func)( GLfloat t, 
+                                      fxClipVertex *O,
+                                      const fxClipVertex *I, 
+                                      const fxClipVertex *J );
 
 
 
@@ -153,7 +129,7 @@ typedef struct {
   ( ((unsigned int)(c[0]))<<16 ) | \
   ( ((unsigned int)(c[1]))<<8 )  | \
   (  (unsigned int)(c[2])) )
-  
+
 #else
 #ifdef __i386__
 #define FXCOLOR4( c )  (* (int *)c)
@@ -166,52 +142,16 @@ typedef struct {
 #endif
 #endif
 
-#define FX_VB_COLOR(fxm, color)                                \
-  do {                                                 \
-    if (sizeof(GLint) == 4*sizeof(GLubyte)) {          \
-      if (fxm->constColor != *(GLuint*)color) {                \
-       fxm->constColor = *(GLuint*)color;              \
-       FX_grConstantColorValue(FXCOLOR4(color));       \
-      }                                                        \
-    } else {                                           \
-      FX_grConstantColorValue(FXCOLOR4(color));                \
-    }                                                  \
-  } while (0)
-
-#define GOURAUD(x) {                                   \
-  GLubyte *col = VB->ColorPtr->data[(x)];              \
-  gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]);        \
-  gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]);        \
-  gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]);        \
-  gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]);        \
-}
-
-#if FX_USE_PARGB
-#define GOURAUD2(v, c) {                                                                                                                               \
-  GLubyte *col = c;                                                                                                                                    \
-  v->argb=MESACOLOR2PARGB(col);                                                                                                                        \
-}
-#else
-#define GOURAUD2(v, c) {                       \
-  GLubyte *col = c;                            \
-  v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
-  v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
-  v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
-  v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
-}
-#endif
 
 
-/* Mergable items first
+/* fastpath/vtxfmt flags first
  */
-#define SETUP_RGBA 0x1
-#define SETUP_TMU0 0x2
-#define SETUP_TMU1 0x4
-#define SETUP_XY   0x8
-#define SETUP_Z    0x10
-#define SETUP_W    0x20
-
-#define MAX_MERGABLE 0x8
+#define SETUP_TMU0 0x1
+#define SETUP_TMU1 0x2
+#define SETUP_RGBA 0x4
+#define SETUP_SNAP 0x8
+#define SETUP_XYZW 0x10
+#define MAX_SETUP  0x20
 
 
 #define FX_NUM_TMU 2
@@ -230,13 +170,13 @@ typedef struct {
 #define FX_UM_E0_MODULATE           0x00000002
 #define FX_UM_E0_DECAL              0x00000004
 #define FX_UM_E0_BLEND              0x00000008
-#define FX_UM_E0_ADD                           0x00000010
+#define FX_UM_E0_ADD               0x00000010
 
 #define FX_UM_E1_REPLACE            0x00000020
 #define FX_UM_E1_MODULATE           0x00000040
 #define FX_UM_E1_DECAL              0x00000080
 #define FX_UM_E1_BLEND              0x00000100
-#define FX_UM_E1_ADD                           0x00000200
+#define FX_UM_E1_ADD               0x00000200
 
 #define FX_UM_E_ENVMODE             0x000003ff
 
@@ -261,7 +201,6 @@ typedef struct {
 #define FX_UM_ALPHA_ITERATED        0x04000000
 #define FX_UM_ALPHA_CONSTANT        0x08000000
 
-typedef void (*tfxRenderVBFunc)(GLcontext *);
 
 /*
   Memory range from startAddr to endAddr-1
@@ -272,11 +211,9 @@ typedef struct MemRange_t {
 } MemRange;
 
 typedef struct {
-  GLsizei width, height;
-  GLint glideFormat;
-
-  unsigned short *data;
-  GLboolean translated, used;
+  GLsizei width, height;              /* image size */
+  GrTextureFormat_t glideFormat;      /* Glide image format */
+  unsigned short *data;               /* Glide-formated texture image */
 } tfxMipMapLevel;
 
 typedef struct tfxTexInfo_t {
@@ -307,7 +244,7 @@ typedef struct tfxTexInfo_t {
 
   GLfloat sScale, tScale;
   GLint int_sScale, int_tScale;        /* x86 floating point trick for
-                                * multiplication by powers of 2.  
+                                * multiplication by powers of 2.
                                 * Used in fxfasttmp.h
                                 */
 
@@ -325,23 +262,6 @@ typedef struct {
 } tfxStats;
 
 
-typedef void (*tfxTriViewClipFunc)( struct vertex_buffer *VB, 
-                                   GLuint v[],
-                                   GLubyte mask );
-
-typedef void (*tfxTriClipFunc)( struct vertex_buffer *VB, 
-                               GLuint v[],
-                               GLuint mask );
-
-
-typedef void (*tfxLineClipFunc)( struct vertex_buffer *VB, 
-                                GLuint v1, GLuint v2,
-                                GLubyte mask );
-
-
-extern tfxTriViewClipFunc fxTriViewClipTab[0x8];
-extern tfxTriClipFunc fxTriClipStrideTab[0x8];
-extern tfxLineClipFunc fxLineClipTab[0x8];
 
 typedef struct {
   /* Alpha test */
@@ -366,14 +286,6 @@ typedef struct {
 } tfxUnitsState;
 
 
-/* Flags for render_index.
- */
-#define FX_OFFSET             0x1
-#define FX_TWOSIDE            0x2
-#define FX_FRONT_BACK         0x4 
-#define FX_FLAT               0x8
-#define FX_ANTIALIAS          0x10 
-#define FX_FALLBACK           0x20 
 
 
 /* Flags for fxMesa->new_state
@@ -387,37 +299,63 @@ typedef struct {
 #define FX_NEW_COLOR_MASK     0x40
 #define FX_NEW_CULL           0x80
 
-/* FX struct stored in VB->driver_data.
- */
-struct tfxMesaVertexBuffer {
-   GLvector1ui clipped_elements;
-
-   fxVertex *verts;
-   fxVertex *last_vert;
-   void *vert_store;
-#if defined(FX_GLIDE3)
-   GrVertex **triangle_b;      /* Triangle buffer */
-   GrVertex **strips_b;                /* Strips buffer */
-#endif
-
-   GLuint size;
-};
 
-#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
 #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
-#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current)
+#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->_Current)
 
-#if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING)
-#include "tdfx_init.h"
-#else
-#define DRI_FX_CONTEXT
 #define BEGIN_BOARD_LOCK()
 #define END_BOARD_LOCK()
 #define BEGIN_CLIP_LOOP()
 #define END_CLIP_LOOP()
-#endif
 
 
+
+
+/* Covers the state referenced by IsInHardware:
+ */
+#define _FX_NEW_IS_IN_HARDWARE (_NEW_TEXTURE|          \
+                               _NEW_HINT|              \
+                               _NEW_STENCIL|           \
+                               _NEW_BUFFERS|           \
+                               _NEW_COLOR|             \
+                               _NEW_LIGHT)
+
+/* Covers the state referenced by fxDDChooseRenderState
+ */
+#define _FX_NEW_RENDERSTATE (_FX_NEW_IS_IN_HARDWARE |   \
+                            _DD_NEW_FLATSHADE |        \
+                            _DD_NEW_TRI_LIGHT_TWOSIDE| \
+                            _DD_NEW_TRI_OFFSET |       \
+                            _DD_NEW_TRI_UNFILLED |     \
+                            _DD_NEW_TRI_SMOOTH |       \
+                            _DD_NEW_TRI_STIPPLE |      \
+                            _DD_NEW_LINE_SMOOTH |      \
+                            _DD_NEW_LINE_STIPPLE |     \
+                            _DD_NEW_LINE_WIDTH |       \
+                            _DD_NEW_POINT_SMOOTH |     \
+                            _DD_NEW_POINT_SIZE |       \
+                            _NEW_LINE)
+
+/* Covers the state referenced by fxDDChooseSetupFunction.
+ */
+#define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT|    \
+                               _NEW_FOG|       \
+                               _NEW_TEXTURE|   \
+                               _NEW_COLOR)     \
+
+
+/* Covers the state referenced in fxDDCheckVtxfmt.
+ */
+#define _FX_NEW_VTXFMT (_NEW_TEXTURE |                 \
+                       _NEW_TEXTURE_MATRIX |           \
+                       _NEW_TRANSFORM |                \
+                       _NEW_LIGHT |                    \
+                       _NEW_PROJECTION |               \
+                       _NEW_MODELVIEW |                \
+                       _TNL_NEW_NEED_EYE_COORDS |      \
+                       _FX_NEW_RENDERSTATE)
+                       
+
 /* These lookup table are used to extract RGB values in [0,255] from
  * 16-bit pixel values.
  */
@@ -426,157 +364,205 @@ extern GLubyte FX_PixelToG[0x10000];
 extern GLubyte FX_PixelToB[0x10000];
 
 
-struct tfxMesaContext {
-  GuTexPalette glbPalette;
+typedef void (*fx_tri_func)( GLcontext *, const fxVertex *,
+                            const fxVertex *, const fxVertex * );
+typedef void (*fx_line_func)( GLcontext *, const fxVertex *, const fxVertex * );
+typedef void (*fx_point_func)( GLcontext *, const fxVertex * );
 
-  GLcontext *glCtx;              /* the core Mesa context */
-  GLvisual *glVis;               /* describes the color buffer */
-  GLframebuffer *glBuffer;       /* the ancillary buffers */
-
-  GLint board;                   /* the board used for this context */
-  GLint width, height;           /* size of color buffer */
-
-  GrBuffer_t currentFB;
-
-  GLboolean bgrOrder;
-  GrColor_t color;
-  GrColor_t clearC;
-  GrAlpha_t clearA;
-  GLuint constColor;
-  GrCullMode_t cullMode;
-
-  tfxUnitsState unitsState;
-  tfxUnitsState restoreUnitsState; /* saved during multipass */
-
-  GLuint tmu_source[FX_NUM_TMU];
-  GLuint tex_dest[MAX_TEXTURE_UNITS];
-  GLuint setupindex;
-  GLuint partial_setup_index;
-  GLuint setupdone;
-  GLuint mergeindex;
-  GLuint mergeinputs;
-  GLuint render_index;
-  GLuint last_tri_caps;
-  GLuint stw_hint_state;               /* for grHints */
-  GLuint is_in_hardware;
-  GLuint new_state;   
-  GLuint using_fast_path, passes, multipass;
-
-  tfxLineClipFunc clip_line;
-  tfxTriClipFunc clip_tri_stride;
-  tfxTriViewClipFunc view_clip_tri;
-
-
-  /* Texture Memory Manager Data */
-
-  GLuint texBindNumber;
-  GLint tmuSrc;
-  GLuint lastUnitsMode;
-  GLuint freeTexMem[FX_NUM_TMU];
-  MemRange *tmPool;
-  MemRange *tmFree[FX_NUM_TMU];
-
-  GLenum fogTableMode;
-  GLfloat fogDensity;
-  GLfloat fogStart, fogEnd;
-  GrFog_t *fogTable;
-
-  /* Acc. functions */
-
-  points_func PointsFunc;
-  line_func LineFunc;
-  triangle_func TriangleFunc;
-  quad_func QuadFunc;
-
-  render_func **RenderVBTables;
-
-  render_func *RenderVBClippedTab;
-  render_func *RenderVBCulledTab;
-  render_func *RenderVBRawTab;
-
-
-  tfxStats stats;
-
-  void *state;
+struct tfxMesaContext {
+   GuTexPalette glbPalette;
+
+   GLcontext *glCtx;              /* the core Mesa context */
+   GLvisual *glVis;               /* describes the color buffer */
+   GLframebuffer *glBuffer;       /* the ancillary buffers */
+
+   GLint board;                   /* the board used for this context */
+   GLint width, height;           /* size of color buffer */
+
+   GrBuffer_t currentFB;
+
+   GLboolean bgrOrder;
+   GrColor_t color;
+   GrColor_t clearC;
+   GrAlpha_t clearA;
+   GLuint constColor;
+   GrCullMode_t cullMode;
+
+   tfxUnitsState unitsState;
+   tfxUnitsState restoreUnitsState; /* saved during multipass */
+
+
+   GLuint new_state;   
+
+   /* Texture Memory Manager Data 
+    */
+   GLuint texBindNumber;
+   GLint tmuSrc;
+   GLuint lastUnitsMode;
+   GLuint freeTexMem[FX_NUM_TMU];
+   MemRange *tmPool;
+   MemRange *tmFree[FX_NUM_TMU];
+
+   GLenum fogTableMode;
+   GLfloat fogDensity;
+   GLfloat fogStart, fogEnd;
+   GrFog_t *fogTable;
+   GLint textureAlign;
+
+   /* Vertex building and storage:
+    */
+   GLuint tmu_source[FX_NUM_TMU];
+   GLuint tex_dest[MAX_TEXTURE_UNITS];
+   GLuint setupindex;
+   GLuint setup_gone;          /* for multipass */
+   GLuint stw_hint_state;      /* for grHints */
+   fxVertex *verts;
 
-  /* Options */
 
-  GLboolean verbose;
-  GLboolean haveTwoTMUs;       /* True if we really have 2 tmu's  */
-  GLboolean emulateTwoTMUs;    /* True if we present 2 tmu's to mesa.  */
-  GLboolean haveAlphaBuffer;
-  GLboolean haveZBuffer;
-  GLboolean haveDoubleBuffer;
-  GLboolean haveGlobalPaletteTexture;
-  GLint swapInterval;
-  GLint maxPendingSwapBuffers;
+   /* Rasterization:
+    */
+   GLuint render_index;
+   GLuint passes, multipass;
+   GLuint is_in_hardware;
+
+   /* Current rasterization functions 
+    */
+   fx_point_func draw_point;
+   fx_line_func draw_line;
+   fx_tri_func draw_tri;
+
+   /* System to turn culling on/off for tris/lines/points.
+    */
+   fx_point_func initial_point;
+   fx_line_func initial_line;
+   fx_tri_func initial_tri;
+
+   fx_point_func subsequent_point;
+   fx_line_func subsequent_line;
+   fx_tri_func subsequent_tri;
+
+   /* Keep texture scales somewhere handy:
+    */
+   GLfloat s0scale;
+   GLfloat s1scale;
+   GLfloat t0scale;
+   GLfloat t1scale;
+
+   GLfloat inv_s0scale;
+   GLfloat inv_s1scale;
+   GLfloat inv_t0scale;
+   GLfloat inv_t1scale;
+
+   /* Glide stuff
+    */
+   tfxStats stats;
+   void *state;
+
+   /* Options */
+
+   GLboolean verbose;
+   GLboolean haveTwoTMUs;      /* True if we really have 2 tmu's  */
+   GLboolean emulateTwoTMUs;   /* True if we present 2 tmu's to mesa.  */
+   GLboolean haveAlphaBuffer;
+   GLboolean haveZBuffer;
+   GLboolean haveDoubleBuffer;
+   GLboolean haveGlobalPaletteTexture;
+   GLint swapInterval;
+   GLint maxPendingSwapBuffers;
   
-  FX_GrContext_t glideContext;
-
-  int x_offset;
-  int y_offset;
-  int y_delta;
-  int screen_width;
-  int screen_height;
-  int initDone;
-  int clipMinX;
-  int clipMaxX;
-  int clipMinY;
-  int clipMaxY;
-  int needClip;
-
-  DRI_FX_CONTEXT
+   FX_GrContext_t glideContext;
+
+   int screen_width;
+   int screen_height;
+   int initDone;
+   int clipMinX;
+   int clipMaxX;
+   int clipMinY;
+   int clipMaxY;
+
+   /* fxvtxfmt
+    */
+   GLboolean allow_vfmt;
+   GLvertexformat vtxfmt;
+   fxClipVertex current;
+   fxClipVertex *vert;         /* points into verts[] */
+   void (*fire_on_vertex)( GLcontext * );
+   void (*fire_on_end)( GLcontext * );
+   void (*fire_on_fallback)( GLcontext * );
+   
+   vfmt_project_func project_vertex;
+   vfmt_interpolate_func interpolate_vertices;
+
+   int vtxfmt_fallback_count;
+   int vtxfmt_installed;
+   void (*old_begin)( GLenum );
+   GLenum prim;
+   
+   GLuint accel_light;
+   GLfloat basecolor[4];
+
+
+   /* Projected vertices, fastpath data:
+    */
+   GLvector1ui clipped_elements;
+   fxVertex *last_vert;
+   GLuint size;
 };
 
-typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint);
+typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint );
 
 extern GrHwConfiguration glbHWConfig;
 extern int glbCurrentBoard;
 
 extern void fxSetupFXUnits(GLcontext *);
 extern void fxSetupDDPointers(GLcontext *);
-extern void fxDDSetNearFar(GLcontext *, GLfloat, GLfloat);
 
+/* fxvsetup:
+ */
 extern void fxDDSetupInit(void);
-extern void fxDDCvaInit(void);
+extern void fxAllocVB( GLcontext *ctx );
+extern void fxFreeVB( GLcontext *ctx );
+extern void fxPrintSetupFlags( const char *msg, GLuint flags );
+extern void fx_BuildProjVerts( GLcontext *ctx, 
+                              GLuint start, GLuint count, 
+                              GLuint newinputs );
+extern void fx_validate_BuildProjVerts(GLcontext *ctx, 
+                                      GLuint start, GLuint count,
+                                      GLuint newinputs );
+
+/* fxtrifuncs:
+ */
 extern void fxDDTrifuncInit(void);
-extern void fxDDFastPathInit(void);
-
 extern void fxDDChooseRenderState( GLcontext *ctx );
 
-extern void fxRenderClippedLine( struct vertex_buffer *VB, 
-                                GLuint v1, GLuint v2 );
-
-extern void fxRenderClippedTriangle( struct vertex_buffer *VB,
-                                    GLuint n, GLuint vlist[] );
-
-
-extern tfxSetupFunc fxDDChooseSetupFunction(GLcontext *);
-
-extern points_func fxDDChoosePointsFunction(GLcontext *);
-extern line_func fxDDChooseLineFunction(GLcontext *);
-extern triangle_func fxDDChooseTriangleFunction(GLcontext *);
-extern quad_func fxDDChooseQuadFunction(GLcontext *);
-extern render_func **fxDDChooseRenderVBTables(GLcontext *);
-
-extern void fxDDRenderInit(GLcontext *);
-extern void fxDDClipInit(void);
 
 extern void fxUpdateDDSpanPointers(GLcontext *);
 extern void fxSetupDDSpanPointers(GLcontext *);
 
 extern void fxPrintTextureData(tfxTexInfo *ti);
-extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *);
-extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *,
-                      GLint, GLint, const struct gl_texture_image *);
+extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+                              GLenum format, GLenum type, const GLvoid *pixels,
+                              const struct gl_pixelstore_attrib *packing,
+                              struct gl_texture_object *texObj,
+                              struct gl_texture_image *texImage,
+                              GLboolean *retainInternalCopy);
+extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+                              GLint xoffset, GLint yoffset,
+                              GLsizei width, GLsizei height,
+                              GLenum format, GLenum type, const GLvoid *pixels,
+                              const struct gl_pixelstore_attrib *packing,
+                              struct gl_texture_object *texObj,
+                              struct gl_texture_image *texImage);
+extern GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level,
+                               const struct gl_texture_object *texObj,
+                               GLenum *formatOut, GLenum *typeOut,
+                               GLboolean *freeImageOut );
+extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
 extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
                         GLenum, const GLfloat *);
 extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *);
 extern void fxDDTexDel(GLcontext *, struct gl_texture_object *);
 extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *);
-extern void fxDDTexuseGlbPalette(GLcontext *, GLboolean);
-extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *, GLint,
-                         GLint, GLint, GLint, GLint, GLint, const struct gl_texture_image *);
 extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
 
 extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
@@ -585,39 +571,12 @@ extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
 extern void fxDDDepthMask(GLcontext *, GLboolean);
 extern void fxDDDepthFunc(GLcontext *, GLenum);
 
-extern void fxDDRegisterVB( struct vertex_buffer *VB );
-extern void fxDDUnregisterVB( struct vertex_buffer *VB );
-extern void fxDDResizeVB( struct vertex_buffer *VB, GLuint size );
-
-extern void fxDDCheckMergeAndRender( GLcontext *ctx, 
-                                    struct gl_pipeline_stage *d );
-
-extern void fxDDMergeAndRender( struct vertex_buffer *VB );
-
-extern void fxDDCheckPartialRasterSetup( GLcontext *ctx, 
-                                        struct gl_pipeline_stage *d );
-
-extern void fxDDPartialRasterSetup( struct vertex_buffer *VB );
-
-extern void fxDDDoRasterSetup( struct vertex_buffer *VB );
-
-extern GLuint fxDDRegisterPipelineStages( struct gl_pipeline_stage *out,
-                                         const struct gl_pipeline_stage *in,
-                                         GLuint nr );
-
-extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx );
-
-extern void fxDDOptimizePrecalcPipeline( GLcontext *ctx, 
-                                        struct gl_pipeline *pipe );
-
-extern void fxDDRenderElementsDirect( struct vertex_buffer *VB );
-extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB );
-
 extern void fxDDInitExtensions( GLcontext *ctx );
 
 #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
 extern void fxTMInit(fxMesaContext ctx);
 extern void fxTMClose(fxMesaContext ctx);
+extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx);
 extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
 extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
 #define fxTMMoveOutTM_NoLock fxTMMoveOutTM
@@ -633,9 +592,9 @@ extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
 extern void fxDDScissor( GLcontext *ctx,
                              GLint x, GLint y, GLsizei w, GLsizei h );
 extern void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
-extern GLboolean fxDDColorMask(GLcontext *ctx, 
-                              GLboolean r, GLboolean g, 
-                              GLboolean b, GLboolean a );
+extern void fxDDColorMask(GLcontext *ctx,
+                          GLboolean r, GLboolean g,
+                          GLboolean b, GLboolean a );
 
 extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
                                const GLdepth depth[], const GLubyte mask[]);
@@ -651,8 +610,6 @@ extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
                                 const GLint x[], const GLint y[],
                                 GLdepth depth[]);
 
-extern void fxDDFastPath( struct vertex_buffer *VB );
-
 extern void fxDDShadeModel(GLcontext *ctx, GLenum mode);
 
 extern void fxDDCullFace(GLcontext *ctx, GLenum mode);
@@ -661,15 +618,27 @@ extern void fxDDFrontFace(GLcontext *ctx, GLenum mode);
 extern void fxPrintRenderState( const char *msg, GLuint state );
 extern void fxPrintHintState( const char *msg, GLuint state );
 
-extern void fxDDDoRenderVB( struct vertex_buffer *VB );
-
 extern int fxDDInitFxMesaContext( fxMesaContext fxMesa );
+extern void fxDDDestroyFxMesaContext( fxMesaContext fxMesa );
+
+
 
 
 extern void fxSetScissorValues(GLcontext *ctx);
-extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, 
-                               struct gl_texture_object *tObj, 
+extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
+                               struct gl_texture_object *tObj,
                                GLint where);
 extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
 
+
+/* fxvtxfmt:
+ */
+extern void fxDDCheckVtxfmt( GLcontext *ctx );
+extern void fx_update_lighting( GLcontext *ctx );
+extern void fxDDInitVtxfmt( GLcontext *ctx );
+
+/* fxsimplerender
+ */
+extern const struct gl_pipeline_stage fx_render_stage; 
+
 #endif