OSDN Git Service

gallium/draw: fix point sprite handling
authorBrian Paul <brianp@vmware.com>
Wed, 21 Apr 2010 20:24:26 +0000 (14:24 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 21 Apr 2010 20:25:28 +0000 (14:25 -0600)
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.

src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_pipe.c
src/gallium/auxiliary/draw/draw_pipe_validate.c
src/gallium/auxiliary/draw/draw_pipe_wide_point.c
src/gallium/auxiliary/draw/draw_private.h

index 4196f01..710bf79 100644 (file)
@@ -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.
  */
index 7b41bb4..b905c2f 100644 (file)
@@ -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);
index b8f57dd..64c3502 100644 (file)
@@ -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;
 
index 23fa4cf..2a50af7 100644 (file)
@@ -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;
 
index 30116f4..a86fe19 100644 (file)
@@ -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;
index 0b3c9e6..4bb3282 100644 (file)
@@ -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? */