summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-02-28 17:49:22 -0700
committerBrian Paul <brian.paul@tungstengraphics.com>2008-02-28 17:49:22 -0700
commita1a13954885cd469faab49633b5386e5c889e3df (patch)
tree21f3558538adf1296b98c3919e82f50d5490a1c7 /src/gallium
parent70126588cf78b8a835dfced2b7ca7f1e05afeb67 (diff)
gallium: split draw_wide_prim stage into separate point/line stages.
This fixes a validation/code-path problem. Enabling the stage for the sake of wide points also inadvertantly caused wide lines to be converted to tris when we actually want them passed through, such as for the AA line stage. This is just cleaner now. Also, replace draw_convert_wide_lines() with draw_wide_line_threshold() as was done for points. Allows for 1-pixel lines to be converted too if needed.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/Makefile4
-rw-r--r--src/gallium/auxiliary/draw/SConscript3
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c17
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h4
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h8
-rw-r--r--src/gallium/auxiliary/draw/draw_validate.c16
6 files changed, 30 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/draw/Makefile b/src/gallium/auxiliary/draw/Makefile
index c9980f0b83..2daa1636f3 100644
--- a/src/gallium/auxiliary/draw/Makefile
+++ b/src/gallium/auxiliary/draw/Makefile
@@ -29,7 +29,9 @@ C_SOURCES = \
draw_vf.c \
draw_vf_generic.c \
draw_vf_sse.c \
- draw_wide_prims.c
+ draw_wide_line.c \
+ draw_wide_point.c
+
include ../../Makefile.template
diff --git a/src/gallium/auxiliary/draw/SConscript b/src/gallium/auxiliary/draw/SConscript
index 3302dc44f7..c18dcb2927 100644
--- a/src/gallium/auxiliary/draw/SConscript
+++ b/src/gallium/auxiliary/draw/SConscript
@@ -28,7 +28,8 @@ draw = env.ConvenienceLibrary(
'draw_vf.c',
'draw_vf_generic.c',
'draw_vf_sse.c',
- 'draw_wide_prims.c',
+ 'draw_wide_point.c',
+ 'draw_wide_line.c'
])
auxiliaries.insert(0, draw)
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 3500c34811..428b6209e0 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -48,7 +48,8 @@ struct draw_context *draw_create( void )
#endif
/* create pipeline stages */
- draw->pipeline.wide = draw_wide_stage( draw );
+ draw->pipeline.wide_line = draw_wide_line_stage( draw );
+ draw->pipeline.wide_point = draw_wide_point_stage( draw );
draw->pipeline.stipple = draw_stipple_stage( draw );
draw->pipeline.unfilled = draw_unfilled_stage( draw );
draw->pipeline.twoside = draw_twoside_stage( draw );
@@ -80,8 +81,9 @@ struct draw_context *draw_create( void )
draw->shader_queue_flush = draw_vertex_shader_queue_flush;
+ /* these defaults are oriented toward the needs of softpipe */
draw->wide_point_threshold = 1000000.0; /* infinity */
- draw->convert_wide_lines = TRUE;
+ draw->wide_line_threshold = 1.0;
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
@@ -94,7 +96,8 @@ struct draw_context *draw_create( void )
void draw_destroy( struct draw_context *draw )
{
- draw->pipeline.wide->destroy( draw->pipeline.wide );
+ draw->pipeline.wide_line->destroy( draw->pipeline.wide_line );
+ draw->pipeline.wide_point->destroy( draw->pipeline.wide_point );
draw->pipeline.stipple->destroy( draw->pipeline.stipple );
draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
draw->pipeline.twoside->destroy( draw->pipeline.twoside );
@@ -232,14 +235,14 @@ draw_wide_point_threshold(struct draw_context *draw, float threshold)
/**
- * Tells the draw module whether to convert wide lines (width != 1)
- * into triangles.
+ * Tells the draw module to draw lines with triangles if their width
+ * is greater than this threshold.
*/
void
-draw_convert_wide_lines(struct draw_context *draw, boolean enable)
+draw_wide_line_threshold(struct draw_context *draw, float threshold)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
- draw->convert_wide_lines = enable;
+ draw->wide_line_threshold = threshold;
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 99bfef55f4..ab87b4127c 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -92,9 +92,7 @@ void draw_set_rasterize_stage( struct draw_context *draw,
void draw_wide_point_threshold(struct draw_context *draw, float threshold);
-void draw_convert_wide_points(struct draw_context *draw, boolean enable);
-
-void draw_convert_wide_lines(struct draw_context *draw, boolean enable);
+void draw_wide_line_threshold(struct draw_context *draw, float threshold);
boolean draw_use_sse(struct draw_context *draw);
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index e988e71d23..c732d723a7 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -186,7 +186,8 @@ struct draw_context
struct draw_stage *aapoint;
struct draw_stage *aaline;
struct draw_stage *pstipple;
- struct draw_stage *wide;
+ struct draw_stage *wide_line;
+ struct draw_stage *wide_point;
struct draw_stage *rasterize;
} pipeline;
@@ -219,7 +220,7 @@ struct draw_context
unsigned nr_planes;
float wide_point_threshold; /**< convert pnts to tris if larger than this */
- boolean convert_wide_lines; /**< convert wide lines to tris? */
+ float wide_line_threshold; /**< convert lines to tris if wider than this */
boolean use_sse;
/* If a prim stage introduces new vertex attributes, they'll be stored here
@@ -304,7 +305,8 @@ extern struct draw_stage *draw_clip_stage( struct draw_context *context );
extern struct draw_stage *draw_flatshade_stage( struct draw_context *context );
extern struct draw_stage *draw_cull_stage( struct draw_context *context );
extern struct draw_stage *draw_stipple_stage( struct draw_context *context );
-extern struct draw_stage *draw_wide_stage( struct draw_context *context );
+extern struct draw_stage *draw_wide_line_stage( struct draw_context *context );
+extern struct draw_stage *draw_wide_point_stage( struct draw_context *context );
extern struct draw_stage *draw_validate_stage( struct draw_context *context );
diff --git a/src/gallium/auxiliary/draw/draw_validate.c b/src/gallium/auxiliary/draw/draw_validate.c
index ded7d10c08..084eee9b6e 100644
--- a/src/gallium/auxiliary/draw/draw_validate.c
+++ b/src/gallium/auxiliary/draw/draw_validate.c
@@ -53,8 +53,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
stage->next = next;
/* drawing wide lines? */
- wide_lines = (draw->rasterizer->line_width != 1.0
- && draw->convert_wide_lines
+ wide_lines = (draw->rasterizer->line_width > draw->wide_line_threshold
&& !draw->rasterizer->line_smooth);
/* drawing large points? */
@@ -82,11 +81,14 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
next = draw->pipeline.aapoint;
}
- if (wide_lines ||
- wide_points ||
- draw->rasterizer->point_sprite) {
- draw->pipeline.wide->next = next;
- next = draw->pipeline.wide;
+ if (wide_lines) {
+ draw->pipeline.wide_line->next = next;
+ next = draw->pipeline.wide_line;
+ }
+
+ if (wide_points || draw->rasterizer->point_sprite) {
+ draw->pipeline.wide_point->next = next;
+ next = draw->pipeline.wide_point;
}
if (draw->rasterizer->line_stipple_enable) {