gallium: add temporary facility for rasterization-time clamping of point sizes
authorKeith Whitwell <keith@tungstengraphics.com>
Wed, 2 Apr 2008 09:43:37 +0000 (10:43 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Wed, 2 Apr 2008 09:44:04 +0000 (10:44 +0100)
src/gallium/auxiliary/draw/draw_wide_point.c
src/gallium/include/pipe/p_state.h
src/mesa/state_tracker/st_atom_rasterizer.c

index c53f7e6..86281ca 100644 (file)
@@ -38,6 +38,8 @@ struct widepoint_stage {
    struct draw_stage stage;
 
    float half_point_size;
+   float point_size_min;
+   float point_size_max;
 
    uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS];
    uint texcoord_mode[PIPE_MAX_SHADER_OUTPUTS];
@@ -128,7 +130,15 @@ static void widepoint_point( struct draw_stage *stage,
 
    /* point size is either per-vertex or fixed size */
    if (wide->psize_slot >= 0) {
-      half_size = 0.5f * header->v[0]->data[wide->psize_slot][0];
+      half_size = header->v[0]->data[wide->psize_slot][0];
+
+      /* XXX: temporary -- do this in the vertex shader??
+       */
+      half_size = CLAMP(half_size,
+                        wide->point_size_min,
+                        wide->point_size_max);
+      
+      half_size *= 0.5f; 
    }
    else {
       half_size = wide->half_point_size;
@@ -182,6 +192,8 @@ static void widepoint_first_point( struct draw_stage *stage,
    struct draw_context *draw = stage->draw;
 
    wide->half_point_size = 0.5f * draw->rasterizer->point_size;
+   wide->point_size_min = draw->rasterizer->point_size_min;
+   wide->point_size_max = draw->rasterizer->point_size_max;
 
    /* 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) ||
index a730288..e407e3b 100644 (file)
@@ -118,6 +118,8 @@ struct pipe_rasterizer_state
 
    float line_width;
    float point_size;           /**< used when no per-vertex size */
+   float point_size_min;        /* XXX - temporary, will go away */
+   float point_size_max;        /* XXX - temporary, will go away */
    float offset_units;
    float offset_scale;
    ubyte sprite_coord_mode[PIPE_MAX_SHADER_OUTPUTS]; /**< PIPE_SPRITE_COORD_ */
index 17d77f9..14c26c1 100644 (file)
@@ -198,6 +198,10 @@ static void update_raster_state( struct st_context *st )
    /* _NEW_POINT
     */
    raster->point_size = ctx->Point.Size;
+
+   raster->point_size_min = 0;    /* temporary, will go away */
+   raster->point_size_max = 1000; /* temporary, will go away */
+
    raster->point_smooth = ctx->Point.SmoothFlag;
    raster->point_sprite = ctx->Point.PointSprite;
    for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {