draw: Don't use the pipeline when drawing lines with fractional widths.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 11 Feb 2011 11:14:27 +0000 (11:14 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 11 Feb 2011 11:24:55 +0000 (11:24 +0000)
Spotted by Jakob Bornecrantz.

src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_pipe.c
src/gallium/auxiliary/draw/draw_pipe_validate.c

index 11eba8aa4a5bacba3a5416a2fccbd167be4ee353..95d96719873972590a21392b13bde2733e8ae018 100644 (file)
@@ -410,7 +410,7 @@ void
 draw_wide_line_threshold(struct draw_context *draw, float threshold)
 {
    draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
-   draw->pipeline.wide_line_threshold = threshold;
+   draw->pipeline.wide_line_threshold = roundf(threshold);
 }
 
 
index 6206197dae97645ef742a5bad301e698bd49eb89..f1b0171f5200ec386b7285c7a7c52e07cd1058ee 100644 (file)
@@ -64,8 +64,8 @@ boolean draw_pipeline_init( struct draw_context *draw )
       return FALSE;
 
    /* these defaults are oriented toward the needs of softpipe */
-   draw->pipeline.wide_point_threshold = 1000000.0; /* infinity */
-   draw->pipeline.wide_line_threshold = 1.0;
+   draw->pipeline.wide_point_threshold = 1000000.0f; /* infinity */
+   draw->pipeline.wide_line_threshold = 1.0f;
    draw->pipeline.wide_point_sprites = FALSE;
    draw->pipeline.line_stipple = TRUE;
    draw->pipeline.point_sprite = TRUE;
index c575a8ac7caff68d5ffd3086adf3b218c61c5ee4..27afba5af3d8ae7e8b08ef270508b64f45934185 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include "util/u_memory.h"
+#include "util/u_math.h"
 #include "pipe/p_defines.h"
 #include "draw_private.h"
 #include "draw_pipe.h"
@@ -86,7 +87,7 @@ draw_need_pipeline(const struct draw_context *draw,
          return TRUE;
 
       /* wide lines */
-      if (rasterizer->line_width > draw->pipeline.wide_line_threshold)
+      if (roundf(rasterizer->line_width) > draw->pipeline.wide_line_threshold)
          return TRUE;
 
       /* AA lines */
@@ -169,7 +170,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
    stage->next = next;
 
    /* drawing wide lines? */
-   wide_lines = (rast->line_width > draw->pipeline.wide_line_threshold
+   wide_lines = (roundf(rast->line_width) > draw->pipeline.wide_line_threshold
                  && !rast->line_smooth);
 
    /* drawing large/sprite points (but not AA points)? */