gallium: replace draw_convert_wide_points() with draw_wide_point_threshold()

Specifying a threshold size is a bit more flexible, and allows the option
of converting even 1-pixel points to triangles (set threshold=0).

Also, remove 0.25 pixel bias in wide_point().
This commit is contained in:
Brian 2008-02-26 14:29:35 -07:00
parent b93cf55f4e
commit 5e29aab175
5 changed files with 23 additions and 22 deletions

View file

@ -80,7 +80,7 @@ struct draw_context *draw_create( void )
draw->shader_queue_flush = draw_vertex_shader_queue_flush;
draw->convert_wide_points = TRUE;
draw->wide_point_threshold = 1000000.0; /* infinity */
draw->convert_wide_lines = TRUE;
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
@ -220,14 +220,14 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
/**
* Tells the draw module whether to convert wide points (size != 1)
* into triangles.
* Tells the draw module to draw points with triangles if their size
* is greater than this threshold.
*/
void
draw_convert_wide_points(struct draw_context *draw, boolean enable)
draw_wide_point_threshold(struct draw_context *draw, float threshold)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->convert_wide_points = enable;
draw->wide_point_threshold = threshold;
}

View file

@ -215,7 +215,7 @@ struct draw_context
float plane[12][4];
unsigned nr_planes;
boolean convert_wide_points; /**< convert wide points to tris? */
float wide_point_threshold; /**< convert pnts to tris if larger than this */
boolean convert_wide_lines; /**< convert wide lines to tris? */
boolean use_sse;

View file

@ -52,6 +52,19 @@ 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
&& !draw->rasterizer->line_smooth);
/* drawing large points? */
if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
wide_points = FALSE;
else if (draw->rasterizer->point_size > draw->wide_point_threshold)
wide_points = TRUE;
else
wide_points = FALSE;
/*
* NOTE: we build up the pipeline in end-to-start order.
*
@ -69,16 +82,6 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
next = draw->pipeline.aapoint;
}
/* drawing wide lines? */
wide_lines = (draw->rasterizer->line_width != 1.0
&& draw->convert_wide_lines
&& !draw->rasterizer->line_smooth);
/* drawing large points? */
wide_points = (draw->rasterizer->point_size != 1.0
&& draw->convert_wide_points
&& !draw->pipeline.aapoint);
if (wide_lines ||
wide_points ||
draw->rasterizer->point_sprite) {

View file

@ -219,8 +219,8 @@ static void wide_point( struct draw_stage *stage,
half_size = wide->half_point_size;
}
left_adj = -half_size + 0.25f;
right_adj = half_size + 0.25f;
left_adj = -half_size; /* + 0.25f;*/
right_adj = half_size; /* + 0.25f;*/
pos0[0] += left_adj;
pos0[1] -= half_size;
@ -266,7 +266,8 @@ static void wide_first_point( struct draw_stage *stage,
wide->half_point_size = 0.5f * draw->rasterizer->point_size;
if (draw->rasterizer->point_size != 1.0) {
/* XXX we won't know the real size if it's computed by the vertex shader! */
if (draw->rasterizer->point_size > draw->wide_point_threshold) {
stage->point = wide_point;
}
else {

View file

@ -337,9 +337,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
draw_install_pstipple_stage(softpipe->draw, &softpipe->pipe);
#endif
/* sp_prim_setup can do wide points (don't convert to quads) */
draw_convert_wide_points(softpipe->draw, FALSE);
sp_init_surface_functions(softpipe);
return &softpipe->pipe;