diff options
author | Brian Paul <[email protected]> | 2010-04-21 14:24:26 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-04-21 14:25:28 -0600 |
commit | 8cb223eb020560d59c8f73e09b832cef477933b7 (patch) | |
tree | dc3f6ba4e4d4fa0b106ac05be205cb8f8535ecda /src/gallium/auxiliary/draw | |
parent | d30ab4394e7c6b1f3508eb68d673fbf315907781 (diff) |
gallium/draw: fix point sprite handling
New draw API function to indicate whether or not to convert points to
quads for sprite rasterization.
Fix point-to-quad conversion regression in the wide-point stage. We
need to check the pipe_rasterizer_state::point_quad_rasterization flag.
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 11 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe.c | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_validate.c | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_private.h | 1 |
6 files changed, 25 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 4196f01e0b2..710bf792fc3 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -304,6 +304,17 @@ draw_wide_point_threshold(struct draw_context *draw, float threshold) /** + * Should the draw module handle point->quad conversion for drawing sprites? + */ +void +draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite) +{ + draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw->pipeline.wide_point_sprites = draw_sprite; +} + + +/** * Tells the draw module to draw lines with triangles if their width * is greater than this threshold. */ diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 7b41bb48dd3..b905c2f2da6 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -67,6 +67,8 @@ void draw_set_rasterize_stage( struct draw_context *draw, void draw_wide_point_threshold(struct draw_context *draw, float threshold); +void draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite); + void draw_wide_line_threshold(struct draw_context *draw, float threshold); void draw_enable_line_stipple(struct draw_context *draw, boolean enable); diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index b8f57dde6d8..64c35025081 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -66,6 +66,7 @@ boolean draw_pipeline_init( struct draw_context *draw ) /* 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_sprites = FALSE; draw->pipeline.line_stipple = TRUE; draw->pipeline.point_sprite = TRUE; diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 23fa4cf6060..2a50af7a414 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -100,6 +100,11 @@ draw_need_pipeline(const struct draw_context *draw, if (rasterizer->point_size > draw->pipeline.wide_point_threshold) return TRUE; + /* sprite points */ + if (rasterizer->point_quad_rasterization + && draw->pipeline.wide_point_sprites) + return TRUE; + /* AA points */ if (rasterizer->point_smooth && draw->pipeline.aapoint) return TRUE; @@ -172,6 +177,8 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) wide_points = FALSE; else if (rast->point_size > draw->pipeline.wide_point_threshold) wide_points = TRUE; + else if (rast->point_quad_rasterization && draw->pipeline.wide_point_sprites) + wide_points = TRUE; else wide_points = FALSE; diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index 30116f4925f..a86fe19586c 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -132,10 +132,9 @@ static void set_texcoords(const struct widepoint_stage *wide, static void widepoint_point( struct draw_stage *stage, struct prim_header *header ) { - /* XXX should take point_quad_rasterization into account? */ const struct widepoint_stage *wide = widepoint_stage(stage); const unsigned pos = draw_current_shader_position_output(stage->draw); - const boolean sprite = (boolean) stage->draw->rasterizer->sprite_coord_enable; + const boolean sprite = (boolean) stage->draw->rasterizer->point_quad_rasterization; float half_size; float left_adj, right_adj, bot_adj, top_adj; @@ -237,14 +236,14 @@ static void widepoint_first_point( struct draw_stage *stage, /* XXX we won't know the real size if it's computed by the vertex shader! */ if ((rast->point_size > draw->pipeline.wide_point_threshold) || - (rast->sprite_coord_enable && draw->pipeline.point_sprite)) { + (rast->point_quad_rasterization && draw->pipeline.point_sprite)) { stage->point = widepoint_point; } else { stage->point = draw_pipe_passthrough_point; } - if (rast->sprite_coord_enable) { + if (rast->point_quad_rasterization) { /* find vertex shader texcoord outputs */ const struct draw_vertex_shader *vs = draw->vs.vertex_shader; uint i, j = 0; diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 0b3c9e69bd5..4bb3282f62c 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -111,6 +111,7 @@ struct draw_context float wide_point_threshold; /**< convert pnts to tris if larger than this */ float wide_line_threshold; /**< convert lines to tris if wider than this */ + boolean wide_point_sprites; /**< convert points to tris for sprite mode */ boolean line_stipple; /**< do line stipple? */ boolean point_sprite; /**< convert points to quads for sprites? */ |