added GL_SGIX/SGIS_pixel_texture
[mesa.git] / src / mesa / main / lines.c
index 505bf463824f497c37a46380d1d1025df2b8b424..ba877a85e1911c65b7ef26fe4e56b1740ba65259 100644 (file)
@@ -1,8 +1,8 @@
-/* $Id: lines.c,v 1.3 1999/10/08 09:27:11 keithw Exp $ */
+/* $Id: lines.c,v 1.9 2000/03/03 18:55:45 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.1
+ * Version:  3.3
  * 
  * Copyright (C) 1999  Brian Paul   All Rights Reserved.
  * 
  */
 
 
-
-
-
 #ifdef PC_HEADER
 #include "all.h"
 #else
-#ifndef XFree86Server
-#include <assert.h>
-#else
-#include "GL/xf86glx.h"
-#endif
+#include "glheader.h"
 #include "context.h"
 #include "depth.h"
 #include "feedback.h"
 #include "texstate.h"
 #include "types.h"
 #include "vb.h"
-#ifdef XFree86Server
-#include "GL/xf86glx.h"
-#endif
 #endif
 
 
 
-void gl_LineWidth( GLcontext *ctx, GLfloat width )
+void
+_mesa_LineWidth( GLfloat width )
 {
+   GET_CURRENT_CONTEXT(ctx);
    if (width<=0.0) {
       gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
       return;
@@ -66,17 +58,24 @@ void gl_LineWidth( GLcontext *ctx, GLfloat width )
       ctx->TriangleCaps &= ~DD_LINE_WIDTH;
       if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH;
       ctx->NewState |= NEW_RASTER_OPS;
+      if (ctx->Driver.LineWidth)
+         (*ctx->Driver.LineWidth)(ctx, width);
    }
 }
 
 
 
-void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
+void
+_mesa_LineStipple( GLint factor, GLushort pattern )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple");
    ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
    ctx->Line.StipplePattern = pattern;
    ctx->NewState |= NEW_RASTER_OPS;
+
+   if (ctx->Driver.LineStipple)
+      ctx->Driver.LineStipple( ctx, factor, pattern );
 }
 
 
@@ -133,7 +132,7 @@ static void flat_ci_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -161,7 +160,7 @@ static void flat_ci_z_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -187,7 +186,7 @@ static void flat_rgba_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -216,7 +215,7 @@ static void flat_rgba_z_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -243,7 +242,7 @@ static void smooth_ci_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -273,7 +272,7 @@ static void smooth_ci_z_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -304,7 +303,7 @@ static void smooth_rgba_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -338,7 +337,7 @@ static void smooth_rgba_z_line( GLcontext *ctx,
 #include "linetemp.h"
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -419,7 +418,7 @@ static void general_smooth_ci_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -484,7 +483,7 @@ static void general_flat_ci_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -579,7 +578,7 @@ static void general_smooth_rgba_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -644,7 +643,7 @@ static void general_flat_rgba_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -704,7 +703,7 @@ static void flat_textured_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -776,7 +775,7 @@ static void smooth_textured_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -869,7 +868,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
    }
 
    ctx->PB->count = count;
-   PB_CHECK_FLUSH( ctx, ctx->PB );
+   gl_flush_pb(ctx);
 }
 
 
@@ -1030,8 +1029,7 @@ void gl_set_line_function( GLcontext *ctx )
       else {
         if (ctx->Light.ShadeModel==GL_SMOOTH) {
            /* Width==1, non-stippled, smooth-shaded */
-            if (ctx->Depth.Test
-               || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+            if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
                if (rgbmode)
                   ctx->Driver.LineFunc = smooth_rgba_z_line;
                else
@@ -1046,8 +1044,7 @@ void gl_set_line_function( GLcontext *ctx )
         }
          else {
            /* Width==1, non-stippled, flat-shaded */
-            if (ctx->Depth.Test
-                || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
+            if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) {
                if (rgbmode)
                   ctx->Driver.LineFunc = flat_rgba_z_line;
                else