new flag to control psize (from vertex shader or fixed size)
authorBrian <brian.paul@tungstengraphics.com>
Mon, 22 Oct 2007 18:19:54 +0000 (12:19 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 22 Oct 2007 18:19:54 +0000 (12:19 -0600)
src/mesa/pipe/draw/draw_wide_prims.c
src/mesa/pipe/p_state.h
src/mesa/state_tracker/st_atom_rasterizer.c

index 917944a6110d6eb59932e67fa9ba7614040595ae..e61cc2e025d8e33b7dd29069446e8320c2b56507 100644 (file)
@@ -43,6 +43,8 @@ struct wide_stage {
    uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS];
    uint texcoord_mode[PIPE_MAX_SHADER_OUTPUTS];
    uint num_texcoords;
+
+   int psize_slot;
 };
 
 
@@ -158,7 +160,7 @@ static void wide_point( struct draw_stage *stage,
 {
    const struct wide_stage *wide = wide_stage(stage);
    const boolean sprite = stage->draw->rasterizer->point_sprite;
-   float half_size = wide->half_point_size;
+   float half_size;
    float left_adj, right_adj;
 
    struct prim_header tri;
@@ -174,6 +176,14 @@ static void wide_point( struct draw_stage *stage,
    float *pos2 = v2->data[0];
    float *pos3 = v3->data[0];
 
+   /* point size is either per-vertex or fixed size */
+   if (wide->psize_slot >= 0) {
+      half_size = header->v[0]->data[wide->psize_slot][0];
+   }
+   else {
+      half_size = wide->half_point_size;
+   }
+
    left_adj = -half_size + 0.25;
    right_adj = half_size + 0.25;
 
@@ -248,6 +258,19 @@ static void wide_begin( struct draw_stage *stage )
       }
       wide->num_texcoords = j;
    }
+
+   wide->psize_slot = -1;
+   if (draw->rasterizer->point_size_per_vertex) {
+      /* find PSIZ vertex output */
+      const struct draw_vertex_shader *vs = draw->vertex_shader;
+      uint i;
+      for (i = 0; i < vs->state->num_outputs; i++) {
+         if (vs->state->output_semantic_name[i] == TGSI_SEMANTIC_PSIZE) {
+            wide->psize_slot = i;
+            break;
+         }
+      }
+   }
    
    stage->next->begin( stage->next );
 }
index ecbcbd098afa0e19c9d8f71da724f5e1351532f8..4a18d25ab89a4b59705e8fe903ec60b29362ca15 100644 (file)
@@ -86,6 +86,7 @@ struct pipe_rasterizer_state
    unsigned poly_stipple_enable:1;
    unsigned point_smooth:1;
    unsigned point_sprite:1;
+   unsigned point_size_per_vertex:1; /**< size computed in vertex shader */
    unsigned multisample:1;         /* XXX maybe more ms state in future */
    unsigned line_smooth:1;
    unsigned line_stipple_enable:1;
index 9f857e28375c74a3b08e6ae62871da9d1eee42a9..2a7128dd27cf90b1a550e87e703168866d62cddd 100644 (file)
@@ -201,6 +201,7 @@ static void update_raster_state( struct st_context *st )
          raster.sprite_coord_mode[i] = PIPE_SPRITE_COORD_NONE;
       }
    }
+   raster.point_size_per_vertex = ctx->VertexProgram.PointSizeEnabled;
 
    /* _NEW_LINE
     */