mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
gallium: add explicit control for point sprites (convert points to textured quads)
New draw_enable_point_sprites() function. Fixes spriteblast.c demo
This commit is contained in:
parent
344356a0ed
commit
5a09ad8248
5 changed files with 24 additions and 2 deletions
|
|
@ -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 */
|
||||
|
||||
|
|
@ -266,6 +267,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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue