Initial pull of code from r6xx-r7xx-support branch
[mesa.git] / src / mesa / drivers / dri / i810 / i810tris.c
index e3e2afb3f22c971b94d933577314513745fb736f..b508496fb6953a075455eaea187fc00a09480686 100644 (file)
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tris.c,v 1.7 2002/10/30 12:51:33 alanh Exp $ */
 /**************************************************************************
 
 Copyright 2001 VA Linux Systems Inc., Fremont, California.
@@ -31,11 +30,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  *   Keith Whitwell <keith@tungstengraphics.com>
  */
 
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "enums.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
+#include "main/macros.h"
+#include "main/enums.h"
+#include "main/colormac.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -75,7 +74,7 @@ do {                                                                  \
 } while (0)
 #endif
 
-static void __inline__ i810_draw_triangle( i810ContextPtr imesa,
+static INLINE void i810_draw_triangle( i810ContextPtr imesa,
                                           i810VertexPtr v0,
                                           i810VertexPtr v1,
                                           i810VertexPtr v2 )
@@ -90,7 +89,7 @@ static void __inline__ i810_draw_triangle( i810ContextPtr imesa,
 }
 
 
-static void __inline__ i810_draw_quad( i810ContextPtr imesa,
+static INLINE void i810_draw_quad( i810ContextPtr imesa,
                                       i810VertexPtr v0,
                                       i810VertexPtr v1,
                                       i810VertexPtr v2,
@@ -109,10 +108,12 @@ static void __inline__ i810_draw_quad( i810ContextPtr imesa,
 }
 
 
-static __inline__ void i810_draw_point( i810ContextPtr imesa,
+static INLINE void i810_draw_point( i810ContextPtr imesa,
                                        i810VertexPtr tmp )
 {
-   GLfloat sz = imesa->glCtx->Point._Size * .5;
+   GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+                            imesa->glCtx->Const.MinPointSize,
+                            imesa->glCtx->Const.MaxPointSize);
    int vertsize = imesa->vertex_size;
    GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
    int j;
@@ -131,7 +132,7 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa,
 }
 
 
-static __inline__ void i810_draw_line( i810ContextPtr imesa,
+static INLINE void i810_draw_line( i810ContextPtr imesa,
                                       i810VertexPtr v0,
                                       i810VertexPtr v1 )
 {
@@ -199,10 +200,10 @@ do {                                              \
 
 
 static struct {
-   points_func         points;
-   line_func           line;
-   triangle_func       triangle;
-   quad_func           quad;
+   tnl_points_func             points;
+   tnl_line_func               line;
+   tnl_triangle_func   triangle;
+   tnl_quad_func               quad;
 } rast_tab[I810_MAX_TRIFUNC];
 
 
@@ -232,7 +233,7 @@ static struct {
 #define VERT_Y(_v) _v->v.y
 #define VERT_Z(_v) _v->v.z
 #define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (imesa->verts + (e<<imesa->vertex_stride_shift))
+#define GET_VERTEX(e) (imesa->verts + (e * imesa->vertex_size * sizeof(int)))
 
 #define VERT_SET_RGBA( v, c )                                          \
 do {                                                           \
@@ -445,7 +446,7 @@ i810_fallback_point( i810ContextPtr imesa,
 /**********************************************************************/
 
 #define IND 0
-#define V(x) (i810Vertex *)(vertptr + ((x)<<vertshift))
+#define V(x) (i810Vertex *)(vertptr + ((x)*vertsize*sizeof(int)))
 #define RENDER_POINTS( start, count )  \
    for ( ; start < count ; start++) POINT( V(ELT(start)) );
 #define RENDER_LINE( v0, v1 )         LINE( V(v0), V(v1) )
@@ -456,7 +457,7 @@ i810_fallback_point( i810ContextPtr imesa,
 #define LOCAL_VARS                                             \
     i810ContextPtr imesa = I810_CONTEXT(ctx);                  \
     GLubyte *vertptr = (GLubyte *)imesa->verts;                        \
-    const GLuint vertshift = imesa->vertex_stride_shift;               \
+    const GLuint vertsize = imesa->vertex_size;        \
     const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;      \
     (void) elt;
 #define RESET_STIPPLE
@@ -514,7 +515,6 @@ static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
    GLuint vertsize = imesa->vertex_size;
    GLuint *vb = i810AllocDmaLow( imesa, (n-2) * 3 * 4 * vertsize );
    GLubyte *vertptr = (GLubyte *)imesa->verts;
-   const GLuint vertshift = imesa->vertex_stride_shift;
    const GLuint *start = (const GLuint *)V(elts[0]);
    int i,j;