r300: Further reduced the radeon_span.c diff.
[mesa.git] / src / mesa / swrast / s_lines.c
index 4d9fe5892064acb9243034b5e19bae864646ef1d..80702e41a3ccff62e07feb91002adbd903897f33 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -27,7 +27,6 @@
 #include "context.h"
 #include "colormac.h"
 #include "macros.h"
-#include "nvfragprog.h"
 #include "s_aaline.h"
 #include "s_context.h"
 #include "s_depth.h"
@@ -62,13 +61,13 @@ compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] )
  * To draw a wide line we can simply redraw the span N times, side by side.
  */
 static void
-draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
+draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
 {
    GLint width, start;
 
    ASSERT(span->end < MAX_WIDTH);
 
-   width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
+   width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
 
    if (width & 1)
       start = width / 2;
@@ -88,9 +87,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
             for (i = 0; i < span->end; i++)
                y[i]++;
          }
-         if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
-            _swrast_write_texture_span(ctx, span);
-         else if ((span->interpMask | span->arrayMask) & SPAN_RGBA)
+         if (ctx->Visual.rgbMode)
             _swrast_write_rgba_span(ctx, span);
          else
             _swrast_write_index_span(ctx, span);
@@ -109,9 +106,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
             for (i = 0; i < span->end; i++)
                x[i]++;
          }
-         if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
-            _swrast_write_texture_span(ctx, span);
-         else if ((span->interpMask | span->arrayMask) & SPAN_RGBA)
+         if (ctx->Visual.rgbMode)
             _swrast_write_rgba_span(ctx, span);
          else
             _swrast_write_index_span(ctx, span);
@@ -148,7 +143,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);    \
    }                                                           \
-   if (ctx->Line.Width > 1.0) {                                        \
+   if (ctx->Line._Width > 1.0) {                                       \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -167,7 +162,7 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);   \
    }                                                           \
-   if (ctx->Line.Width > 1.0) {                                        \
+   if (ctx->Line._Width > 1.0) {                                       \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -176,43 +171,23 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
 #include "s_linetemp.h"
 
 
-/* Single-texture line, w/ fog, Z, specular, etc. */
+/* General-purpose textured line (any/all features). */
 #define NAME textured_line
 #define INTERP_RGBA
-#define INTERP_Z
-#define INTERP_FOG
-#define INTERP_TEX
-#define RENDER_SPAN(span)                                      \
-   if (ctx->Line.StippleFlag) {                                        \
-      span.arrayMask |= SPAN_MASK;                             \
-      compute_stipple_mask(ctx, span.end, span.array->mask);   \
-   }                                                           \
-   if (ctx->Line.Width > 1.0) {                                        \
-      draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
-   }                                                           \
-   else {                                                      \
-      _swrast_write_texture_span(ctx, &span);                  \
-   }
-#include "s_linetemp.h"
-
-
-/* Multi-texture or separate specular line, w/ fog, Z, specular, etc. */
-#define NAME multitextured_line
-#define INTERP_RGBA
 #define INTERP_SPEC
 #define INTERP_Z
 #define INTERP_FOG
-#define INTERP_MULTITEX
+#define INTERP_ATTRIBS
 #define RENDER_SPAN(span)                                      \
    if (ctx->Line.StippleFlag) {                                        \
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);   \
    }                                                           \
-   if (ctx->Line.Width > 1.0) {                                        \
+   if (ctx->Line._Width > 1.0) {                                       \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
-      _swrast_write_texture_span(ctx, &span);                  \
+      _swrast_write_rgba_span(ctx, &span);                     \
    }
 #include "s_linetemp.h"
 
@@ -255,10 +230,8 @@ _mesa_print_line_function(GLcontext *ctx)
       _mesa_printf("general_rgba_line\n");
    else if (swrast->Line == textured_line)
       _mesa_printf("textured_line\n");
-   else if (swrast->Line == multitextured_line)
-      _mesa_printf("multitextured_line\n");
    else
-      _mesa_printf("Driver func %p\n", (void *) swrast->Line);
+      _mesa_printf("Driver func %p\n", (void *(*)()) swrast->Line);
 }
 #endif
 
@@ -303,18 +276,12 @@ _swrast_choose_line( GLcontext *ctx )
          _swrast_choose_aa_line_function(ctx);
          ASSERT(swrast->Line);
       }
-      else if (ctx->Texture._EnabledCoordUnits) {
+      else if (ctx->Texture._EnabledCoordUnits
+             || ctx->FragmentProgram._Current) {
          /* textured lines */
-         if (ctx->Texture._EnabledCoordUnits > 0x1
-             || NEED_SECONDARY_COLOR(ctx)) {
-            /* multi-texture and/or separate specular color */
-            USE(multitextured_line);
-         }
-         else {
-            USE(textured_line);
-         }
+         USE(textured_line);
       }
-      else if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0
+      else if (ctx->Depth.Test || swrast->_FogEnabled || ctx->Line._Width != 1.0
                || ctx->Line.StippleFlag) {
          /* no texture, but Z, fog, width>1, stipple, etc. */
          if (rgbmode)