summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-03-14 16:13:35 -0600
committerBrian <brian.paul@tungstengraphics.com>2008-03-14 16:13:35 -0600
commit5a09ad8248ce452136ed96a3d46532b03c877618 (patch)
tree867a3c25fe90fb65a85d64819e8fcfe0c92aeb24 /src/gallium/auxiliary
parent344356a0edee932604027386591c82f6666e607c (diff)
gallium: add explicit control for point sprites (convert points to textured quads)
New draw_enable_point_sprites() function. Fixes spriteblast.c demo
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h1
-rw-r--r--src/gallium/auxiliary/draw/draw_validate.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_wide_point.c3
5 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index e8473a4c57..4cca965ac1 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -86,6 +86,7 @@ struct draw_context *draw_create( void )
draw->wide_point_threshold = 1000000.0; /* infinity */
draw->wide_line_threshold = 1.0;
draw->line_stipple = TRUE;
+ draw->point_sprite = TRUE;
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
@@ -267,6 +268,17 @@ draw_enable_line_stipple(struct draw_context *draw, boolean enable)
/**
+ * Tells draw module whether to convert points to quads for sprite mode.
+ */
+void
+draw_enable_point_sprites(struct draw_context *draw, boolean enable)
+{
+ draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+ draw->point_sprite = enable;
+}
+
+
+/**
* Ask the draw module for the location/slot of the given vertex attribute in
* a post-transformed vertex.
*
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index e8e2b56bae..dae687e590 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -96,6 +96,8 @@ void draw_wide_line_threshold(struct draw_context *draw, float threshold);
void draw_enable_line_stipple(struct draw_context *draw, boolean enable);
+void draw_enable_point_sprites(struct draw_context *draw, boolean enable);
+
boolean draw_use_sse(struct draw_context *draw);
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 379b6c3206..1c65c3d1b2 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -239,6 +239,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 line_stipple; /**< do line stipple? */
+ boolean point_sprite; /**< convert points to quads for sprites? */
boolean use_sse;
/* If a prim stage introduces new vertex attributes, they'll be stored here
diff --git a/src/gallium/auxiliary/draw/draw_validate.c b/src/gallium/auxiliary/draw/draw_validate.c
index 602fa3429d..33e5559508 100644
--- a/src/gallium/auxiliary/draw/draw_validate.c
+++ b/src/gallium/auxiliary/draw/draw_validate.c
@@ -76,6 +76,10 @@ draw_need_pipeline(const struct draw_context *draw)
if (draw->rasterizer->offset_cw || draw->rasterizer->offset_ccw)
return TRUE;
+ /* point sprites */
+ if (draw->rasterizer->point_sprite && draw->point_sprite)
+ return TRUE;
+
/* two-side lighting */
if (draw->rasterizer->light_twoside)
return TRUE;
@@ -110,7 +114,9 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
&& !draw->rasterizer->line_smooth);
/* drawing large points? */
- if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
+ if (draw->rasterizer->point_sprite && draw->point_sprite)
+ wide_points = TRUE;
+ else if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
wide_points = FALSE;
else if (draw->rasterizer->point_size > draw->wide_point_threshold)
wide_points = TRUE;
diff --git a/src/gallium/auxiliary/draw/draw_wide_point.c b/src/gallium/auxiliary/draw/draw_wide_point.c
index 65bd50f2b8..c53f7e6cb3 100644
--- a/src/gallium/auxiliary/draw/draw_wide_point.c
+++ b/src/gallium/auxiliary/draw/draw_wide_point.c
@@ -184,7 +184,8 @@ static void widepoint_first_point( struct draw_stage *stage,
wide->half_point_size = 0.5f * draw->rasterizer->point_size;
/* 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) {
+ if ((draw->rasterizer->point_size > draw->wide_point_threshold) ||
+ (draw->rasterizer->point_sprite && draw->point_sprite)) {
stage->point = widepoint_point;
}
else {